From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: Juan Quintela <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Stefan Berger <stefanb@linux.ibm.com>
Subject: Re: [PATCH 1/2] RFC: savevm: check RAM is page_size aligned
Date: Fri, 3 Jan 2020 06:06:18 +0100 [thread overview]
Message-ID: <926dcf48-e309-55a5-cfcd-bd1343c17f27@redhat.com> (raw)
In-Reply-To: <20200102210149.926077-2-marcandre.lureau@redhat.com>
Hi Marc-André,
On 1/2/20 10:01 PM, Marc-André Lureau wrote:
> Check the host pointer is correctly aligned, otherwise we may fail
> during migration in ram_block_discard_range().
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> migration/savevm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index a71b930b91..ab6e02011f 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2910,6 +2910,11 @@ err_drain:
>
> void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
> {
> + RAMBlock *rb = mr->ram_block;
> + uintptr_t hostaddr = (uintptr_t)qemu_ram_get_host_addr(rb);
> +
> + assert((hostaddr & (qemu_ram_pagesize(rb) - 1)) == 0);
Can we use the QEMU_PTR_IS_ALIGNED() macro instead?
assert(QEMU_PTR_IS_ALIGNED(qemu_ram_get_host_addr(rb),
qemu_ram_pagesize(rb)));
> qemu_ram_set_idstr(mr->ram_block,
> memory_region_name(mr), dev);
> qemu_ram_set_migratable(mr->ram_block);
>
next prev parent reply other threads:[~2020-01-03 5:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-02 21:01 [PATCH 0/2] tpm: fix PPI RAM migration Marc-André Lureau
2020-01-02 21:01 ` [PATCH 1/2] RFC: savevm: check RAM is page_size aligned Marc-André Lureau
2020-01-03 5:06 ` Philippe Mathieu-Daudé [this message]
2020-01-03 6:39 ` Marc-André Lureau
2020-01-02 21:01 ` [PATCH 2/2] tpm-ppi: page-align PPI RAM Marc-André Lureau
2020-01-03 5:15 ` Philippe Mathieu-Daudé
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=926dcf48-e309-55a5-cfcd-bd1343c17f27@redhat.com \
--to=philmd@redhat.com \
--cc=dgilbert@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanb@linux.ibm.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).