All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option
@ 2016-01-05 11:59 Gerd Hoffmann
  2016-01-05 13:17 ` Michael S. Tsirkin
  0 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2016-01-05 11:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Michael S. Tsirkin, Gerd Hoffmann,
	Eduardo Habkost, Richard Henderson

This patch extends the functionality of the max-ram-below-4g option
to also allow increasing lowmem.  While being at it also rework the
lowmem calculation logic and add a longish comment describing how it
works and what the compatibility constrains are.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/pc.c      |  2 +-
 hw/i386/pc_piix.c | 61 +++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 459260b..1332269 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1887,7 +1887,7 @@ static void pc_machine_initfn(Object *obj)
                         pc_machine_get_hotplug_memory_region_size,
                         NULL, NULL, NULL, &error_abort);
 
-    pcms->max_ram_below_4g = 1ULL << 32; /* 4G */
+    pcms->max_ram_below_4g = 0xe0000000; /* 3.5G */
     object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size",
                         pc_machine_get_max_ram_below_4g,
                         pc_machine_set_max_ram_below_4g,
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 438cdae..3743736 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -87,29 +87,46 @@ static void pc_init1(MachineState *machine,
     PcGuestInfo *guest_info;
     ram_addr_t lowmem;
 
-    /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
-     * If it doesn't, we need to split it in chunks below and above 4G.
-     * In any case, try to make sure that guest addresses aligned at
-     * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
-     * For old machine types, use whatever split we used historically to avoid
-     * breaking migration.
+    /*
+     * Calculate ram split, for memory below and above 4G.  It's a bit
+     * complicated for backward compatibility reasons ...
+     *
+     *  - Traditional split is 3.5G (lowmem = 0xe0000000).  This is the
+     *    default value for max_ram_below_4g now.
+     *
+     *  - Then, to gigabyte align the memory, we move the split to 3G
+     *    (lowmem = 0xc0000000).  But only in case we have to split in
+     *    the first place, i.e. ram_size is larger than (traditional)
+     *    lowmem.  And for new machine types (gigabyte_align = true)
+     *    only, for live migration compatibility reasons.
+     *
+     *  - Next the max-ram-below-4g option was added, which allowed to
+     *    reduce lowmem to a smaller value, to allow a larger PCI I/O
+     *    window below 4G.  qemu doesn't enforce gigabyte alignment here,
+     *    but prints a warning.
+     *
+     *  - Finally max-ram-below-4g got updated to also allow raising lowmem,
+     *    so legacy non-PAE guests can get as much memory as possible in
+     *    the 32bit address space below 4G.
+     *
+     * Examples:
+     *    qemu -M pc-1.7 -m 4G    (old default)    -> 3584M low,  512M high
+     *    qemu -M pc -m 4G        (new default)    -> 3072M low, 1024M high
+     *    qemu -M pc,max-ram-below-4g=2G -m 4G     -> 2048M low, 2048M high
+     *    qemu -M pc,max-ram-below-4g=4G -m 3968M  -> 3968M low (=4G-128M)
      */
-    if (machine->ram_size >= 0xe0000000) {
-        lowmem = pcmc->gigabyte_align ? 0xc0000000 : 0xe0000000;
-    } else {
-        lowmem = 0xe0000000;
-    }
-
-    /* Handle the machine opt max-ram-below-4g.  It is basically doing
-     * min(qemu limit, user limit).
-     */
-    if (lowmem > pcms->max_ram_below_4g) {
-        lowmem = pcms->max_ram_below_4g;
-        if (machine->ram_size - lowmem > lowmem &&
-            lowmem & ((1ULL << 30) - 1)) {
-            error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
-                         ") not a multiple of 1G; possible bad performance.",
-                         pcms->max_ram_below_4g);
+    lowmem = pcms->max_ram_below_4g;
+    if (machine->ram_size >= pcms->max_ram_below_4g) {
+        if (pcmc->gigabyte_align) {
+            if (lowmem > 0xc0000000) {
+                lowmem = 0xc0000000;
+            }
+            if (lowmem & ((1ULL << 30) - 1)) {
+                error_report("Warning: Large machine and max_ram_below_4g "
+                             "(%" PRIu64 ") not a multiple of 1G; "
+                             "possible bad performance.",
+                             pcms->max_ram_below_4g);
+            }
         }
     }
 
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option
  2016-01-05 11:59 [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option Gerd Hoffmann
@ 2016-01-05 13:17 ` Michael S. Tsirkin
  2016-01-05 13:32   ` Gerd Hoffmann
  0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2016-01-05 13:17 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Paolo Bonzini, qemu-devel, Eduardo Habkost, Richard Henderson

On Tue, Jan 05, 2016 at 12:59:51PM +0100, Gerd Hoffmann wrote:
> This patch extends the functionality of the max-ram-below-4g option
> to also allow increasing lowmem.  While being at it also rework the
> lowmem calculation logic and add a longish comment describing how it
> works and what the compatibility constrains are.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Could you please add info about the motivation for this
in the commit log?

> ---
>  hw/i386/pc.c      |  2 +-
>  hw/i386/pc_piix.c | 61 +++++++++++++++++++++++++++++++++++--------------------
>  2 files changed, 40 insertions(+), 23 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 459260b..1332269 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1887,7 +1887,7 @@ static void pc_machine_initfn(Object *obj)
>                          pc_machine_get_hotplug_memory_region_size,
>                          NULL, NULL, NULL, &error_abort);
>  
> -    pcms->max_ram_below_4g = 1ULL << 32; /* 4G */
> +    pcms->max_ram_below_4g = 0xe0000000; /* 3.5G */
>      object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size",
>                          pc_machine_get_max_ram_below_4g,
>                          pc_machine_set_max_ram_below_4g,
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 438cdae..3743736 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -87,29 +87,46 @@ static void pc_init1(MachineState *machine,
>      PcGuestInfo *guest_info;
>      ram_addr_t lowmem;
>  
> -    /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
> -     * If it doesn't, we need to split it in chunks below and above 4G.
> -     * In any case, try to make sure that guest addresses aligned at
> -     * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
> -     * For old machine types, use whatever split we used historically to avoid
> -     * breaking migration.
> +    /*
> +     * Calculate ram split, for memory below and above 4G.  It's a bit
> +     * complicated for backward compatibility reasons ...
> +     *
> +     *  - Traditional split is 3.5G (lowmem = 0xe0000000).  This is the
> +     *    default value for max_ram_below_4g now.
> +     *
> +     *  - Then, to gigabyte align the memory, we move the split to 3G
> +     *    (lowmem = 0xc0000000).  But only in case we have to split in
> +     *    the first place, i.e. ram_size is larger than (traditional)
> +     *    lowmem.  And for new machine types (gigabyte_align = true)
> +     *    only, for live migration compatibility reasons.
> +     *
> +     *  - Next the max-ram-below-4g option was added, which allowed to
> +     *    reduce lowmem to a smaller value, to allow a larger PCI I/O
> +     *    window below 4G.  qemu doesn't enforce gigabyte alignment here,
> +     *    but prints a warning.
> +     *
> +     *  - Finally max-ram-below-4g got updated to also allow raising lowmem,
> +     *    so legacy non-PAE guests can get as much memory as possible in
> +     *    the 32bit address space below 4G.
> +     *
> +     * Examples:
> +     *    qemu -M pc-1.7 -m 4G    (old default)    -> 3584M low,  512M high
> +     *    qemu -M pc -m 4G        (new default)    -> 3072M low, 1024M high
> +     *    qemu -M pc,max-ram-below-4g=2G -m 4G     -> 2048M low, 2048M high
> +     *    qemu -M pc,max-ram-below-4g=4G -m 3968M  -> 3968M low (=4G-128M)
>       */
> -    if (machine->ram_size >= 0xe0000000) {
> -        lowmem = pcmc->gigabyte_align ? 0xc0000000 : 0xe0000000;
> -    } else {
> -        lowmem = 0xe0000000;
> -    }
> -
> -    /* Handle the machine opt max-ram-below-4g.  It is basically doing
> -     * min(qemu limit, user limit).
> -     */
> -    if (lowmem > pcms->max_ram_below_4g) {
> -        lowmem = pcms->max_ram_below_4g;
> -        if (machine->ram_size - lowmem > lowmem &&
> -            lowmem & ((1ULL << 30) - 1)) {
> -            error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
> -                         ") not a multiple of 1G; possible bad performance.",
> -                         pcms->max_ram_below_4g);
> +    lowmem = pcms->max_ram_below_4g;
> +    if (machine->ram_size >= pcms->max_ram_below_4g) {
> +        if (pcmc->gigabyte_align) {
> +            if (lowmem > 0xc0000000) {
> +                lowmem = 0xc0000000;
> +            }
> +            if (lowmem & ((1ULL << 30) - 1)) {
> +                error_report("Warning: Large machine and max_ram_below_4g "
> +                             "(%" PRIu64 ") not a multiple of 1G; "
> +                             "possible bad performance.",
> +                             pcms->max_ram_below_4g);
> +            }
>          }
>      }
>  
> -- 
> 1.8.3.1

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

* Re: [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option
  2016-01-05 13:17 ` Michael S. Tsirkin
