All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check
@ 2016-02-03 14:59 Andrew Jones
  2016-02-04  1:54 ` Shannon Zhao
  2016-02-05 12:45 ` Shannon Zhao
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Jones @ 2016-02-03 14:59 UTC (permalink / raw)
  To: qemu-devel, qemu-arm; +Cc: peter.maydell, shannon.zhao

mach-virt doesn't yet support hotplug, but command lines specifying
-smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying
bigger-num as something bigger than the machine supports, e.g. > 8
on a gicv2 machine, should fail though. This fix also makes mach-
virt's max-cpus check truly consistent with the one in vl.c:main,
as the one there was already correctly checking max-cpus instead
of smp-cpus.

Reported-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 hw/arm/virt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 15658f49c4e06..44bbbea92b1cf 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *secure_sysmem = NULL;
     int gic_version = vms->gic_version;
-    int n, max_cpus;
+    int n, virt_max_cpus;
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     const char *cpu_model = machine->cpu_model;
     VirtBoardInfo *vbi;
@@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)
      * many redistributors we can fit into the memory map.
      */
     if (gic_version == 3) {
-        max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
+        virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
     } else {
-        max_cpus = GIC_NCPU;
+        virt_max_cpus = GIC_NCPU;
     }
 
-    if (smp_cpus > max_cpus) {
+    if (max_cpus > virt_max_cpus) {
         error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
                      "supported by machine 'mach-virt' (%d)",
-                     smp_cpus, max_cpus);
+                     max_cpus, virt_max_cpus);
         exit(1);
     }
 
-- 
2.4.3

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

