qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Igor Mitsyanko <i.mitsyanko@gmail.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org,
	anthony@codemonkey.ws, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 3/3] memory_region_init_ram_ptr: only allow n*TARGET_PAGE_SIZE memory sizes
Date: Sun, 10 Mar 2013 22:27:31 +0800	[thread overview]
Message-ID: <CAFEAcA_8sw4EoX6+f+C-RxzASVmSQtPwcASE1iOEnPJ+9D1F0Q@mail.gmail.com> (raw)
In-Reply-To: <1362925309-3852-4-git-send-email-i.mitsyanko@gmail.com>

On 10 March 2013 22:21, Igor Mitsyanko <i.mitsyanko@gmail.com> wrote:
> Registering memory regions using preallocated memory which size is not a multiple of
> target page size will result in inconsistency in QEMU memory system. Do not
> allow to do that at all by checking for that case (and asserting) in
> memory_region_init_ram_ptr().

This is too vague. What exactly is the problem and why can't we
just fix the memory system to correctly handle being passed
small preallocated memory areas?

> --- a/memory.c
> +++ b/memory.c
> @@ -949,6 +949,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
>                                  uint64_t size,
>                                  void *ptr)
>  {
> +    assert((size & (TARGET_PAGE_SIZE - 1)) == 0);

This in particular seems like a bad idea, because TARGET_PAGE_SIZE
is a per-CPU thing, and we shouldn't be adding more code to QEMU which
will need to be fixed if/when we ever support multiple CPU types in
a single binary. (Also TARGET_PAGE_SIZE isn't necessarily what you
think it is: for instance on ARM it's actually only 1K even though
the standard ARM setup is 4K pages.)

thanks
-- PMM

  reply	other threads:[~2013-03-10 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 14:21 [Qemu-devel] [PATCH 0/3] Fix memory migration for exynos 4210 SoC Igor Mitsyanko
2013-03-10 14:21 ` [Qemu-devel] [PATCH 1/3] hw/exynos4210.c: set chipid_and_omr array size to TARGET_PAGE_SIZE Igor Mitsyanko
2013-03-10 14:21 ` [Qemu-devel] [PATCH 2/3] exynos4210.c: register chipid_mem and rom_mem with vmstate Igor Mitsyanko
2013-03-10 14:21 ` [Qemu-devel] [PATCH 3/3] memory_region_init_ram_ptr: only allow n*TARGET_PAGE_SIZE memory sizes Igor Mitsyanko
2013-03-10 14:27   ` Peter Maydell [this message]
2013-03-10 18:39     ` Igor Mitsyanko
2013-05-07 13:09 ` [Qemu-devel] [PATCH 0/3] Fix memory migration for exynos 4210 SoC Peter Maydell
2013-05-07 13:14   ` Paolo Bonzini

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=CAFEAcA_8sw4EoX6+f+C-RxzASVmSQtPwcASE1iOEnPJ+9D1F0Q@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=i.mitsyanko@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@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 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).