@ 2016-01-05 13:32   ` Gerd Hoffmann
  2016-01-05 13:35     ` Michael S. Tsirkin
  0 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2016-01-05 13:32 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Paolo Bonzini, qemu-devel, Eduardo Habkost, Richard Henderson

On Di, 2016-01-05 at 15:17 +0200, Michael S. Tsirkin wrote:
> On Tue, Jan 05, 2016 at 12:59:51PM +0100, Gerd Hoffmann wrote:
> > This patch extends the functionality of the max-ram-below-4g option
> > to also allow increasing lowmem.  While being at it also rework the
> > lowmem calculation logic and add a longish comment describing how it
> > works and what the compatibility constrains are.
> > 
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> Could you please add info about the motivation for this
> in the commit log?

> > +     *  - Finally max-ram-below-4g got updated to also allow raising lowmem,
> > +     *    so legacy non-PAE guests can get as much memory as possible in
> > +     *    the 32bit address space below 4G.

It's right here (where it imho is more useful for people looking at the
code).

Want me copy this into the commit message?

cheers,
  Gerd

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

* Re: [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option
  2016-01-05 13:32   ` Gerd Hoffmann
@ 2016-01-05 13:35     ` Michael S. Tsirkin
  0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2016-01-05 13:35 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Paolo Bonzini, qemu-devel, Eduardo Habkost, Richard Henderson

On Tue, Jan 05, 2016 at 02:32:05PM +0100, Gerd Hoffmann wrote:
> On Di, 2016-01-05 at 15:17 +0200, Michael S. Tsirkin wrote:
> > On Tue, Jan 05, 2016 at 12:59:51PM +0100, Gerd Hoffmann wrote:
> > > This patch extends the functionality of the max-ram-below-4g option
> > > to also allow increasing lowmem.  While being at it also rework the
> > > lowmem calculation logic and add a longish comment describing how it
> > > works and what the compatibility constrains are.
> > > 
> > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > 
> > Could you please add info about the motivation for this
> > in the commit log?
> 
> > > +     *  - Finally max-ram-below-4g got updated to also allow raising lowmem,
> > > +     *    so legacy non-PAE guests can get as much memory as possible in
> > > +     *    the 32bit address space below 4G.
> 
> It's right here (where it imho is more useful for people looking at the
> code).

