qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vl: smp_parse: fix regression
@ 2016-06-21 16:34 Andrew Jones
  2016-06-21 16:56 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Jones @ 2016-06-21 16:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, imammedo

Commit 0544edd88a "vl: smp_parse: cleanups" regressed any -smp
config that left either cores or threads unspecified, and specified
a topology supporting more cpus than the given online cpus. The
correct way to calculate the missing parameter would be to use
maxcpus, but it's too late to change that now. Restore the old
way, which is to calculate it with the online cpus (as is still
done), but then, if the result is zero, just set it to one.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 vl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/vl.c b/vl.c
index c85833a63c28e..b2137ca87078d 100644
--- a/vl.c
+++ b/vl.c
@@ -1234,8 +1234,10 @@ static void smp_parse(QemuOpts *opts)
         } else if (cores == 0) {
             threads = threads > 0 ? threads : 1;
             cores = cpus / (sockets * threads);
+            cores = cores > 0 ? cores : 1;
         } else if (threads == 0) {
             threads = cpus / (cores * sockets);
+            threads = threads > 0 ? threads : 1;
         } else if (sockets * cores * threads < cpus) {
             error_report("cpu topology: "
                          "sockets (%u) * cores (%u) * threads (%u) < "
-- 
2.4.11

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] vl: smp_parse: fix regression
  2016-06-21 16:34 [Qemu-devel] [PATCH] vl: smp_parse: fix regression Andrew Jones
@ 2016-06-21 16:56 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-06-21 16:56 UTC (permalink / raw)
  To: Andrew Jones, qemu-devel; +Cc: imammedo



On 21/06/2016 18:34, Andrew Jones wrote:
> Commit 0544edd88a "vl: smp_parse: cleanups" regressed any -smp
> config that left either cores or threads unspecified, and specified
> a topology supporting more cpus than the given online cpus. The
> correct way to calculate the missing parameter would be to use
> maxcpus, but it's too late to change that now. Restore the old
> way, which is to calculate it with the online cpus (as is still
> done), but then, if the result is zero, just set it to one.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  vl.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/vl.c b/vl.c
> index c85833a63c28e..b2137ca87078d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1234,8 +1234,10 @@ static void smp_parse(QemuOpts *opts)
>          } else if (cores == 0) {
>              threads = threads > 0 ? threads : 1;
>              cores = cpus / (sockets * threads);
> +            cores = cores > 0 ? cores : 1;
>          } else if (threads == 0) {
>              threads = cpus / (cores * sockets);
> +            threads = threads > 0 ? threads : 1;
>          } else if (sockets * cores * threads < cpus) {
>              error_report("cpu topology: "
>                           "sockets (%u) * cores (%u) * threads (%u) < "
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-21 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-21 16:34 [Qemu-devel] [PATCH] vl: smp_parse: fix regression Andrew Jones
2016-06-21 16:56 ` Paolo Bonzini

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).