diff --git a/migration-report-migration-related-thread-pid-to-lib.patch b/migration-report-migration-related-thread-pid-to-lib.patch new file mode 100644 index 0000000000000000000000000000000000000000..ea9a6b58f2292393d92b77d140324c34ff495c9d --- /dev/null +++ b/migration-report-migration-related-thread-pid-to-lib.patch @@ -0,0 +1,54 @@ +From f8bc91f17630ddf9272fba600f4452a3871b3fec Mon Sep 17 00:00:00 2001 +From: zhengchuan +Date: Mon, 5 Dec 2022 20:52:25 +0800 +Subject: [PATCH 4/5] migration: report migration related thread pid to libvirt + +in order to control migration thread cgroup, +we need to report migration related thread pid to libvirt + +Signed-off-by:zhengchuan +--- + migration/migration.c | 3 +++ + qapi/migration.json | 12 ++++++++++++ + 2 files changed, 15 insertions(+) + +diff --git a/migration/migration.c b/migration/migration.c +index f86dd8cccd..33d5832e47 100644 +--- a/migration/migration.c ++++ b/migration/migration.c +@@ -3823,6 +3823,9 @@ static void *migration_thread(void *opaque) + MigThrError thr_error; + bool urgent = false; + ++ /* report migration thread pid to libvirt */ ++ qapi_event_send_migration_pid(qemu_get_thread_id()); ++ + rcu_register_thread(); + + object_ref(OBJECT(s)); +diff --git a/qapi/migration.json b/qapi/migration.json +index fee266017d..48e3d36d39 100644 +--- a/qapi/migration.json ++++ b/qapi/migration.json +@@ -1284,6 +1284,18 @@ + { 'event': 'MIGRATION_PASS', + 'data': { 'pass': 'int' } } + ++## ++# @MIGRATION_PID: ++# ++# Emitted when migration thread appear ++# ++# @pid: pid of migration thread ++# ++# Since: EulerOS Virtual ++## ++{ 'event': 'MIGRATION_PID', ++ 'data': { 'pid': 'int' } } ++ + ## + # @COLOMessage: + # +-- +2.27.0 + diff --git a/migration-report-multiFd-related-thread-pid-to-libvi.patch b/migration-report-multiFd-related-thread-pid-to-libvi.patch new file mode 100644 index 0000000000000000000000000000000000000000..35b451db7464768c064f4f15f58104bd2b3b1e9c --- /dev/null +++ b/migration-report-multiFd-related-thread-pid-to-libvi.patch @@ -0,0 +1,62 @@ +From 5bc58d9cecbcb56c2494ea4aee7cd8a4a988b403 Mon Sep 17 00:00:00 2001 +From: zhengchuan +Date: Mon, 5 Dec 2022 20:56:35 +0800 +Subject: [PATCH 5/5] migration: report multiFd related thread pid to libvirt + +report multiFd related thread pid to libvirt in order to +pin multiFd thread to different cpu. + +Signed-off-by:zhengchuan +--- + migration/multifd.c | 4 ++++ + qapi/migration.json | 12 ++++++++++++ + 2 files changed, 16 insertions(+) + +diff --git a/migration/multifd.c b/migration/multifd.c +index 7c9deb1921..0d3f66537c 100644 +--- a/migration/multifd.c ++++ b/migration/multifd.c +@@ -17,6 +17,7 @@ + #include "exec/ramblock.h" + #include "qemu/error-report.h" + #include "qapi/error.h" ++#include "qapi/qapi-events-migration.h" + #include "ram.h" + #include "migration.h" + #include "socket.h" +@@ -629,6 +630,9 @@ static void *multifd_send_thread(void *opaque) + int ret = 0; + uint32_t flags = 0; + ++ /* report multifd thread pid to libvirt */ ++ qapi_event_send_migration_multifd_pid(qemu_get_thread_id()); ++ + trace_multifd_send_thread_start(p->id); + rcu_register_thread(); + +diff --git a/qapi/migration.json b/qapi/migration.json +index 48e3d36d39..8e18fd30e4 100644 +--- a/qapi/migration.json ++++ b/qapi/migration.json +@@ -1284,6 +1284,18 @@ + { 'event': 'MIGRATION_PASS', + 'data': { 'pass': 'int' } } + ++## ++# @MIGRATION_MULTIFD_PID: ++# ++# Emitted when multifd thread appear ++# ++# @pid: pid of multifd thread ++# ++# Since: EulerOS Virtual ++## ++{ 'event': 'MIGRATION_MULTIFD_PID', ++ 'data': { 'pid': 'int' } } ++ + ## + # @MIGRATION_PID: + # +-- +2.27.0 + diff --git a/qemu.spec b/qemu.spec index e1f5861d0db2f95eb2c5bb93aaf7eece319df434..643bc8ff814a2fb8fdc5f5a9b91e93e51bed6a1c 100644 --- a/qemu.spec +++ b/qemu.spec @@ -3,7 +3,7 @@ Name: qemu Version: 6.2.0 -Release: 63 +Release: 64 Epoch: 10 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 @@ -436,6 +436,12 @@ Patch0421: hw-display-qxl-Document-qxl_phys2virt.patch Patch0422: hw-display-qxl-Pass-requested-buffer-size-to-qxl_phy.patch Patch0423: hw-display-qxl-Avoid-buffer-overrun-in-qxl_phys2virt.patch Patch0424: hw-display-qxl-Assert-memory-slot-fits-in-preallocat.patch +Patch0425: target-arm-Use-kvm_arm_sve_supported-in-kvm_arm_get_.patch +Patch0426: target-arm-Set-KVM_ARM_VCPU_SVE-while-probing-the-ho.patch +Patch0427: target-arm-Move-sve-probe-inside-kvm-4.15-branch.patch +Patch0428: migration-report-migration-related-thread-pid-to-lib.patch +Patch0429: migration-report-multiFd-related-thread-pid-to-libvi.patch +Patch0430: vhost_net-keep-acked_feature-only-for-NET_CLIENT_DRI.patch BuildRequires: flex BuildRequires: gcc @@ -967,6 +973,11 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Wed Dec 14 2022 yezengruan - 10:6.2.0-64 +- target/arm: Fix kvm probe of ID_AA64ZFR0 +- migration: report migration/multiFd related thread pid to libvirt +- vhost_net: keep acked_feature only for NET_CLIENT_DRIVER_VHOST_USER + * Mon Dec 12 2022 Qiang Wei - 10:6.2.0-63 - Use bcond_without to control conditional build diff --git a/target-arm-Move-sve-probe-inside-kvm-4.15-branch.patch b/target-arm-Move-sve-probe-inside-kvm-4.15-branch.patch new file mode 100644 index 0000000000000000000000000000000000000000..3ee1d63cd2268f958971f09f45c1c361020aee09 --- /dev/null +++ b/target-arm-Move-sve-probe-inside-kvm-4.15-branch.patch @@ -0,0 +1,54 @@ +From d52674bfb6241316e436c8fe40dd5312950194dd Mon Sep 17 00:00:00 2001 +From: Richard Henderson +Date: Mon, 1 Aug 2022 16:21:18 +0100 +Subject: [PATCH 3/5] target/arm: Move sve probe inside kvm >= 4.15 branch + +The test for the IF block indicates no ID registers are exposed, much +less host support for SVE. Move the SVE probe into the ELSE block. + +Signed-off-by: Richard Henderson +Message-id: 20220726045828.53697-4-richard.henderson@linaro.org +Reviewed-by: Peter Maydell +Signed-off-by: Peter Maydell +Signed-off-by: Kunkun Jiang +--- + target/arm/kvm64.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c +index 5b15d0582d..0f67b8ba96 100644 +--- a/target/arm/kvm64.c ++++ b/target/arm/kvm64.c +@@ -654,18 +654,18 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) + dbgdidr |= (1 << 15); /* RES1 bit */ + ahcf->isar.regs[DBGDIDR] = dbgdidr; + } +- } + +- if (sve_supported) { +- /* +- * There is a range of kernels between kernel commit 73433762fcae +- * and f81cb2c3ad41 which have a bug where the kernel doesn't expose +- * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled +- * SVE support, which resulted in an error rather than RAZ. +- * So only read the register if we set KVM_ARM_VCPU_SVE above. +- */ +- err |= read_sys_reg64(fdarray[2], &ahcf->isar.regs[ID_AA64ZFR0], +- ARM64_SYS_REG(3, 0, 0, 4, 4)); ++ if (sve_supported) { ++ /* ++ * There is a range of kernels between kernel commit 73433762fcae ++ * and f81cb2c3ad41 which have a bug where the kernel doesn't ++ * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has ++ * enabled SVE support, which resulted in an error rather than RAZ. ++ * So only read the register if we set KVM_ARM_VCPU_SVE above. ++ */ ++ err |= read_sys_reg64(fdarray[2], &ahcf->isar.regs[ID_AA64ZFR0], ++ ARM64_SYS_REG(3, 0, 0, 4, 4)); ++ } + } + + kvm_arm_destroy_scratch_host_vcpu(fdarray); +-- +2.27.0 + diff --git a/target-arm-Set-KVM_ARM_VCPU_SVE-while-probing-the-ho.patch b/target-arm-Set-KVM_ARM_VCPU_SVE-while-probing-the-ho.patch new file mode 100644 index 0000000000000000000000000000000000000000..e00097e947a4a8e6aba91a545ef0a527c5f65535 --- /dev/null +++ b/target-arm-Set-KVM_ARM_VCPU_SVE-while-probing-the-ho.patch @@ -0,0 +1,79 @@ +From c9b226f4a56bb13d4f0924ea3ce4b334e65e6db2 Mon Sep 17 00:00:00 2001 +From: Richard Henderson +Date: Mon, 1 Aug 2022 16:21:18 +0100 +Subject: [PATCH 2/5] target/arm: Set KVM_ARM_VCPU_SVE while probing the host + +Because we weren't setting this flag, our probe of ID_AA64ZFR0 +was always returning zero. This also obviates the adjustment +of ID_AA64PFR0, which had sanitized the SVE field. + +The effects of the bug are not visible, because the only thing that +ID_AA64ZFR0 is used for within qemu at present is tcg translation. +The other tests for SVE within KVM are via ID_AA64PFR0.SVE. + +Reported-by: Zenghui Yu +Signed-off-by: Richard Henderson +Message-id: 20220726045828.53697-3-richard.henderson@linaro.org +Reviewed-by: Peter Maydell +Signed-off-by: Peter Maydell +Signed-off-by: Kunkun Jiang +--- + target/arm/kvm64.c | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c +index b7e34a4580..5b15d0582d 100644 +--- a/target/arm/kvm64.c ++++ b/target/arm/kvm64.c +@@ -501,7 +501,6 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) + int fdarray[3]; + bool sve_supported; + uint64_t features = 0; +- uint64_t t; + int err; + + /* Old kernels may not know about the PREFERRED_TARGET ioctl: however +@@ -521,6 +520,15 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) + */ + struct kvm_vcpu_init init = { .target = -1, }; + ++ /* ++ * Ask for SVE if supported, so that we can query ID_AA64ZFR0, ++ * which is otherwise RAZ. ++ */ ++ sve_supported = kvm_arm_sve_supported(); ++ if (sve_supported) { ++ init.features[0] |= 1 << KVM_ARM_VCPU_SVE; ++ } ++ + if (!kvm_arm_create_scratch_host_vcpu(cpus_to_try, fdarray, &init)) { + return false; + } +@@ -648,19 +656,13 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) + } + } + +- sve_supported = kvm_arm_sve_supported(); +- +- /* Add feature bits that can't appear until after VCPU init. */ + if (sve_supported) { +- t = ahcf->isar.regs[ID_AA64PFR0]; +- t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); +- ahcf->isar.regs[ID_AA64PFR0] = t; +- + /* +- * Before v5.1, KVM did not support SVE and did not expose +- * ID_AA64ZFR0_EL1 even as RAZ. After v5.1, KVM still does +- * not expose the register to "user" requests like this +- * unless the host supports SVE. ++ * There is a range of kernels between kernel commit 73433762fcae ++ * and f81cb2c3ad41 which have a bug where the kernel doesn't expose ++ * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled ++ * SVE support, which resulted in an error rather than RAZ. ++ * So only read the register if we set KVM_ARM_VCPU_SVE above. + */ + err |= read_sys_reg64(fdarray[2], &ahcf->isar.regs[ID_AA64ZFR0], + ARM64_SYS_REG(3, 0, 0, 4, 4)); +-- +2.27.0 + diff --git a/target-arm-Use-kvm_arm_sve_supported-in-kvm_arm_get_.patch b/target-arm-Use-kvm_arm_sve_supported-in-kvm_arm_get_.patch new file mode 100644 index 0000000000000000000000000000000000000000..9c5a9a3273233deef37fd3679a3ab578671a9686 --- /dev/null +++ b/target-arm-Use-kvm_arm_sve_supported-in-kvm_arm_get_.patch @@ -0,0 +1,34 @@ +From 110206cee2cf58b6ce4119e230b142192f7b52ac Mon Sep 17 00:00:00 2001 +From: Richard Henderson +Date: Mon, 1 Aug 2022 16:21:17 +0100 +Subject: [PATCH 1/5] target/arm: Use kvm_arm_sve_supported in + kvm_arm_get_host_cpu_features + +Indication for support for SVE will not depend on whether we +perform the query on the main kvm_state or the temp vcpu. + +Signed-off-by: Richard Henderson +Message-id: 20220726045828.53697-2-richard.henderson@linaro.org +Reviewed-by: Peter Maydell +Signed-off-by: Peter Maydell +Signed-off-by: Kunkun Jiang +--- + target/arm/kvm64.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c +index b34a87fd24..b7e34a4580 100644 +--- a/target/arm/kvm64.c ++++ b/target/arm/kvm64.c +@@ -648,7 +648,7 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) + } + } + +- sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0; ++ sve_supported = kvm_arm_sve_supported(); + + /* Add feature bits that can't appear until after VCPU init. */ + if (sve_supported) { +-- +2.27.0 + diff --git a/vhost_net-keep-acked_feature-only-for-NET_CLIENT_DRI.patch b/vhost_net-keep-acked_feature-only-for-NET_CLIENT_DRI.patch new file mode 100644 index 0000000000000000000000000000000000000000..762aad2c4e8ff6e4cdad84c11b276d1e36e747e0 --- /dev/null +++ b/vhost_net-keep-acked_feature-only-for-NET_CLIENT_DRI.patch @@ -0,0 +1,38 @@ +From fece8b3e700c30be2b6bb1239041333b3c1fc17b Mon Sep 17 00:00:00 2001 +From: liuxiangdong +Date: Mon, 5 Dec 2022 07:11:28 +0800 +Subject: [PATCH] vhost_net: keep acked_feature only for + NET_CLIENT_DRIVER_VHOST_USER + +Keep acked_features in NetVhostUserState up-to-date by function vhost_net_save_acked_features +in function virtio_net_set_features. But nc->peer->info->type maybe NET_CLIENT_DRIVER_TAP or +NET_CLIENT_DRIVER_VHOST_VDPA besides NET_CLIENT_DRIVER_VHOST_USER. + +Don't keep acked_features in other type now except NET_CLIENT_DRIVER_VHOST_USER + +Fix d29a94eff(vhost-user: Fix the virtio features negotiation flaw) + +Signed-off-by: liuxiangdong +--- + hw/net/vhost_net.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c +index a98575ffbc..bea053a742 100644 +--- a/hw/net/vhost_net.c ++++ b/hw/net/vhost_net.c +@@ -143,8 +143,9 @@ uint64_t vhost_net_get_acked_features(VHostNetState *net) + + void vhost_net_save_acked_features(NetClientState *nc) + { +- assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); +- vhost_user_save_acked_features(nc); ++ if (nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) { ++ vhost_user_save_acked_features(nc); ++ } + } + + static int vhost_net_get_fd(NetClientState *backend) +-- +2.27.0 +