That's good.

> Want me copy this into the commit message?
> 
> cheers,
>   Gerd

Yes please do in the next revision. I do review in several passes, info
in commit log is helpful so I can decide how urgent is any given patch
and thus into which mailbox to sort it.

-- 
MST

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

* Re: [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option
  2015-10-22  6:49 Gerd Hoffmann
@ 2015-10-22  8:03 ` Igor Mammedov
  0 siblings, 0 replies; 6+ messages in thread
From: Igor Mammedov @ 2015-10-22  8:03 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Paolo Bonzini, Richard Henderson, qemu-devel, Eduardo Habkost,
	Michael S. Tsirkin

On Thu, 22 Oct 2015 08:49:00 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> This patch extends the functionality of the max-ram-below-4g option
> to also allow increasing lowmem.  While being at it also rework the
> lowmem calculation logic and add a longish comment describing how it
> works and what the compatibility constrains are.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/i386/pc.c      |  2 +-
>  hw/i386/pc_piix.c | 61 +++++++++++++++++++++++++++++++++++--------------------
>  2 files changed, 40 insertions(+), 23 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index b25a872..7d0b5f7 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1888,7 +1888,7 @@ static void pc_machine_initfn(Object *obj)
>                          pc_machine_get_hotplug_memory_region_size,
>                          NULL, NULL, NULL, &error_abort);
>  
> -    pcms->max_ram_below_4g = 1ULL << 32; /* 4G */
> +    pcms->max_ram_below_4g = 0xe0000000; /* 3.5G */
>      object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size",
>                          pc_machine_get_max_ram_below_4g,
>                          pc_machine_set_max_ram_below_4g,
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index a91cc3d..d628166 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -100,29 +100,46 @@ static void pc_init1(MachineState *machine,
>      PcGuestInfo *guest_info;
>      ram_addr_t lowmem;
>  
> -    /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
> -     * If it doesn't, we need to split it in chunks below and above 4G.
> -     * In any case, try to make sure that guest addresses aligned at
> -     * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
> -     * For old machine types, use whatever split we used historically to avoid
> -     * breaking migration.
> +    /*
> +     * Calculate ram split, for memory below and above 4G.  It's a bit
> +     * complicated for backward compatibility reasons ...
> +     *
> +     *  - Traditional split is 3.5G (lowmem = 0xe0000000).  This is the
> +     *    default value for max_ram_below_4g now.
> +     *
> +     *  - Then, to gigabyte align the memory, we move the split to 3G
> +     *    (lowmem = 0xc0000000).  But only in case we have to split in
> +     *    the first place, i.e. ram_size is larger than (traditional)
> +     *    lowmem.  And for new machine types (gigabyte_align = true)
> +     *    only, for live migration compatibility reasons.
> +     *
> +     *  - Next the max-ram-below-4g option was added, which allowed to
> +     *    reduce lowmem to a smaller value, to allow a larger PCI I/O
> +     *    window below 4G.  qemu doesn't enforce gigabyte alignment here,
> +     *    but prints a warning.
> +     *
> +     *  - Finally max-ram-below-4g got updated to also allow raising lowmem,
> +     *    so legacy non-PAE guests can get as much memory as possible in
> +     *    the 32bit address space below 4G.
> +     *
> +     * Examples:
> +     *    qemu -M pc-1.7 -m 4G    (old default)    -> 3584M low,  512M high
> +     *    qemu -M pc -m 4G        (new default)    -> 3072M low, 1024M high
> +     *    qemu -M pc,max-ram-below-4g=2G -M 4G     -> 2048M low, 2048M high
                                             ^^^ should be -m

> +     *    qemu -M pc,max-ram-below-4g=4G -M 3968M  -> 3968M low (=4G-128M)
                                             ^^^ the same here

>       */
> -    if (machine->ram_size >= 0xe0000000) {
> -        lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
> -    } else {
> -        lowmem = 0xe0000000;
> -    }
> -
> -    /* Handle the machine opt max-ram-below-4g.  It is basically doing
> -     * min(qemu limit, user limit).
> -     */
> -    if (lowmem > pcms->max_ram_below_4g) {
> -        lowmem = pcms->max_ram_below_4g;
> -        if (machine->ram_size - lowmem > lowmem &&
> -            lowmem & ((1ULL << 30) - 1)) {
> -            error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
> -                         ") not a multiple of 1G; possible bad performance.",
> -                         pcms->max_ram_below_4g);
> +    lowmem = pcms->max_ram_below_4g;
> +    if (machine->ram_size >= pcms->max_ram_below_4g) {
> +        if (gigabyte_align) {
> +            if (lowmem > 0xc0000000) {
> +                lowmem = 0xc0000000;
> +            }
> +            if (lowmem & ((1ULL << 30) - 1)) {
> +                error_report("Warning: Large machine and max_ram_below_4g "
> +                             "(%" PRIu64 ") not a multiple of 1G; "
> +                             "possible bad performance.",
> +                             pcms->max_ram_below_4g);
> +            }
>          }
>      }
>  

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

* [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option
@ 2015-10-22  6:49 Gerd Hoffmann
  2015-10-22  8:03 ` Igor Mammedov
  0 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2015-10-22  6:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Michael S. Tsirkin, Gerd Hoffmann,
	Eduardo Habkost, Richard Henderson

This patch extends the functionality of the max-ram-below-4g option
to also allow increasing lowmem.  While being at it also rework the
lowmem calculation logic and add a longish comment describing how it
works and what the compatibility constrains are.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/i386/pc.c      |  2 +-
 hw/i386/pc_piix.c | 61 +++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b25a872..7d0b5f7 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1888,7 +1888,7 @@ static void pc_machine_initfn(Object *obj)
                         pc_machine_get_hotplug_memory_region_size,
                         NULL, NULL, NULL, &error_abort);
 
