vl.c deprecate incorrect CPUs topology
PATCH v3 1/1 vl.c deprecate incorrect CPUs topology
-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]
---
v3:
- more spelling fixes (Andrew Jones <[email protected]>)
- place deprecation check after (sockets * cores * threads > max_cpus) check (Eduardo Habkost <[email protected]>)
v2:
- spelling&&co fixes (Andrew Jones <[email protected]>)
--- qemu-deprecated.texi | 11 +++++++++++ vl.c | 7 +++++++ 2 files changed, 18 insertions(+)
qemu-deprecated.texi +11 -0
@@ -159,6 +159,17 @@ 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 X,[socket=a,core=b,thread=c],maxcpus=Y (since 3.1) + +CPU topology properties should describe whole machine topology including +possible CPUs. but historically it was possible to start QEMU with +an incorrect topology where + sockets * cores * threads >= X && X < 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. + sockets * cores * threads == maxcpus + @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)
vl.c +7 -0
@@ -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;
Signature · 1 line
2.7.4
Quoted 29 lines · Igor Mammedov
-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 <[email protected]>---
v3:
- more spelling fixes (Andrew Jones <[email protected]>)
- place deprecation check after (sockets * cores * threads >max_cpus) check (Eduardo Habkost <[email protected]>)
v2:
- spelling&&co fixes (Andrew Jones <[email protected]>)--- qemu-deprecated.texi | 11 +++++++++++ vl.c | 7 +++++++ 2 files changed, 18 insertions(+)qemu-deprecated.texi +0
-0
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 165
Quoted 7 lines
qemu-deprecated.texi +4
-0@@ -159,6 +159,17 @@ 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 X,[socket=a,core=b,thread=c],maxcpus=Y (since 3.1) + +CPU topology properties should describe whole machine topology including +possible CPUs. but historically it was possible to start QEMU with
Change this period (.) to a comma (,) please :-)
Quoted 32 lines
qemu-deprecated.texi +7
-0+an incorrect topology where + sockets * cores * threads >= X && X < 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. + sockets * cores * threads == maxcpus + @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)vl.c +7
-0@@ -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;Signature · 1 line
2.7.4