qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2] q35: split memory at 2G
Date: Fri, 7 Jun 2019 07:38:15 -0400	[thread overview]
Message-ID: <20190607073416-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20190607073721.4960-1-kraxel@redhat.com>

On Fri, Jun 07, 2019 at 09:37:21AM +0200, Gerd Hoffmann wrote:
> Original q35 behavior was to split memory at 2.75 GB, leaving space for
> the mmconfig bar at 0xb000000 and pci I/O window starting at 0xc0000000.
> 
> Note: Those machine types have been removed from the qemu codebase
> meanwhile because they could not be live-migrated so there was little
> value in keeping them around.
> 
> With the effort to allow for gigabyte-alignment of guest memory that
> behavior was changed:  The split was moved to 2G, but only in case the
> memory didn't fit below 2.75 GB.
> 
> So today the address space between 2G and 2,75G is not used for guest
> memory in typical use cases, where the guest memory is sized at a power
> of two or a gigabyte number.  But if you configure your guest with some
> odd amount of memory (such as 2.5G) the address space is used.
> This patch removes that oddity for 4.1+ machine types.  The memory is
> split at 2G no matter what.

And that's done on the assumption that it's a good idea such that 32
guests can address it.

Could you maybe add an explanation about why this is a problem?

> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  include/hw/i386/pc.h | 1 +
>  hw/i386/pc.c         | 1 +
>  hw/i386/pc_q35.c     | 7 ++++++-
>  3 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 5d5636241e34..dfe3e6104181 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -120,6 +120,7 @@ typedef struct PCMachineClass {
>  
>      /* RAM / address space compat: */
>      bool gigabyte_align;
> +    bool gigabyte_split;
>      bool has_reserved_memory;
>      bool enforce_aligned_dimm;
>      bool broken_reserved_end;
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index edc240bcbf59..3cc9432bd187 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -2722,6 +2722,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
>      pcmc->smbios_defaults = true;
>      pcmc->smbios_uuid_encoded = true;
>      pcmc->gigabyte_align = true;
> +    pcmc->gigabyte_split = true;
>      pcmc->has_reserved_memory = true;
>      pcmc->kvmclock_enabled = true;
>      pcmc->enforce_aligned_dimm = true;
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index dcddc6466200..57d06d55ef4d 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -143,8 +143,10 @@ static void pc_q35_init(MachineState *machine)
>       * 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.
> +     *
> +     * qemu 4.1+ machines: split at 2G unconditionally (gigabyte_split = true)
>       */
> -    if (machine->ram_size >= 0xb0000000) {
> +    if (machine->ram_size >= 0xb0000000 || pcmc->gigabyte_split) {
>          lowmem = 0x80000000;
>      } else {
>          lowmem = 0xb0000000;
> @@ -376,8 +378,11 @@ DEFINE_Q35_MACHINE(v4_1, "pc-q35-4.1", NULL,
>  
>  static void pc_q35_4_0_1_machine_options(MachineClass *m)
>  {
> +    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
> +
>      pc_q35_4_1_machine_options(m);
>      m->alias = NULL;
> +    pcmc->gigabyte_split = false;
>      compat_props_add(m->compat_props, hw_compat_4_0_1, hw_compat_4_0_1_len);
>      compat_props_add(m->compat_props, pc_compat_4_0_1, pc_compat_4_0_1_len);
>  }
> -- 
> 2.18.1


      reply	other threads:[~2019-06-07 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07  7:37 [Qemu-devel] [PATCH v2] q35: split memory at 2G Gerd Hoffmann
2019-06-07 11:38 ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607073416-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).