qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 06/24] Remove local ram_size that hides global one
@ 2012-11-13 12:11 Christian Borntraeger
  2012-11-19 13:14 ` Alexander Graf
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Borntraeger @ 2012-11-13 12:11 UTC (permalink / raw)
  To: agraf; +Cc: Christian Borntraeger, Heinz Graalfs, qemu-devel

From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>

The global variable 'ram_size' is hidden by the local variable
declaration in s390_init()

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 hw/s390-virtio.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index ebec844..78477af 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -155,7 +155,6 @@ unsigned s390_del_running_cpu(CPUS390XState *env)
 static void s390_init(QEMUMachineInitArgs *args)
 {
     ram_addr_t my_ram_size = args->ram_size;
-    ram_addr_t ram_size = args->ram_size;
     const char *cpu_model = args->cpu_model;
     const char *kernel_filename = args->kernel_filename;
     const char *kernel_cmdline = args->kernel_cmdline;
-- 
1.7.10.1

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

* Re: [Qemu-devel] [PATCH 06/24] Remove local ram_size that hides global one
  2012-11-13 12:11 [Qemu-devel] [PATCH 06/24] Remove local ram_size that hides global one Christian Borntraeger
@ 2012-11-19 13:14 ` Alexander Graf
  2012-11-19 13:20   ` Peter Maydell
  2012-11-19 13:35   ` Eduardo Habkost
  0 siblings, 2 replies; 7+ messages in thread
From: Alexander Graf @ 2012-11-19 13:14 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Heinz Graalfs, qemu-devel@nongnu.org qemu-devel, Eduardo Habkost


On 13.11.2012, at 13:11, Christian Borntraeger wrote:

> From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> 
> The global variable 'ram_size' is hidden by the local variable
> declaration in s390_init()

That's the point of Eduardo's patch, no? Or do we need access to the global to change its value afterwards? If so, please write a reasonable patch description that actually explains the problem.


Alex

