qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spapr: Fix VSMT mode when it is not supported by the kernel
@ 2019-11-08 15:40 Laurent Vivier
  2019-11-08 16:47 ` Greg Kurz
  0 siblings, 1 reply; 19+ messages in thread
From: Laurent Vivier @ 2019-11-08 15:40 UTC (permalink / raw)
  To: qemu-devel
  Cc: Laurent Vivier, Lukáš Doktor, Juan Quintela, Greg Kurz,
	Dr . David Alan Gilbert, qemu-ppc, clg, David Gibson

Commit 29cb4187497d sets by default the VSMT to smp_threads,
but older kernels (< 4.13) don't support that.

We can reasonably restore previous behavior with this kernel
to allow to run QEMU as before.

If VSMT is not supported, VSMT will be set to MAX(8, smp_threads)
as it is done for previous machine types (< pseries-4.2)

Fixes: 29cb4187497d ("spapr: Set VSMT to smp_threads by default")
Cc: groug@kaod.org
Reported-by: Lukáš Doktor <ldoktor@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 hw/ppc/spapr.c       | 2 +-
 target/ppc/kvm.c     | 5 +++++
 target/ppc/kvm_ppc.h | 6 ++++++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 94f9d27096af..f6c8ad1eda32 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2522,7 +2522,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)
             goto out;
         }
         /* In this case, spapr->vsmt has been set by the command line */
-    } else if (!smc->smp_threads_vsmt) {
+    } else if (!smc->smp_threads_vsmt || !kvmppc_check_smt_possible()) {
         /*
          * Default VSMT value is tricky, because we need it to be as
          * consistent as possible (for migration), but this requires
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 7d2e8969ac5f..40ed59881167 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2060,6 +2060,11 @@ void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
     }
 }
 
+bool kvmppc_check_smt_possible(void)
+{
+    return kvm_enabled() && cap_ppc_smt_possible;
+}
+
 int kvmppc_smt_threads(void)
 {
     return cap_ppc_smt ? cap_ppc_smt : 1;
diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h
index 98bd7d5da6d6..c9629a416b0b 100644
--- a/target/ppc/kvm_ppc.h
+++ b/target/ppc/kvm_ppc.h
@@ -27,6 +27,7 @@ void kvmppc_enable_h_page_init(void);
 void kvmppc_set_papr(PowerPCCPU *cpu);
 int kvmppc_set_compat(PowerPCCPU *cpu, uint32_t compat_pvr);
 void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy);
+bool kvmppc_check_smt_possible(void);
 int kvmppc_smt_threads(void);
 void kvmppc_hint_smt_possible(Error **errp);
 int kvmppc_set_smt_threads(int smt);
@@ -159,6 +160,11 @@ static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy)
 {
 }
 
+static inline bool kvmppc_check_smt_possible(void)
+{
+    return false;
+}
+
 static inline int kvmppc_smt_threads(void)
 {
     return 1;
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-11-21  2:03 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 15:40 [PATCH] spapr: Fix VSMT mode when it is not supported by the kernel Laurent Vivier
2019-11-08 16:47 ` Greg Kurz
2019-11-08 17:03   ` Laurent Vivier
2019-11-08 17:23     ` Greg Kurz
2019-11-19  1:00   ` David Gibson
2019-11-19 14:06     ` Laurent Vivier
2019-11-19 15:45       ` Greg Kurz
2019-11-19 16:13         ` Lukáš Doktor
2019-11-20  4:39           ` David Gibson
2019-11-20  4:36         ` David Gibson
2019-11-20  7:49           ` Greg Kurz
2019-11-20  9:00           ` Laurent Vivier
2019-11-20 11:28             ` Laurent Vivier
2019-11-20 11:41               ` David Gibson
2019-11-20 11:58                 ` Laurent Vivier
2019-11-20 14:28                 ` Laurent Vivier
2019-11-21  2:02                   ` David Gibson
2019-11-20 12:47               ` Greg Kurz
2019-11-20 13:35                 ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).