QEMU update to version 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

Signed-off-by: yezengruan <yezengruan@huawei.com>
(cherry picked from commit 2d46526fa69b16614ac095e5d2b11ae4e06649cf)
This commit is contained in:
yezengruan 2022-12-14 15:50:49 +08:00 committed by openeuler-sync-bot
parent fcabe533e0
commit 61b834b8b4
7 changed files with 333 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From f8bc91f17630ddf9272fba600f4452a3871b3fec Mon Sep 17 00:00:00 2001
From: zhengchuan <zhengchuan@huawei.com>
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<zhengchuan@huawei.com>
---
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

View File

@ -0,0 +1,62 @@
From 5bc58d9cecbcb56c2494ea4aee7cd8a4a988b403 Mon Sep 17 00:00:00 2001
From: zhengchuan <zhengchuan@huawei.com>
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<zhengchuan@huawei.com>
---
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

View File

@ -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 <yezengruan@huawei.com> - 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 <qiang.wei@suse.com> - 10:6.2.0-63
- Use bcond_without to control conditional build

View File

@ -0,0 +1,54 @@
From d52674bfb6241316e436c8fe40dd5312950194dd Mon Sep 17 00:00:00 2001
From: Richard Henderson <richard.henderson@linaro.org>
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 <richard.henderson@linaro.org>
Message-id: 20220726045828.53697-4-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
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

View File

@ -0,0 +1,79 @@
From c9b226f4a56bb13d4f0924ea3ce4b334e65e6db2 Mon Sep 17 00:00:00 2001
From: Richard Henderson <richard.henderson@linaro.org>
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 <yuzenghui@huawei.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220726045828.53697-3-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
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

View File

@ -0,0 +1,34 @@
From 110206cee2cf58b6ce4119e230b142192f7b52ac Mon Sep 17 00:00:00 2001
From: Richard Henderson <richard.henderson@linaro.org>
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 <richard.henderson@linaro.org>
Message-id: 20220726045828.53697-2-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
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

View File

@ -0,0 +1,38 @@
From fece8b3e700c30be2b6bb1239041333b3c1fc17b Mon Sep 17 00:00:00 2001
From: liuxiangdong <liuxiangdong5@huawei.com>
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 <liuxiangdong5@huawei.com>
---
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