* Re: [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check
  2016-02-03 14:59 [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check Andrew Jones
@ 2016-02-04  1:54 ` Shannon Zhao
  2016-02-04  9:18   ` Andrew Jones
  2016-02-05 12:45 ` Shannon Zhao
  1 sibling, 1 reply; 5+ messages in thread
From: Shannon Zhao @ 2016-02-04  1:54 UTC (permalink / raw)
  To: Andrew Jones, qemu-devel, qemu-arm; +Cc: peter.maydell, shannon.zhao



On 2016/2/3 22:59, Andrew Jones wrote:
> mach-virt doesn't yet support hotplug, but command lines specifying
> -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying
> bigger-num as something bigger than the machine supports, e.g. > 8
> on a gicv2 machine, should fail though. This fix also makes mach-
> virt's max-cpus check truly consistent with the one in vl.c:main,
> as the one there was already correctly checking max-cpus instead
> of smp-cpus.
> 
> Reported-by: Shannon Zhao <shannon.zhao@linaro.org>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  hw/arm/virt.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 15658f49c4e06..44bbbea92b1cf 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)
>      MemoryRegion *sysmem = get_system_memory();
>      MemoryRegion *secure_sysmem = NULL;
>      int gic_version = vms->gic_version;
> -    int n, max_cpus;
> +    int n, virt_max_cpus;
>      MemoryRegion *ram = g_new(MemoryRegion, 1);
>      const char *cpu_model = machine->cpu_model;
>      VirtBoardInfo *vbi;
> @@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)
>       * many redistributors we can fit into the memory map.
>       */
>      if (gic_version == 3) {
> -        max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
> +        virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
>      } else {
> -        max_cpus = GIC_NCPU;
> +        virt_max_cpus = GIC_NCPU;
>      }
>  
> -    if (smp_cpus > max_cpus) {
> +    if (max_cpus > virt_max_cpus) {
>          error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
Does it need to change the SMP?    ^~~~

>                       "supported by machine 'mach-virt' (%d)",
> -                     smp_cpus, max_cpus);
> +                     max_cpus, virt_max_cpus);
>          exit(1);
>      }

-- 
Shannon

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

* Re: [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check
  2016-02-04  1:54 ` Shannon Zhao
@ 2016-02-04  9:18   ` Andrew Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2016-02-04  9:18 UTC (permalink / raw)
  To: Shannon Zhao; +Cc: peter.maydell, qemu-arm, qemu-devel, shannon.zhao

On Thu, Feb 04, 2016 at 09:54:45AM +0800, Shannon Zhao wrote:
> 
> 
> On 2016/2/3 22:59, Andrew Jones wrote:
> > mach-virt doesn't yet support hotplug, but command lines specifying
> > -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying
> > bigger-num as something bigger than the machine supports, e.g. > 8
> > on a gicv2 machine, should fail though. This fix also makes mach-
> > virt's max-cpus check truly consistent with the one in vl.c:main,
> > as the one there was already correctly checking max-cpus instead
> > of smp-cpus.
> > 
> > Reported-by: Shannon Zhao <shannon.zhao@linaro.org>
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> >  hw/arm/virt.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > index 15658f49c4e06..44bbbea92b1cf 100644
> > --- a/hw/arm/virt.c
> > +++ b/hw/arm/virt.c
> > @@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)
> >      MemoryRegion *sysmem = get_system_memory();
> >      MemoryRegion *secure_sysmem = NULL;
> >      int gic_version = vms->gic_version;
> > -    int n, max_cpus;
> > +    int n, virt_max_cpus;
> >      MemoryRegion *ram = g_new(MemoryRegion, 1);
> >      const char *cpu_model = machine->cpu_model;
> >      VirtBoardInfo *vbi;
> > @@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)
> >       * many redistributors we can fit into the memory map.
> >       */
> >      if (gic_version == 3) {
> > -        max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
> > +        virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
> >      } else {
> > -        max_cpus = GIC_NCPU;
> > +        virt_max_cpus = GIC_NCPU;
> >      }
> >  
> > -    if (smp_cpus > max_cpus) {
> > +    if (max_cpus > virt_max_cpus) {
> >          error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
> Does it need to change the SMP?    ^~~~

If we consider max_cpus to be [the maximum] "SMP CPUs" after hotplug, then
I think it's OK. When I changed smp_cpus to max_cpus in vl.c (c00cd995),
either that was my reasoning for leaving it (or it was just overlooked :-),
but now that the messages are consistent, I should change them both if that's
the consensus.

Thanks,
drew

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

* Re: [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check
  2016-02-03 14:59 [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check Andrew Jones
  2016-02-04  1:54 ` Shannon Zhao
@ 2016-02-05 12:45 ` Shannon Zhao
  2016-02-09 17:07   ` Peter Maydell
  1 sibling, 1 reply; 5+ messages in thread
From: Shannon Zhao @ 2016-02-05 12:45 UTC (permalink / raw)
  To: Andrew Jones; +Cc: peter.maydell, qemu-arm, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

2016年2月3日星期三,Andrew Jones <drjones@redhat.com> 写道:

> mach-virt doesn't yet support hotplug, but command lines specifying
> -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying
> bigger-num as something bigger than the machine supports, e.g. > 8
> on a gicv2 machine, should fail though. This fix also makes mach-
> virt's max-cpus check truly consistent with the one in vl.c:main,
> as the one there was already correctly checking max-cpus instead
> of smp-cpus.
>
> Reported-by: Shannon Zhao <shannon.zhao@linaro.org <javascript:;>>
> Signed-off-by: Andrew Jones <drjones@redhat.com <javascript:;>>

Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>

> ---
>  hw/arm/virt.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 15658f49c4e06..44bbbea92b1cf 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)
>      MemoryRegion *sysmem = get_system_memory();
>      MemoryRegion *secure_sysmem = NULL;
>      int gic_version = vms->gic_version;
> -    int n, max_cpus;
> +    int n, virt_max_cpus;
>      MemoryRegion *ram = g_new(MemoryRegion, 1);
>      const char *cpu_model = machine->cpu_model;
>      VirtBoardInfo *vbi;
> @@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)
>       * many redistributors we can fit into the memory map.
>       */
>      if (gic_version == 3) {
> -        max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
> +        virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST].size / 0x20000;
>      } else {
> -        max_cpus = GIC_NCPU;
> +        virt_max_cpus = GIC_NCPU;
>      }
>
> -    if (smp_cpus > max_cpus) {
> +    if (max_cpus > virt_max_cpus) {
>          error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
>                       "supported by machine 'mach-virt' (%d)",
> -                     smp_cpus, max_cpus);
> +                     max_cpus, virt_max_cpus);
>          exit(1);
>      }
>
> --
> 2.4.3
>
>

[-- Attachment #2: Type: text/html, Size: 2937 bytes --]

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

* Re: [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check
  2016-02-05 12:45 ` Shannon Zhao
@ 2016-02-09 17:07   ` Peter Maydell
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2016-02-09 17:07 UTC (permalink / raw)
  To: Shannon Zhao; +Cc: Andrew Jones, qemu-arm, qemu-devel

On 5 February 2016 at 12:45, Shannon Zhao <shannon.zhao@linaro.org> wrote:
>
>
> 2016年2月3日星期三,Andrew Jones <drjones@redhat.com> 写道:
>>
>> mach-virt doesn't yet support hotplug, but command lines specifying
>> -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying
>> bigger-num as something bigger than the machine supports, e.g. > 8
>> on a gicv2 machine, should fail though. This fix also makes mach-
>> virt's max-cpus check truly consistent with the one in vl.c:main,
>> as the one there was already correctly checking max-cpus instead
>> of smp-cpus.
>>
>> Reported-by: Shannon Zhao <shannon.zhao@linaro.org>
>> Signed-off-by: Andrew Jones <drjones@redhat.com>
>
> Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
>>



Applied to target-arm.next, thanks.

-- PMM

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

end of thread, other threads:[~2016-02-09 17:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-03 14:59 [Qemu-devel] [PATCH] hw/arm/virt: fix max-cpus check Andrew Jones
2016-02-04  1:54 ` Shannon Zhao
2016-02-04  9:18   ` Andrew Jones
2016-02-05 12:45 ` Shannon Zhao
2016-02-09 17:07   ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.