qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	hangaohuai@huawei.com, peter.huangpeng@huawei.com,
	zhuyijun <zhuyijun@huawei.com>
Subject: Re: [Qemu-devel] [PATCH] hw/arm/virt: Replace memory_region_init_ram with memory_region_allocate_system_memory
Date: Fri, 17 Oct 2014 14:05:33 +0200	[thread overview]
Message-ID: <5441060D.6080904@redhat.com> (raw)
In-Reply-To: <CAFEAcA8XvM0hJFb9qbFqYm6Z8HoFaTm6n-zQXYBmNo-WHa8m0g@mail.gmail.com>

Il 14/10/2014 14:48, Peter Maydell ha scritto:
> Why don't we just do that automatically for all RAM regions
> the machine creates? We're already splitting up a contiguous
> chunk of RAM to parcel out to RAM regions, that's what the
> indirection through ramaddrs is all about.

I can think of one reason to not do this.  If we just mmap-ed RAM
regions consecutively from a file, the offset in the file should be
aligned to the huge page size for "main" RAM region(s).  For example,
assume gigabyte-sized huge pages; the offset for main RAM must be
gigabyte aligned.  If the board creates 16MiB of VRAM first, and 2 GiB
of main RAM second, you will end up wasting 1024-16 MiB of RAM for VRAM.
 This same waste happened before the introduction of
memory_region_allocate_system_memory, in fact.

Of course this could in principle be fixed by having boards create main
RAM first, but it would be an even more complicated change.  You could
come up with a way of reserving ram_addr_t ranges, which would also help
hotplug; however, I am not sure if all architectures require the maximum
hotplugged memory size to be specified upfront.

Ultimately, if a RAM region other than main RAM has benefits from huge
pages, the device that creates it probably should have a memdev
property.  This is not the case for any current device, except perhaps
ivshmem.

Paolo

  reply	other threads:[~2014-10-17 12:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14  2:36 [Qemu-devel] [PATCH] hw/arm/virt: Replace memory_region_init_ram with memory_region_allocate_system_memory zhuyijun
2014-10-14  4:54 ` Peter Maydell
2014-10-14  5:10   ` Paolo Bonzini
2014-10-14  5:42     ` Peter Maydell
2014-10-14 12:39       ` Paolo Bonzini
2014-10-14 12:48         ` Peter Maydell
2014-10-17 12:05           ` Paolo Bonzini [this message]
2014-10-14  6:04   ` Yijun Zhu
2014-10-14 12:40     ` Paolo Bonzini
2014-10-15  0:40       ` Yijun Zhu

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=5441060D.6080904@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=hangaohuai@huawei.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhuyijun@huawei.com \
    /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).