All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, qemu-devel@nongnu.org
Cc: Hu Tao <hutao@cn.fujitsu.com>,
	qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] spapr: Enable use of huge pages
Date: Wed, 09 Jul 2014 09:46:26 +0200	[thread overview]
Message-ID: <53BCF352.7070005@redhat.com> (raw)
In-Reply-To: <1404885472-23563-1-git-send-email-aik@ozlabs.ru>

Il 09/07/2014 07:57, Alexey Kardashevskiy ha scritto:
> 0b183fc87 "memory: move mem_path handling to
> memory_region_allocate_system_memory" disabled -mempath use for all
> machines that do not use memory_region_allocate_system_memory() to
> register RAM. Since SPAPR uses memory_region_init_ram(), the huge pages
> support was disabled for it.
>
> This replaces memory_region_init_ram()+vmstate_register_ram_global() with
> memory_region_allocate_system_memory() to get huge pages back.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Hu Tao <hutao@cn.fujitsu.com>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  hw/ppc/spapr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index a23c0f0..8fa9f7e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1337,8 +1337,8 @@ static void ppc_spapr_init(MachineState *machine)
>          ram_addr_t nonrma_base = rma_alloc_size;
>          ram_addr_t nonrma_size = spapr->ram_limit - rma_alloc_size;
>
> -        memory_region_init_ram(ram, NULL, "ppc_spapr.ram", nonrma_size);
> -        vmstate_register_ram_global(ram);
> +        memory_region_allocate_system_memory(ram, NULL, "ppc_spapr.ram",
> +                                             nonrma_size);

The reason why I didn't do this in the simple way is that depending on 
the value of nonrma_base you may get smaller hugepages than you wanted.

For example, if the hugepage size is 1G but nonrma_base is 32M, you will 
not be able to get a page size larger than 32M.

Depending on the value of nonrma_base, it may be better to allocate the 
whole spapr->ram_limit to ppc_spapr.ram, and just ignore the first part 
of it.

I see in target-ppc/kvm.c that rma_alloc_size is capped to 256M, and  in 
practice it is 128M (arch/powerpc/kvm/book3s_hv_builtin.c.  Considering 
that Linux overcommits so the memory isn't lost in the non-hugepage 
case, I think it's better to just waste the 128M of address space.

Paolo

>          memory_region_add_subregion(sysmem, nonrma_base, ram);
>      }
>
>

  parent reply	other threads:[~2014-07-09  7:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09  5:57 [Qemu-devel] [PATCH] spapr: Enable use of huge pages Alexey Kardashevskiy
2014-07-09  7:38 ` Hu Tao
2014-07-09  7:46 ` Paolo Bonzini [this message]
2014-07-09 13:59   ` [Qemu-devel] [RFC PATCH v2] " Alexey Kardashevskiy
2014-07-09 14:02     ` Paolo Bonzini
2014-07-10 10:29     ` Alexander Graf
2014-07-10 10:45       ` Alexey Kardashevskiy

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=53BCF352.7070005@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=hutao@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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 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.