From: Sam Bobroff <sam.bobroff@au1.ibm.com>
To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: david@gibson.dropbear.id.au, groug@kaod.org
Subject: [Qemu-devel] [PATCH v3 0/1] Exploit settable KVM_CAP_PPC_SMT
Date: Tue, 15 Aug 2017 14:42:16 +1000 [thread overview]
Message-ID: <cover.1502771785.git.sam.bobroff@au1.ibm.com> (raw)
Hello QEMU PPC people,
This is v3, it is only a single patch now.
My core objective with this patch is to provide a way for QEMU to configure the
newly writeable KVM capability 'KVM_CAP_PPC_SMT', because without it Power 9
hosts can only run VMs with a single thread per core. (With this capability they
are able to run VMs with 1, 2, 4 or 8 threads per core.) KVM also now contains a
new read-only property ('KVM_CAP_PPC_SMT_POSSIBLE') to expose the possible
valid values of KVM_CAP_PPC_SMT, although this is only used in a hint to the
user at this stage. This new capability is already upstream and the QEMU
headers have already been updated to include it.
The new way KVM_CAP_PPC_SMT works is that, when set, it causes KVM to act as if
the host's native number of threads per core were the value of the capability.
I've implemented this by adding a new property to pseries machines, which is
stored in sPAPRMachineState as 'vsmt'. This provides a way to set it from the
command line (and a way to add it to the VMState if we later decide to do so)
and makes the property available only when using SPAPR (pseries) machines. I
use this value to call in to KVM and set the capability when necessary.
For pseries machines, the vsmt value will be a duplicate of the KVM capability
value, and in version 1 I tried to remove this duplication by replacing
cap_ppc_smt completely with references to spapr->vsmt. Unfortunately, that
forced generic code (e.g. translate_init.c) to have knowledge of the
sPAPRMachine state which didn't seem conceptually clean. In version 2, I've
left the capability on the KVM side which keeps the KVM and generic code clear
of SPAPR concepts. I think on the whole this is a better solution.
Notes/Questions:
* I've moved the code that validates smp_threads out of ppc_cpu_realizefn()
because it only needs to be done once, not once per CPU.
Patch set changelog follows:
====== Version 2 -> version 3: ======
Patch 1/1: PPC: KVM: Support machine option to set VSMT mode
* Suggested by Greg Kurz:
* Comment on show_vsmt_possible() converted in to an assert().
* Better use of g_string_new().
* Removed trailing periods from several error_report() strings.
* Shortened overly long line.
* Converted some helpful error_report() calls into error_printf().
* Simplified error handling in spapr_set_vsmt().
* Use error_abort when adding properties (instead of ignoring errors), as it's a bug if it fails.
* Moved the explanation about KVM_CAP_PPC_SMT into the commit so that it's not lost with the cover letter.
====== Version 1 -> version 2: ======
Patch 1/1: PPC: KVM: Support machine option to set VSMT mode
* Reworked to keep SPAPR dependencies out of KVM code.
Sam Bobroff (1):
PPC: KVM: Support machine option to set VSMT mode
hw/ppc/spapr.c | 96 +++++++++++++++++++++++++++++++++++++++++++++
include/hw/ppc/spapr.h | 1 +
target/ppc/kvm.c | 20 +++++++++-
target/ppc/kvm_ppc.h | 12 ++++++
target/ppc/translate_init.c | 14 -------
5 files changed, 128 insertions(+), 15 deletions(-)
--
2.14.1.2.g4274c698f
next reply other threads:[~2017-08-15 4:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 4:42 Sam Bobroff [this message]
2017-08-15 4:42 ` [Qemu-devel] [PATCH v3 1/1] PPC: KVM: Support machine option to set VSMT mode Sam Bobroff
2017-08-15 21:08 ` Greg Kurz
2017-08-18 2:35 ` David Gibson
2017-08-18 5:32 ` Sam Bobroff
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=cover.1502771785.git.sam.bobroff@au1.ibm.com \
--to=sam.bobroff@au1.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).