-    pcms->max_ram_below_4g = 1ULL << 32; /* 4G */
+    pcms->max_ram_below_4g = 0xe0000000; /* 3.5G */
     object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size",
                         pc_machine_get_max_ram_below_4g,
                         pc_machine_set_max_ram_below_4g,
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index a91cc3d..d628166 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -100,29 +100,46 @@ static void pc_init1(MachineState *machine,
     PcGuestInfo *guest_info;
     ram_addr_t lowmem;
 
-    /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
-     * If it doesn't, we need to split it in chunks below and above 4G.
-     * In any case, try to make sure that guest addresses aligned at
-     * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
-     * For old machine types, use whatever split we used historically to avoid
-     * breaking migration.
+    /*
+     * Calculate ram split, for memory below and above 4G.  It's a bit
+     * complicated for backward compatibility reasons ...
+     *
+     *  - Traditional split is 3.5G (lowmem = 0xe0000000).  This is the
+     *    default value for max_ram_below_4g now.
+     *
+     *  - Then, to gigabyte align the memory, we move the split to 3G
+     *    (lowmem = 0xc0000000).  But only in case we have to split in
+     *    the first place, i.e. ram_size is larger than (traditional)
+     *    lowmem.  And for new machine types (gigabyte_align = true)
+     *    only, for live migration compatibility reasons.
+     *
+     *  - Next the max-ram-below-4g option was added, which allowed to
+     *    reduce lowmem to a smaller value, to allow a larger PCI I/O
+     *    window below 4G.  qemu doesn't enforce gigabyte alignment here,
+     *    but prints a warning.
+     *
+     *  - Finally max-ram-below-4g got updated to also allow raising lowmem,
+     *    so legacy non-PAE guests can get as much memory as possible in
+     *    the 32bit address space below 4G.
+     *
+     * Examples:
+     *    qemu -M pc-1.7 -m 4G    (old default)    -> 3584M low,  512M high
+     *    qemu -M pc -m 4G        (new default)    -> 3072M low, 1024M high
+     *    qemu -M pc,max-ram-below-4g=2G -M 4G     -> 2048M low, 2048M high
+     *    qemu -M pc,max-ram-below-4g=4G -M 3968M  -> 3968M low (=4G-128M)
      */
-    if (machine->ram_size >= 0xe0000000) {
-        lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
-    } else {
-        lowmem = 0xe0000000;
-    }
-
-    /* Handle the machine opt max-ram-below-4g.  It is basically doing
-     * min(qemu limit, user limit).
-     */
-    if (lowmem > pcms->max_ram_below_4g) {
-        lowmem = pcms->max_ram_below_4g;
-        if (machine->ram_size - lowmem > lowmem &&
-            lowmem & ((1ULL << 30) - 1)) {
-            error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
-                         ") not a multiple of 1G; possible bad performance.",
-                         pcms->max_ram_below_4g);
+    lowmem = pcms->max_ram_below_4g;
+    if (machine->ram_size >= pcms->max_ram_below_4g) {
+        if (gigabyte_align) {
+            if (lowmem > 0xc0000000) {
+                lowmem = 0xc0000000;
+            }
+            if (lowmem & ((1ULL << 30) - 1)) {
+                error_report("Warning: Large machine and max_ram_below_4g "
+                             "(%" PRIu64 ") not a multiple of 1G; "
+                             "possible bad performance.",
+                             pcms->max_ram_below_4g);
+            }
         }
     }
 
-- 
1.8.3.1

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

end of thread, other threads:[~2016-01-05 13:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-05 11:59 [Qemu-devel] [PATCH] pc: allow raising low memory via max-ram-below-4g option Gerd Hoffmann
2016-01-05 13:17 ` Michael S. Tsirkin
2016-01-05 13:32   ` Gerd Hoffmann
2016-01-05 13:35     ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2015-10-22  6:49 Gerd Hoffmann
2015-10-22  8:03 ` Igor Mammedov

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.