From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Lukáš Doktor" <ldoktor@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Greg Kurz" <groug@kaod.org>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
qemu-ppc@nongnu.org, clg@kaod.org,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: [PATCH] spapr: Fix VSMT mode when it is not supported by the kernel
Date: Fri, 8 Nov 2019 16:40:35 +0100 [thread overview]
Message-ID: <20191108154035.12913-1-lvivier@redhat.com> (raw)
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
next reply other threads:[~2019-11-08 15:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 15:40 Laurent Vivier [this message]
2019-11-08 16:47 ` [PATCH] spapr: Fix VSMT mode when it is not supported by the kernel 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191108154035.12913-1-lvivier@redhat.com \
--to=lvivier@redhat.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=dgilbert@redhat.com \
--cc=groug@kaod.org \
--cc=ldoktor@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).