From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: libvir-list@redhat.com, ehabkost@redhat.com
Subject: [Qemu-devel] [PATCH v7 1/2] vl.c deprecate incorrect CPUs topology
Date: Wed, 12 Sep 2018 18:19:14 +0200 [thread overview]
Message-ID: <1536769155-269737-2-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1536769155-269737-1-git-send-email-imammedo@redhat.com>
-smp [cpus],sockets/cores/threads[,maxcpus] should describe topology
so that total number of logical CPUs [sockets * cores * threads]
would be equal to [maxcpus], however historically we didn't have
such check in QEMU and it is possible to start VM with an invalid
topology.
Deprecate invalid options combination so we can make sure that
the topology VM started with is always correct in the future.
Users with an invalid sockets/cores/threads/maxcpus values should
fix their CLI to make sure that
[sockets * cores * threads] == [maxcpus]
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
---
v7:
- add corrections to deprication doc formulas/math/section title
- drop Note section
(Eduardo Habkost <ehabkost@redhat.com>)
v6:
- s/socket/sockets/, the same for core, thread in subsection
(Andrew Jones <drjones@redhat.com>)
v5:
- extend deprecation doc, adding that maxcpus should be multiple of
present on CLI [sockets/cores/threads] options
(Eduardo Habkost <ehabkost@redhat.com>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <drjones@redhat.com>)
v3:
- more spelling fixes (Andrew Jones <drjones@redhat.com>)
- place deprecation check after (sockets * cores * threads > max_cpus) check
(Eduardo Habkost <ehabkost@redhat.com>)
v2:
- spelling&&co fixes (Andrew Jones <drjones@redhat.com>)
---
qemu-deprecated.texi | 13 +++++++++++++
vl.c | 7 +++++++
2 files changed, 20 insertions(+)
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 1b9c007..31dc1b3 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -139,6 +139,19 @@ The 'file' driver for drives is no longer appropriate for character or host
devices and will only accept regular files (S_IFREG). The correct driver
for these file types is 'host_cdrom' or 'host_device' as appropriate.
+@subsection -smp (invalid topologies) (since 3.1)
+
+CPU topology properties should describe whole machine topology including
+possible CPUs. In other words: @var{maxcpus} should be equal to
+@math{@var{sockets} * @var{cores} * @var{threads}}.
+
+However, historically it was possible to start QEMU with an incorrect topology
+where @math{@var{n} <= @var{sockets} * @var{cores} * @var{threads} < @var{maxcpus}},
+which could lead to an incorrect topology enumeration by the guest.
+Support for invalid topologies will be removed, the user must ensure
+topologies described with -smp include all possible cpus, i.e.
+ @math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
+
@section QEMU Machine Protocol (QMP) commands
@subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)
diff --git a/vl.c b/vl.c
index 5ba06ad..7fd700e 100644
--- a/vl.c
+++ b/vl.c
@@ -1246,6 +1246,13 @@ static void smp_parse(QemuOpts *opts)
exit(1);
}
+ if (sockets * cores * threads != max_cpus) {
+ warn_report("Invalid CPU topology deprecated: "
+ "sockets (%u) * cores (%u) * threads (%u) "
+ "!= maxcpus (%u)",
+ sockets, cores, threads, max_cpus);
+ }
+
smp_cpus = cpus;
smp_cores = cores;
smp_threads = threads;
--
2.7.4
next prev parent reply other threads:[~2018-09-12 16:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 16:19 [Qemu-devel] [PATCH v7 0/2] deprecate incorrect CPUs topolog Igor Mammedov
2018-09-12 16:19 ` Igor Mammedov [this message]
2018-09-12 16:46 ` [Qemu-devel] [libvirt] [PATCH v7 1/2] vl.c deprecate incorrect CPUs topology Eric Blake
2018-09-12 16:19 ` [Qemu-devel] [PATCH v7 2/2] vl:c: make sure that sockets are calculated correctly in '-smp X' case Igor Mammedov
2018-09-12 16:43 ` [Qemu-devel] [libvirt] " Eric Blake
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=1536769155-269737-2-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=libvir-list@redhat.com \
--cc=qemu-devel@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).