deprecate incorrect CPUs topology
PATCH v5 2/2 vl:c: make sure that sockets are calculated correctly in '-smp X' case
In reply to Igor Mammedovcommit
(5cdc9b76e3 vl.c: Remove dead assignment)
removed sockets calculation when 'sockets' weren't provided on CLI since there wasn't any users for it back then. Exiting checks are neither reachable
} else if (sockets * cores * threads < cpus) {
or nor triggable
if (sockets * cores * threads > max_cpus)
so we weren't noticing wrong topology since then, since users recalculate sockets adhoc on their own.
However with deprecation check it becomes noticable, for example
-smp 2
will start printing warning:
"warning: Invalid CPU topology deprecated: sockets (1) * cores (1) * threads (1) != maxcpus (2)"
calculating sockets if they weren't specified.
Fix it by returning back sockets calculation if it's omited on CLI.
--- vl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
vl.c +4 -1
@@ -1210,11 +1210,14 @@ static void smp_parse(QemuOpts *opts)/* compute missing values, prefer sockets over cores over threads */ if (cpus ==0 || sockets ==0 ) { - sockets = sockets >0 ? sockets :1 ; cores = cores >0 ? cores :1 ; threads = threads >0 ? threads :1 ;if (cpus ==0 ) { + sockets = sockets >0 ? sockets :1 ; cpus = cores * threads * sockets; + }else { + max_cpus =qemu_opt_get_number (opts,"maxcpus" , cpus); + sockets = !sockets ? max_cpus / (cores * threads) : sockets; } }else if (cores ==0 ) { threads = threads >0 ? threads :1 ;
Signature · 1 line
2.7.4
v5 cover deprecate incorrect CPUs topology
Changelog since v4:
* extend deprication doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options (Eduardo Habkost <[email protected]>)
series bundles together 2 related patches posted separately earlier:
vl.c deprecate incorrect CPUs topology
vl:c: make sure that sockets are calculated correctly in '-smp X' case
Goal is to depricate invalid topologies so we could make sure that topology configuration is correct by forbidding invalid input once deprecation period ends.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
Igor Mammedov (2):
vl.c deprecate incorrect CPUs topology
vl:c: make sure that sockets are calculated correctly in '-smp X' case
qemu-deprecated.texi | 19 +++++++++++++++++++ vl.c | 12 +++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH v5 1/2 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]
---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 insertions(+)
qemu-deprecated.texi +19 -0
@@ -159,6 +159,25 @@ 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 +Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future. + @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
Re: [Qemu-devel] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
Quoted 35 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]>---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 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,25 @@ 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 -- they should all be plural
Quoted 43 lines
qemu-deprecated.texi +18
-0+ +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 +Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future. + @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
Otherwise
Re: [Qemu-devel] [PATCH v5 2/2] vl:c: make sure that sockets are calculated correctly in '-smp X' case
In reply to Igor MammedovQuoted 48 lines · Igor Mammedov
commit
(5cdc9b76e3vl.c: Remove dead assignment)
removed sockets calculation when 'sockets' weren't provided on CLI since there wasn't any users for it back then. Exiting checks are neither reachable
} else if (sockets * cores * threads < cpus) {
or nor triggable
if (sockets * cores * threads >max_cpus)
so we weren't noticing wrong topology since then, since users recalculate sockets adhoc on their own.However with deprecation check it becomes noticable, for example
-smp 2
will start printing warning:
"warning: Invalid CPU topology deprecated: sockets (1) * cores (1) * threads (1) != maxcpus (2)"
calculating sockets if they weren't specified.Fix it by returning back sockets calculation if it's omited on CLI.
Signed-off-by Igor Mammedov <[email protected]>--- vl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)vl.c +4
-1@@ -1210,11 +1210,14 @@ static void smp_parse(QemuOpts *opts)/* compute missing values, prefer sockets over cores over threads */ if (cpus ==0 || sockets ==0 ) { - sockets = sockets >0 ? sockets :1 ; cores = cores >0 ? cores :1 ; threads = threads >0 ? threads :1 ;if (cpus ==0 ) { + sockets = sockets >0 ? sockets :1 ; cpus = cores * threads * sockets; + }else { + max_cpus =qemu_opt_get_number (opts,"maxcpus" , cpus); + sockets = !sockets ? max_cpus / (cores * threads) : sockets; } }else if (cores ==0 ) { threads = threads >0 ? threads :1 ;Signature · 1 line
2.7.4
PATCH v6 1/2 vl.c deprecate incorrect CPUs topology
In reply to 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]
---
v6:
- s/socket/sockets/, the same for core, thread in subsection (Andrew Jones <[email protected]>)
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 insertions(+)
qemu-deprecated.texi +19 -0
@@ -159,6 +159,25 @@ 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,[sockets=a,cores=b,threads=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 +Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future. + @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
Re: [Qemu-devel] [PATCH v5 2/2] vl:c: make sure that sockets are calculated correctly in '-smp X' case
In reply to Andrew JonesQuoted 31 lines · Andrew Jones
Quoted 30 lines · Igor Mammedov
commit
(5cdc9b76e3vl.c: Remove dead assignment)
removed sockets calculation when 'sockets' weren't provided on CLI since there wasn't any users for it back then. Exiting checks are neither reachable
} else if (sockets * cores * threads < cpus) {
or nor triggable
if (sockets * cores * threads >max_cpus)
so we weren't noticing wrong topology since then, since users recalculate sockets adhoc on their own.However with deprecation check it becomes noticable, for example
-smp 2
will start printing warning:
"warning: Invalid CPU topology deprecated: sockets (1) * cores (1) * threads (1) != maxcpus (2)"
calculating sockets if they weren't specified.Fix it by returning back sockets calculation if it's omited on CLI.
Signed-off-by Igor Mammedov <[email protected]>--- vl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)vl.c +0
-0@@ -1210,11 +1210,14 @@ static void smp_parse(QemuOpts *opts)
Quoted 11 lines
vl.c static void smp_parse(QemuOpts *opts) · line 1220
Quoted 11 lines
vl.c +4
-1/* compute missing values, prefer sockets over cores over threads */ if (cpus ==0 || sockets ==0 ) { - sockets = sockets >0 ? sockets :1 ; cores = cores >0 ? cores :1 ; threads = threads >0 ? threads :1 ;if (cpus ==0 ) { + sockets = sockets >0 ? sockets :1 ; cpus = cores * threads * sockets; + }else { + max_cpus =qemu_opt_get_number (opts,"maxcpus" , cpus); + sockets = !sockets ? max_cpus / (cores * threads) : sockets;
Why the !sockets check here? If we have reached this statement we know that (cpus == 0 || sockets == 0) is true and (cpus == 0) is false, so sockets is guaranteed to be 0.
Sorry for not spotting this earlier.
Quoted 9 lines
Quoted 7 lines
vl.c +0
-0} }else if (cores ==0 ) { threads = threads >0 ? threads :1 ;Signature · 1 line
2.7.4Reviewed-by Andrew Jones <[email protected]>
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
In reply to Igor MammedovQuoted 35 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]>---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 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,25 @@ 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)
Minor: I suggest using @var markup, or maybe just use
"-smp (invalid topologies) (since 3.1)" as subsection title for simplicity?
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 5 lines
qemu-deprecated.texi +5
-0+ +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
Minor: this line formatting is lost on the HTML output. I suggest using @var and/or @math.
Minor: I suggest not using C syntax.
i.e. use something like:
@math{@var{n} <= @var{sockets} * @var{cores} * @var{threads} < @var{maxcpus}},
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 4 lines
qemu-deprecated.texi +4
-0+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
Minor: same as above. I suggest:
@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 179
Quoted 8 lines
qemu-deprecated.texi +8
-0+Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future.
I don't understand the purpose of the "Note:" section. It seems to duplicate what was already said in the lines above it. Can we just remove it?
These are just suggestions in case you are going to respin the series, not blockers.
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
Quoted 69 lines · On Tue, 4 Sep 2018 23:12:55 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 35 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]>---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 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,25 @@ 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)Minor: I suggest using @var markup, or maybe just use
"-smp (invalid topologies) (since 3.1)" as subsection title for simplicity?qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 5 lines
qemu-deprecated.texi +5
-0+ +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 < maxcpusMinor: this line formatting is lost on the HTML output. I suggest using @var and/or @math.
Minor: I suggest not using C syntax.
i.e. use something like:
@math{@var{n} <= @var{sockets} * @var{cores} * @var{threads} < @var{maxcpus}},
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 4 lines
qemu-deprecated.texi +4
-0+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 == maxcpusMinor: same as above. I suggest:
@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
Quoted 11 lines
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 179
Quoted 8 lines
qemu-deprecated.texi +8
-0+Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future.I don't understand the purpose of the "Note:" section. It seems to duplicate what was already said in the lines above it. Can we just remove it?
Well, didn't I say that no additional explanation needed in v4? Note section was added per your suggestion to explicitly say that maxcpus should be multiple of options present on CLI.
Quoted 4 lines
These are just suggestions in case you are going to respin the series, not blockers.
Re: [Qemu-devel] [PATCH v5 2/2] vl:c: make sure that sockets are calculated correctly in '-smp X' case
In reply to Eduardo HabkostQuoted 32 lines · On Tue, 4 Sep 2018 22:40:49 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 31 lines · Andrew Jones
Quoted 30 lines · Igor Mammedov
commit
(5cdc9b76e3vl.c: Remove dead assignment)
removed sockets calculation when 'sockets' weren't provided on CLI since there wasn't any users for it back then. Exiting checks are neither reachable
} else if (sockets * cores * threads < cpus) {
or nor triggable
if (sockets * cores * threads >max_cpus)
so we weren't noticing wrong topology since then, since users recalculate sockets adhoc on their own.However with deprecation check it becomes noticable, for example
-smp 2
will start printing warning:
"warning: Invalid CPU topology deprecated: sockets (1) * cores (1) * threads (1) != maxcpus (2)"
calculating sockets if they weren't specified.Fix it by returning back sockets calculation if it's omited on CLI.
Signed-off-by Igor Mammedov <[email protected]>--- vl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)vl.c +0
-0@@ -1210,11 +1210,14 @@ static void smp_parse(QemuOpts *opts)
Quoted 15 lines
Quoted 11 lines
vl.c static void smp_parse(QemuOpts *opts) · line 1220
Quoted 11 lines
vl.c +4
-1/* compute missing values, prefer sockets over cores over threads */ if (cpus ==0 || sockets ==0 ) { - sockets = sockets >0 ? sockets :1 ; cores = cores >0 ? cores :1 ; threads = threads >0 ? threads :1 ;if (cpus ==0 ) { + sockets = sockets >0 ? sockets :1 ; cpus = cores * threads * sockets; + }else { + max_cpus =qemu_opt_get_number (opts,"maxcpus" , cpus); + sockets = !sockets ? max_cpus / (cores * threads) : sockets;Why the !sockets check here? If we have reached this statement we know that (cpus == 0 || sockets == 0) is true and (cpus == 0) is false, so sockets is guaranteed to be 0.
Indeed, thanks for spotting it
I'll fix it up and respin
Quoted 13 lines
Sorry for not spotting this earlier.
Quoted 9 lines
Quoted 7 lines
vl.c +0
-0} }else if (cores ==0 ) { threads = threads >0 ? threads :1 ;Signature · 1 line
2.7.4Reviewed-by Andrew Jones <[email protected]>
Eduardo Habkost
Reviewed-byRe: [Qemu-devel] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
In reply to Igor MammedovQuoted 83 lines · Igor Mammedov
Quoted 69 lines · On Tue, 4 Sep 2018 23:12:55 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 35 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]>---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 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,25 @@ 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)Minor: I suggest using @var markup, or maybe just use
"-smp (invalid topologies) (since 3.1)" as subsection title for simplicity?qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 5 lines
qemu-deprecated.texi +5
-0+ +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 < maxcpusMinor: this line formatting is lost on the HTML output. I suggest using @var and/or @math.
Minor: I suggest not using C syntax.
i.e. use something like:
@math{@var{n} <= @var{sockets} * @var{cores} * @var{threads} < @var{maxcpus}},
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 4 lines
qemu-deprecated.texi +4
-0+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 == maxcpusMinor: same as above. I suggest:
@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
Quoted 11 lines
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 179
Quoted 8 lines
qemu-deprecated.texi +8
-0+Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future.I don't understand the purpose of the "Note:" section. It seems to duplicate what was already said in the lines above it. Can we just remove it?
Quoted 3 lines
Well, didn't I say that no additional explanation needed in v4? Note section was added per your suggestion to explicitly say that maxcpus should be multiple of options present on CLI.
You are right: I did ask for additional clarification on the documentation, because it was not clear that the warning can still appear even if some of the sockets/cores/threads options were omitted. The note didn't make that clearer to me, though.
In either case, this can be done on a follow-up patch if necessary.
Signature · 1 line
Eduardo
Re: [Qemu-devel] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
Quoted 84 lines · On Wed, 5 Sep 2018 10:45:12 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 83 lines · Igor Mammedov
Quoted 80 lines · On Tue, 4 Sep 2018 23:12:55 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 35 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]>---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 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,25 @@ 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)Minor: I suggest using @var markup, or maybe just use
"-smp (invalid topologies) (since 3.1)" as subsection title for simplicity?qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 5 lines
qemu-deprecated.texi +5
-0+ +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 < maxcpusMinor: this line formatting is lost on the HTML output. I suggest using @var and/or @math.
Minor: I suggest not using C syntax.
i.e. use something like:
@math{@var{n} <= @var{sockets} * @var{cores} * @var{threads} < @var{maxcpus}},
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 4 lines
qemu-deprecated.texi +4
-0+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 == maxcpusMinor: same as above. I suggest:
@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 179
Quoted 8 lines
qemu-deprecated.texi +8
-0+Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future.I don't understand the purpose of the "Note:" section. It seems to duplicate what was already said in the lines above it. Can we just remove it?
Quoted 8 lines
Quoted 3 lines
Well, didn't I say that no additional explanation needed in v4? Note section was added per your suggestion to explicitly say that maxcpus should be multiple of options present on CLI.
You are right: I did ask for additional clarification on the documentation, because it was not clear that the warning can still appear even if some of the sockets/cores/threads options were omitted. The note didn't make that clearer to me, though.
I can respin if necessary (we are not in hurry so no need to merge something that would be removed immediately).
Could you suggest a text for clarification for me to include on respin?
Quoted 6 lines
In either case, this can be done on a follow-up patch if necessary.
Reviewed-by Eduardo Habkost <[email protected]>
Re: [Qemu-devel] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
Quoted 91 lines · Igor Mammedov
Quoted 88 lines · On Wed, 5 Sep 2018 10:45:12 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 86 lines · Igor Mammedov
Quoted 69 lines · On Tue, 4 Sep 2018 23:12:55 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 35 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]>---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 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,25 @@ 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)Minor: I suggest using @var markup, or maybe just use
"-smp (invalid topologies) (since 3.1)" as subsection title for simplicity?qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 5 lines
qemu-deprecated.texi +5
-0+ +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 < maxcpusMinor: this line formatting is lost on the HTML output. I suggest using @var and/or @math.
Minor: I suggest not using C syntax.
i.e. use something like:
@math{@var{n} <= @var{sockets} * @var{cores} * @var{threads} < @var{maxcpus}},
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 4 lines
qemu-deprecated.texi +4
-0+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 == maxcpusMinor: same as above. I suggest:
@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
Quoted 11 lines
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 179
Quoted 8 lines
qemu-deprecated.texi +8
-0+Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future.I don't understand the purpose of the "Note:" section. It seems to duplicate what was already said in the lines above it. Can we just remove it?
Well, didn't I say that no additional explanation needed in v4? Note section was added per your suggestion to explicitly say that maxcpus should be multiple of options present on CLI.
Quoted 7 lines
Quoted 4 lines
You are right: I did ask for additional clarification on the documentation, because it was not clear that the warning can still appear even if some of the sockets/cores/threads options were omitted. The note didn't make that clearer to me, though.
I can respin if necessary (we are not in hurry so no need to merge something that would be removed immediately).
Could you suggest a text for clarification for me to include on respin?
I was planning to write a suggestion later, but I didn't want this series to be delayed because of me. Just removing the existing "Notes:" section would be good enough to me.
Probably the right place to document the subtle details of the s/c/t/maxcpus requirements is the "-smp" section on qemu-options.hx, not qemu-deprecated.hx.
I was considering something like this:
---
qemu-deprecated.texi +8 -4
@@ -139,16 +139,20 @@ 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) +@subsection -smp (invalid topologies) (since 3.1) CPU topology properties should describe whole machine topology including -possible CPUs, but historically it was possible to start QEMU with +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 - sockets * cores * threads >= X && X < maxcpus +@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. - sockets * cores * threads == maxcpus +@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}. + @section QEMU Machine Protocol (QMP) commands
qemu-options.hx +7 -2
@@ -155,8 +155,13 @@ to 4. For the PC target, the number of @var{cores} per socket, the number of @var{threads} per cores and the total number of @var{sockets} can be specified. Missing values will be computed. If any on the three values is -given, the total number of CPUs @var{n} can be omitted. @var{maxcpus} -specifies the maximum number of hotpluggable CPUs. +given, the total number of CPUs @var{n} can be omitted. + +@var{maxcpus} specifies the maximum number of hotpluggable CPUs +and should be equal to @math{@var{sockets} * @var{cores} * @var{threads}} +(even if @var{sockets}, @var{cores}, or @var{threads} is omitted +and computed automatically). + ETEXI DEF("numa", HAS_ARG, QEMU_OPTION_numa,
Signature · 1 line
Eduardo
Re: [Qemu-devel] [libvirt] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
In reply to Igor MammedovQuoted 18 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]>---
+@subsection -smp X,[socket=a,core=b,thread=c],maxcpus=Y (since 3.1)
qemu-deprecated.texi +2
-0+ +CPU topology properties should describe whole machine topology including
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 174
Quoted 10 lines
qemu-deprecated.texi +10
-0+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 +Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition
s/be/a/
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 176
Quoted 2 lines
qemu-deprecated.texi +2
-0+(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error.
a/a error/an error/
Quoted 1 line
+If you get deprecation warning it's recommended to explicitly specify
s/get/get a/
Quoted 3 lines
qemu-deprecated.texi +3
-0+a correct topology to make warning go away and ensure that it will +continue working in the future. +
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [libvirt] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
In reply to Eduardo HabkostQuoted 11 lines · Eduardo Habkost
I was considering something like this:
Signed-off-by Eduardo Habkost <[email protected]>---
qemu-deprecated.texi +1
-1--- a/qemu-deprecated.texi +++ b/qemu-options.hx
qemu-deprecated.texi to 4. · line 157
Quoted 3 lines
qemu-deprecated.texi +0
-0@@ -155,8 +155,13 @@ to 4. For the PC target, the number of @var{cores} per socket, the number of @var{threads} per cores and the total number of @var{sockets} can be specified. Missing values will be computed. If any on the three values is
while here, s/on/of/
Quoted 13 lines
qemu-deprecated.texi +7
-2-given, the total number of CPUs @var{n} can be omitted. @var{maxcpus} -specifies the maximum number of hotpluggable CPUs. +given, the total number of CPUs @var{n} can be omitted. + +@var{maxcpus} specifies the maximum number of hotpluggable CPUs +and should be equal to @math{@var{sockets} * @var{cores} * @var{threads}} +(even if @var{sockets}, @var{cores}, or @var{threads} is omitted +and computed automatically). + ETEXI DEF("numa", HAS_ARG, QEMU_OPTION_numa,
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v5 1/2] vl.c deprecate incorrect CPUs topology
In reply to Eduardo HabkostQuoted 128 lines · On Mon, 10 Sep 2018 14:49:23 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 91 lines · Igor Mammedov
Quoted 88 lines · On Wed, 5 Sep 2018 10:45:12 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 86 lines · Igor Mammedov
Quoted 69 lines · On Tue, 4 Sep 2018 23:12:55 -0300 Eduardo Habkost <[email protected]> wrote:
Quoted 35 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]>---
v5:
- extend deprecation doc, adding that maxcpus should be multiple of present on CLI [sockets/cores/threads] options
(Eduardo Habkost <[email protected]>)
v4:
- missed dot comment, fix it with s/./,/ (Andrew Jones <[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 | 19 +++++++++++++++++++ vl.c | 7 +++++++ 2 files changed, 26 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,25 @@ 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)Minor: I suggest using @var markup, or maybe just use
"-smp (invalid topologies) (since 3.1)" as subsection title for simplicity?qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 167
Quoted 5 lines
qemu-deprecated.texi +5
-0+ +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 < maxcpusMinor: this line formatting is lost on the HTML output. I suggest using @var and/or @math.
Minor: I suggest not using C syntax.
i.e. use something like:
@math{@var{n} <= @var{sockets} * @var{cores} * @var{threads} < @var{maxcpus}},
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 171
Quoted 4 lines
qemu-deprecated.texi +4
-0+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 == maxcpusMinor: same as above. I suggest:
@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}.
Quoted 11 lines
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 179
Quoted 8 lines
qemu-deprecated.texi +8
-0+Note: it's assumed that maxcpus value must be multiple of the topology +options present on command line to avoid creating an invalid topology. +If maxcpus isn't be multiple of present topology options then the condition +(sockets * cores * threads == maxcpus) can't be satisfied and it will +trigger deprecation warning which later will be converted to a error. +If you get deprecation warning it's recommended to explicitly specify +a correct topology to make warning go away and ensure that it will +continue working in the future.I don't understand the purpose of the "Note:" section. It seems to duplicate what was already said in the lines above it. Can we just remove it?
Well, didn't I say that no additional explanation needed in v4? Note section was added per your suggestion to explicitly say that maxcpus should be multiple of options present on CLI.
Quoted 7 lines
Quoted 4 lines
You are right: I did ask for additional clarification on the documentation, because it was not clear that the warning can still appear even if some of the sockets/cores/threads options were omitted. The note didn't make that clearer to me, though.
I can respin if necessary (we are not in hurry so no need to merge something that would be removed immediately).
Could you suggest a text for clarification for me to include on respin?I was planning to write a suggestion later, but I didn't want this series to be delayed because of me. Just removing the existing "Notes:" section would be good enough to me.
Probably the right place to document the subtle details of the s/c/t/maxcpus requirements is the "-smp" section on qemu-options.hx, not qemu-deprecated.hx.
I was considering something like this:
Signed-off-by Eduardo Habkost <[email protected]>---
qemu-deprecated.texi +4
-2@@ -139,16 +139,20 @@ 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) +@subsection -smp (invalid topologies) (since 3.1) CPU topology properties should describe whole machine topology including -possible CPUs, but historically it was possible to start QEMU with +possible CPUs. In other words: @var{maxcpus} should be equal to +@math{@var{sockets} * @var{cores} * @var{threads}}. +
qemu-deprecated.texi The 'file' driver for drives is no longer appropriate for character or host · line 155
Quoted 10 lines
qemu-deprecated.texi +4
-2+However, historically it was possible to start QEMU with an incorrect topology where - sockets * cores * threads >= X && X < maxcpus +@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. - sockets * cores * threads == maxcpus +@math{@var{sockets} * @var{cores} * @var{threads} = @var{maxcpus}}. +
Thanks,
suggestions taken in account and I'll drop Note section
Quoted 8 lines
qemu-deprecated.texi +0
-0@section QEMU Machine Protocol (QMP) commandsqemu-options.hx +0
-0@@ -155,8 +155,13 @@ to 4. For the PC target, the number of @var{cores} per socket, the number
qemu-options.hx to 4. · line 163
Quoted 10 lines
qemu-options.hx +6
-2of @var{threads} per cores and the total number of @var{sockets} can be specified. Missing values will be computed. If any on the three values is -given, the total number of CPUs @var{n} can be omitted. @var{maxcpus} -specifies the maximum number of hotpluggable CPUs. +given, the total number of CPUs @var{n} can be omitted. + +@var{maxcpus} specifies the maximum number of hotpluggable CPUs +and should be equal to @math{@var{sockets} * @var{cores} * @var{threads}} +(even if @var{sockets}, @var{cores}, or @var{threads} is omitted +and computed automatically).
Options doc I've left out, it probably should be separate patch.
Quoted 4 lines
qemu-options.hx +0
-0ETEXI DEF("numa", HAS_ARG, QEMU_OPTION_numa,