vl.c deprecate incorrect CPUs topology
PATCH 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]
--- qemu-deprecated.texi | 11 +++++++++++ vl.c | 6 ++++++ 2 files changed, 17 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 + socket * core * thread >= X && < maxcpus +which could lead to incorrect topology enumeration by the guest. +Support for invalid topology will be removed, end user must ensure +that topology described with -smp includes all possible cpus, i.e.: + socket * core * thread == maxcpus + @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)
vl.c +6 -0
@@ -1238,6 +1238,12 @@ static void smp_parse(QemuOpts *opts)exit (1 ); } +if (sockets * cores * threads != max_cpus) { +warn_report ("Invalid CPUs topology deprecated. " +"sockets (%u) * cores (%u) * threads (%u) " +"!= maxcpus (%u)" , + sockets, cores, threads, max_cpus); + }if (sockets * cores * threads > max_cpus) {error_report ("cpu topology: " "sockets (%u) * cores (%u) * threads (%u) > "
Signature · 1 line
2.7.4
Quoted 22 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]>--- qemu-deprecated.texi | 11 +++++++++++ vl.c | 6 ++++++ 2 files changed, 17 insertions(+)qemu-deprecated.texi +0
-0
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 162
Quoted 4 lines
qemu-deprecated.texi +1
-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)
sockets, cores, threads
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 165
Quoted 3 lines
qemu-deprecated.texi +3
-0+ +CPU topology properties should describe whole machine topology including +possible CPUs. but historically it was possible to start QEMU with
/./,/
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 2 lines
qemu-deprecated.texi +2
-0+an incorrect topology where + socket * core * thread >= X && < maxcpus
sockets * cores * threads
&& X < maxcpus
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 169
Quoted 2 lines
qemu-deprecated.texi +2
-0+which could lead to incorrect topology enumeration by the guest. +Support for invalid topology will be removed, end user must ensure
topologies
/end user/the user/
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 170
Quoted 1 line
qemu-deprecated.texi +1
-0+that topology described with -smp includes all possible cpus, i.e.:
/that/the
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 1 line
qemu-deprecated.texi +1
-0+ socket * core * thread == maxcpus
sockets * cores * threads
Quoted 9 lines
qemu-deprecated.texi +1
-0+ @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)vl.c +0
-0
vl.c static void smp_parse(QemuOpts *opts) · line 1242
Quoted 5 lines
vl.c +2
-0@@ -1238,6 +1238,12 @@ static void smp_parse(QemuOpts *opts)exit (1 ); } +if (sockets * cores * threads != max_cpus) { + warn_report("Invalid CPUs topology deprecated. "
/CPUs/CPU/
Not sure we want a period after deprecated. Would ':' be more appropriate?
Quoted 10 lines
vl.c +4
-0+"sockets (%u) * cores (%u) * threads (%u) " +"!= maxcpus (%u)" , + sockets, cores, threads, max_cpus); + }if (sockets * cores * threads > max_cpus) {error_report ("cpu topology: " "sockets (%u) * cores (%u) * threads (%u) > "Signature · 1 line
2.7.4
Thanks,
drew
Quoted 85 lines · On Mon, 27 Aug 2018 14:13:43 +0200 Andrew Jones <[email protected]> wrote:
Quoted 22 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]>--- qemu-deprecated.texi | 11 +++++++++++ vl.c | 6 ++++++ 2 files changed, 17 insertions(+)qemu-deprecated.texi +0
-0qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 162
Quoted 4 lines
qemu-deprecated.texi +1
-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)sockets, cores, threads
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 165
Quoted 3 lines
qemu-deprecated.texi +3
-0+ +CPU topology properties should describe whole machine topology including +possible CPUs. but historically it was possible to start QEMU with/./,/
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 2 lines
qemu-deprecated.texi +2
-0+an incorrect topology where + socket * core * thread >= X && < maxcpussockets * cores * threads
&& X < maxcpus
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 169
Quoted 2 lines
qemu-deprecated.texi +2
-0+which could lead to incorrect topology enumeration by the guest. +Support for invalid topology will be removed, end user must ensuretopologies
/end user/the user/qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 170
Quoted 1 line
qemu-deprecated.texi +1
-0+that topology described with -smp includes all possible cpus, i.e.:/that/the
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 1 line
qemu-deprecated.texi +1
-0+ socket * core * thread == maxcpussockets * cores * threads
Quoted 9 lines
qemu-deprecated.texi +1
-0+ @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)vl.c +0
-0vl.c static void smp_parse(QemuOpts *opts) · line 1242
Quoted 5 lines
vl.c +2
-0@@ -1238,6 +1238,12 @@ static void smp_parse(QemuOpts *opts)exit (1 ); } +if (sockets * cores * threads != max_cpus) { + warn_report("Invalid CPUs topology deprecated. "/CPUs/CPU/
Not sure we want a period after deprecated. Would ':' be more appropriate?
Quoted 10 lines
vl.c +4
-0+"sockets (%u) * cores (%u) * threads (%u) " +"!= maxcpus (%u)" , + sockets, cores, threads, max_cpus); + }if (sockets * cores * threads > max_cpus) {error_report ("cpu topology: " "sockets (%u) * cores (%u) * threads (%u) > "Signature · 1 line
2.7.4
Quoted 3 lines
Thanks,
drew
Thanks for corrections, v2 is on the way