|
|
9bac43 |
From 689db60fc3f20c8aea0d5f382eb7d4de87e6bb3f Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
Date: Fri, 19 Jan 2018 04:04:57 +0100
|
|
|
9bac43 |
Subject: [PATCH 17/21] spapr: Allow some cases where we can't set VSMT mode in
|
|
|
9bac43 |
the kernel
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
Message-id: <20180119040458.5629-4-dgibson@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78678
|
|
|
9bac43 |
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH 3/4] spapr: Allow some cases where we can't set VSMT mode in the kernel
|
|
|
9bac43 |
Bugzilla: 1529243
|
|
|
9bac43 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
From: David Gibson <david@gibson.dropbear.id.au>
|
|
|
9bac43 |
|
|
|
9bac43 |
At present if we require a vsmt mode that's not equal to the kernel's
|
|
|
9bac43 |
default, and the kernel doesn't let us change it (e.g. because it's an old
|
|
|
9bac43 |
kernel without support) then we always fail.
|
|
|
9bac43 |
|
|
|
9bac43 |
But in fact we can cope with the kernel having a different vsmt as long as
|
|
|
9bac43 |
a) it's >= the actual number of vthreads/vcore (so that guest threads
|
|
|
9bac43 |
that are supposed to be on the same core act like it)
|
|
|
9bac43 |
b) it's a submultiple of the requested vsmt mode (so that guest threads
|
|
|
9bac43 |
spaced by the vsmt value will act like they're on different cores)
|
|
|
9bac43 |
|
|
|
9bac43 |
Allowing this case gives us a bit more freedom to adjust the vsmt behaviour
|
|
|
9bac43 |
without breaking existing cases.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
9bac43 |
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9bac43 |
Tested-by: Greg Kurz <groug@kaod.org>
|
|
|
9bac43 |
Reviewed-by: Greg Kurz <groug@kaod.org>
|
|
|
9bac43 |
(cherry picked from commit 1f20f2e0ee61d91abff4e86ed1cda1b5244647d3)
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: David Gibson <dgibson@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
hw/ppc/spapr.c | 26 +++++++++++++++++++-------
|
|
|
9bac43 |
1 file changed, 19 insertions(+), 7 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
|
|
9bac43 |
index 5233366..1086b5a 100644
|
|
|
9bac43 |
--- a/hw/ppc/spapr.c
|
|
|
9bac43 |
+++ b/hw/ppc/spapr.c
|
|
|
9bac43 |
@@ -2263,17 +2263,29 @@ static void spapr_set_vsmt_mode(sPAPRMachineState *spapr, Error **errp)
|
|
|
9bac43 |
if (kvm_enabled() && (spapr->vsmt != kvm_smt)) {
|
|
|
9bac43 |
ret = kvmppc_set_smt_threads(spapr->vsmt);
|
|
|
9bac43 |
if (ret) {
|
|
|
9bac43 |
+ /* Looks like KVM isn't able to change VSMT mode */
|
|
|
9bac43 |
error_setg(&local_err,
|
|
|
9bac43 |
"Failed to set KVM's VSMT mode to %d (errno %d)",
|
|
|
9bac43 |
spapr->vsmt, ret);
|
|
|
9bac43 |
- if (!vsmt_user) {
|
|
|
9bac43 |
- error_append_hint(&local_err, "On PPC, a VM with %d threads/"
|
|
|
9bac43 |
- "core on a host with %d threads/core requires "
|
|
|
9bac43 |
- " the use of VSMT mode %d.\n",
|
|
|
9bac43 |
- smp_threads, kvm_smt, spapr->vsmt);
|
|
|
9bac43 |
+ /* We can live with that if the default one is big enough
|
|
|
9bac43 |
+ * for the number of threads, and a submultiple of the one
|
|
|
9bac43 |
+ * we want. In this case we'll waste some vcpu ids, but
|
|
|
9bac43 |
+ * behaviour will be correct */
|
|
|
9bac43 |
+ if ((kvm_smt >= smp_threads) && ((spapr->vsmt % kvm_smt) == 0)) {
|
|
|
9bac43 |
+ warn_report_err(local_err);
|
|
|
9bac43 |
+ local_err = NULL;
|
|
|
9bac43 |
+ goto out;
|
|
|
9bac43 |
+ } else {
|
|
|
9bac43 |
+ if (!vsmt_user) {
|
|
|
9bac43 |
+ error_append_hint(&local_err,
|
|
|
9bac43 |
+ "On PPC, a VM with %d threads/core"
|
|
|
9bac43 |
+ " on a host with %d threads/core"
|
|
|
9bac43 |
+ " requires the use of VSMT mode %d.\n",
|
|
|
9bac43 |
+ smp_threads, kvm_smt, spapr->vsmt);
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ kvmppc_hint_smt_possible(&local_err);
|
|
|
9bac43 |
+ goto out;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
- kvmppc_hint_smt_possible(&local_err);
|
|
|
9bac43 |
- goto out;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
}
|
|
|
9bac43 |
/* else TCG: nothing to do currently */
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|