qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vl.c: Keep maxram_size and ram_size consistent unless specified otherwise
@ 2014-07-07 23:05 Bruce Rogers
  2014-07-08 13:23 ` Igor Mammedov
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Rogers @ 2014-07-07 23:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: imammedo, Bruce Rogers, aliguori, mst

When using a memory size less than the default amount with older pc machine
types, a failure occurs because of the way maxram_size and ram_size get
initialized. Keep maxram_size and ram_size the same, except when maxmem
is specified on the command line.

Signed-off-by: Bruce Rogers <brogers@suse.com>
---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vl.c b/vl.c
index 6e084c2..0cb8c10 100644
--- a/vl.c
+++ b/vl.c
@@ -3345,7 +3345,6 @@ int main(int argc, char **argv, char **envp)
                                 RAM_ADDR_FMT ")\n", slots, sz, ram_size);
                         exit(EXIT_FAILURE);
                     }
-                    maxram_size = sz;
                     ram_slots = slots;
                 } else if ((!maxmem_str && slots_str) ||
                            (maxmem_str && !slots_str)) {
@@ -3353,6 +3352,7 @@ int main(int argc, char **argv, char **envp)
                             "'%s' option\n", slots_str ? "maxmem" : "slots");
                     exit(EXIT_FAILURE);
                 }
+                maxram_size = sz;
                 break;
             }
 #ifdef CONFIG_TPM
-- 
1.9.0

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

* Re: [Qemu-devel] [PATCH] vl.c: Keep maxram_size and ram_size consistent unless specified otherwise
  2014-07-07 23:05 [Qemu-devel] [PATCH] vl.c: Keep maxram_size and ram_size consistent unless specified otherwise Bruce Rogers
@ 2014-07-08 13:23 ` Igor Mammedov
  2014-07-08 13:51   ` Bruce Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: Igor Mammedov @ 2014-07-08 13:23 UTC (permalink / raw)
  To: Bruce Rogers; +Cc: qemu-devel, aliguori, mst

On Mon,  7 Jul 2014 17:05:22 -0600
Bruce Rogers <brogers@suse.com> wrote:

> When using a memory size less than the default amount with older pc
> machine types, a failure occurs because of the way maxram_size and
> ram_size get initialized. Keep maxram_size and ram_size the same,
> except when maxmem is specified on the command line.
> 
> Signed-off-by: Bruce Rogers <brogers@suse.com>
> ---
>  vl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/vl.c b/vl.c
> index 6e084c2..0cb8c10 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3345,7 +3345,6 @@ int main(int argc, char **argv, char **envp)
>                                  RAM_ADDR_FMT ")\n", slots, sz,
> ram_size); exit(EXIT_FAILURE);
>                      }
> -                    maxram_size = sz;
>                      ram_slots = slots;
>                  } else if ((!maxmem_str && slots_str) ||
>                             (maxmem_str && !slots_str)) {
> @@ -3353,6 +3352,7 @@ int main(int argc, char **argv, char **envp)
>                              "'%s' option\n", slots_str ? "maxmem" :
> "slots"); exit(EXIT_FAILURE);
>                  }
> +                maxram_size = sz;
Relying here on sz being either ram_size or maxmem is a bit fragile.
It'd be better to set maxram_size to ram_size before parsing maxmem.

I'll post alternative patch. 

>                  break;
>              }
>  #ifdef CONFIG_TPM

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

* Re: [Qemu-devel] [PATCH] vl.c: Keep maxram_size and ram_size consistent unless specified otherwise
  2014-07-08 13:23 ` Igor Mammedov
@ 2014-07-08 13:51   ` Bruce Rogers
  0 siblings, 0 replies; 3+ messages in thread
From: Bruce Rogers @ 2014-07-08 13:51 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, aliguori, mst

 >>> On 7/8/2014 at 07:23 AM, <imammedo@redhat.com> wrote: 
> On Mon,  7 Jul 2014 17:05:22 -0600
> Bruce Rogers <brogers@suse.com> wrote:
> 
>> When using a memory size less than the default amount with older pc
>> machine types, a failure occurs because of the way maxram_size and
>> ram_size get initialized. Keep maxram_size and ram_size the same,
>> except when maxmem is specified on the command line.
>> 
>> Signed-off-by: Bruce Rogers <brogers@suse.com>
>> ---
>>  vl.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/vl.c b/vl.c
>> index 6e084c2..0cb8c10 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -3345,7 +3345,6 @@ int main(int argc, char **argv, char **envp)
>>                                  RAM_ADDR_FMT ")\n", slots, sz,
>> ram_size); exit(EXIT_FAILURE);
>>                      }
>> -                    maxram_size = sz;
>>                      ram_slots = slots;
>>                  } else if ((!maxmem_str && slots_str) ||
>>                             (maxmem_str && !slots_str)) {
>> @@ -3353,6 +3352,7 @@ int main(int argc, char **argv, char **envp)
>>                              "'%s' option\n", slots_str ? "maxmem" :
>> "slots"); exit(EXIT_FAILURE);
>>                  }
>> +                maxram_size = sz;
> Relying here on sz being either ram_size or maxmem is a bit fragile.
> It'd be better to set maxram_size to ram_size before parsing maxmem.
> 
> I'll post alternative patch. 
> 
>>                  break;
>>              }
>>  #ifdef CONFIG_TPM

Either way is fine with me.

Thanks

Bruce

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

end of thread, other threads:[~2014-07-08 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 23:05 [Qemu-devel] [PATCH] vl.c: Keep maxram_size and ram_size consistent unless specified otherwise Bruce Rogers
2014-07-08 13:23 ` Igor Mammedov
2014-07-08 13:51   ` Bruce Rogers

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