> 
> Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> hw/s390-virtio.c |    1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
> index ebec844..78477af 100644
> --- a/hw/s390-virtio.c
> +++ b/hw/s390-virtio.c
> @@ -155,7 +155,6 @@ unsigned s390_del_running_cpu(CPUS390XState *env)
> static void s390_init(QEMUMachineInitArgs *args)
> {
>     ram_addr_t my_ram_size = args->ram_size;
> -    ram_addr_t ram_size = args->ram_size;
>     const char *cpu_model = args->cpu_model;
>     const char *kernel_filename = args->kernel_filename;
>     const char *kernel_cmdline = args->kernel_cmdline;
> -- 
> 1.7.10.1
> 

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

* Re: [Qemu-devel] [PATCH 06/24] Remove local ram_size that hides global one
  2012-11-19 13:14 ` Alexander Graf
@ 2012-11-19 13:20   ` Peter Maydell
  2012-11-19 13:35   ` Eduardo Habkost
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2012-11-19 13:20 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Christian Borntraeger, Heinz Graalfs,
	qemu-devel@nongnu.org qemu-devel, Eduardo Habkost

On 19 November 2012 13:14, Alexander Graf <agraf@suse.de> wrote:
>
> On 13.11.2012, at 13:11, Christian Borntraeger wrote:
>
>> From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
>>
>> The global variable 'ram_size' is hidden by the local variable
>> declaration in s390_init()
>
> That's the point of Eduardo's patch, no? Or do we need access
> to the global to change its value afterwards?

The function later does:
    /* lets propagate the changed ram size into the global variable. */
    ram_size = my_ram_size;

which frankly I think is pretty nasty but then we've never
had a very good mechanism for specifying board-specific
restrictions around the memory size.

-- PMM

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

* Re: [Qemu-devel] [PATCH 06/24] Remove local ram_size that hides global one
  2012-11-19 13:14 ` Alexander Graf
  2012-11-19 13:20   ` Peter Maydell
@ 2012-11-19 13:35   ` Eduardo Habkost
  2012-11-19 13:46     ` Alexander Graf
  1 sibling, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2012-11-19 13:35 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Christian Borntraeger, Heinz Graalfs,
	qemu-devel@nongnu.org qemu-devel

On Mon, Nov 19, 2012 at 02:14:27PM +0100, Alexander Graf wrote:
> 
> On 13.11.2012, at 13:11, Christian Borntraeger wrote:
> 
> > From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> > 
> > The global variable 'ram_size' is hidden by the local variable
> > declaration in s390_init()
> 
> That's the point of Eduardo's patch, no? Or do we need access to the global to change its value afterwards? If so, please write a reasonable patch description that actually explains the problem.
> 

Actually, I wanted to keep the existing behavior (whatever it was), and
use local variables to replace the old function parameters, and change
nothing else. Most machines used a local variable named 'ram_size', but
the parameter to s390_init() was named 'my_ram_size'.

So, considering that this at least restores the previous behavior:

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


> 
> Alex
> 
> > 
> > Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> > ---
> > hw/s390-virtio.c |    1 -
> > 1 file changed, 1 deletion(-)
> > 
> > diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
> > index ebec844..78477af 100644
> > --- a/hw/s390-virtio.c
> > +++ b/hw/s390-virtio.c
> > @@ -155,7 +155,6 @@ unsigned s390_del_running_cpu(CPUS390XState *env)
> > static void s390_init(QEMUMachineInitArgs *args)
> > {
> >     ram_addr_t my_ram_size = args->ram_size;
> > -    ram_addr_t ram_size = args->ram_size;
> >     const char *cpu_model = args->cpu_model;
> >     const char *kernel_filename = args->kernel_filename;
> >     const char *kernel_cmdline = args->kernel_cmdline;
> > -- 
> > 1.7.10.1
> > 
> 

-- 
Eduardo

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

* Re: [Qemu-devel] [PATCH 06/24] Remove local ram_size that hides global one
  2012-11-19 13:35   ` Eduardo Habkost
@ 2012-11-19 13:46     ` Alexander Graf
  2012-11-20  9:28       ` [Qemu-devel] [PATCH 1/1] s390: Fix ram_size updating in machine init Christian Borntraeger
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Graf @ 2012-11-19 13:46 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Christian Borntraeger, Heinz Graalfs,
	qemu-devel@nongnu.org qemu-devel


On 19.11.2012, at 14:35, Eduardo Habkost wrote:

> On Mon, Nov 19, 2012 at 02:14:27PM +0100, Alexander Graf wrote:
>> 
>> On 13.11.2012, at 13:11, Christian Borntraeger wrote:
>> 
>>> From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
>>> 
>>> The global variable 'ram_size' is hidden by the local variable
>>> declaration in s390_init()
>> 
>> That's the point of Eduardo's patch, no? Or do we need access to the global to change its value afterwards? If so, please write a reasonable patch description that actually explains the problem.
>> 
> 
> Actually, I wanted to keep the existing behavior (whatever it was), and
> use local variables to replace the old function parameters, and change
> nothing else. Most machines used a local variable named 'ram_size', but
> the parameter to s390_init() was named 'my_ram_size'.
> 
> So, considering that this at least restores the previous behavior:
> 
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

Yup, Heinz, please resend with a patch description that actually tells us what the problem is.


Alex

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

* [Qemu-devel] [PATCH 1/1] s390: Fix ram_size updating in machine init
  2012-11-19 13:46     ` Alexander Graf
@ 2012-11-20  9:28       ` Christian Borntraeger
  2012-11-20  9:31         ` Alexander Graf
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Borntraeger @ 2012-11-20  9:28 UTC (permalink / raw)
  To: Alexander Graf; +Cc: Christian Borntraeger, Heinz Graalfs, qemu-devel

From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>

The global variable 'ram_size' is hidden by the local variable
declaration in s390_init(). Since we want to update the global
ram size in certain cases we must not use a local ram_size
variable.
- This fixes booting with unusual ram sizes like -m 67001
- This changes behaviour back to the situation before commit
  5f072e1f3075bd869e0ace9f2545a85992ac0084
  (create struct for machine initialization arguments)

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 hw/s390-virtio.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index ebec844..78477af 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -155,7 +155,6 @@ unsigned s390_del_running_cpu(CPUS390XState *env)
 static void s390_init(QEMUMachineInitArgs *args)
 {
     ram_addr_t my_ram_size = args->ram_size;
-    ram_addr_t ram_size = args->ram_size;
     const char *cpu_model = args->cpu_model;
     const char *kernel_filename = args->kernel_filename;
     const char *kernel_cmdline = args->kernel_cmdline;
-- 
1.7.10.1

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

* Re: [Qemu-devel] [PATCH 1/1] s390: Fix ram_size updating in machine init
  2012-11-20  9:28       ` [Qemu-devel] [PATCH 1/1] s390: Fix ram_size updating in machine init Christian Borntraeger
@ 2012-11-20  9:31         ` Alexander Graf
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Graf @ 2012-11-20  9:31 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: Heinz Graalfs, qemu-devel


On 20.11.2012, at 10:28, Christian Borntraeger wrote:

> From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> 
> The global variable 'ram_size' is hidden by the local variable
> declaration in s390_init(). Since we want to update the global
> ram size in certain cases we must not use a local ram_size
> variable.
> - This fixes booting with unusual ram sizes like -m 67001
> - This changes behaviour back to the situation before commit
>  5f072e1f3075bd869e0ace9f2545a85992ac0084
>  (create struct for machine initialization arguments)
> 
> Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

Thanks, applied to s390-next.


Alex

> ---
> hw/s390-virtio.c |    1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
> index ebec844..78477af 100644
> --- a/hw/s390-virtio.c
> +++ b/hw/s390-virtio.c
> @@ -155,7 +155,6 @@ unsigned s390_del_running_cpu(CPUS390XState *env)
> static void s390_init(QEMUMachineInitArgs *args)
> {
>     ram_addr_t my_ram_size = args->ram_size;
> -    ram_addr_t ram_size = args->ram_size;
>     const char *cpu_model = args->cpu_model;
>     const char *kernel_filename = args->kernel_filename;
>     const char *kernel_cmdline = args->kernel_cmdline;
> -- 
> 1.7.10.1
> 

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

end of thread, other threads:[~2012-11-20  9:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13 12:11 [Qemu-devel] [PATCH 06/24] Remove local ram_size that hides global one Christian Borntraeger
2012-11-19 13:14 ` Alexander Graf
2012-11-19 13:20   ` Peter Maydell
2012-11-19 13:35   ` Eduardo Habkost
2012-11-19 13:46     ` Alexander Graf
2012-11-20  9:28       ` [Qemu-devel] [PATCH 1/1] s390: Fix ram_size updating in machine init Christian Borntraeger
2012-11-20  9:31         ` Alexander Graf

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