From: Beata Michalska <beata.michalska@linaro.org>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
qemu-devel@nongnu.org,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH] Memory: Only call ramblock_ptr when needed in qemu_ram_writeback
Date: Thu, 19 Dec 2019 17:31:25 +0000 [thread overview]
Message-ID: <CADSWDzs3sAec4iY3pCOUCexBZtRDG6jG_ecmccf77wP+xShhTg@mail.gmail.com> (raw)
In-Reply-To: <20191219154323.325255-1-anthony.perard@citrix.com>
Hi Anthony,
On Thu, 19 Dec 2019 at 15:43, Anthony PERARD <anthony.perard@citrix.com> wrote:
>
> It is possible that a ramblock doesn't have memory that QEMU can
> access, this is the case with the Xen hypervisor.
>
> In order to avoid to trigger an assert, only call ramblock_ptr() when
> needed in qemu_ram_writeback(). This should fix migration of Xen
> guests that was broken with bd108a44bc29 ("migration: ram: Switch to
> ram block writeback").
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> exec.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index a34c34818404..b11010e0cb4c 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2166,14 +2166,13 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
> */
> void qemu_ram_writeback(RAMBlock *block, ram_addr_t start, ram_addr_t length)
> {
> - void *addr = ramblock_ptr(block, start);
> -
> /* The requested range should fit in within the block range */
> g_assert((start + length) <= block->used_length);
>
> #ifdef CONFIG_LIBPMEM
> /* The lack of support for pmem should not block the sync */
> if (ramblock_is_pmem(block)) {
> + void *addr = ramblock_ptr(block, start);
> pmem_persist(addr, length);
> return;
> }
> @@ -2184,6 +2183,7 @@ void qemu_ram_writeback(RAMBlock *block, ram_addr_t start, ram_addr_t length)
> * specified as persistent (or is not one) - use the msync.
> * Less optimal but still achieves the same goal
> */
> + void *addr = ramblock_ptr(block, start);
> if (qemu_msync(addr, length, block->fd)) {
> warn_report("%s: failed to sync memory range: start: "
> RAM_ADDR_FMT " length: " RAM_ADDR_FMT,
We could also do :
void *addr = block->host ? ramblock_ptr : NULL
Looks good to me thought.
Thanks for fixing.
BR
Beata
> --
> Anthony PERARD
>
next prev parent reply other threads:[~2019-12-19 17:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-19 15:42 Recent change pmem related breaks Xen migration Anthony PERARD
2019-12-19 15:43 ` [PATCH] Memory: Only call ramblock_ptr when needed in qemu_ram_writeback Anthony PERARD
2019-12-19 17:31 ` Beata Michalska [this message]
2019-12-19 18:10 ` Juan Quintela
2020-02-25 16:02 ` Anthony PERARD
2020-02-25 16:51 ` Paolo Bonzini
2019-12-19 17:40 ` Recent change pmem related breaks Xen migration Beata Michalska
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=CADSWDzs3sAec4iY3pCOUCexBZtRDG6jG_ecmccf77wP+xShhTg@mail.gmail.com \
--to=beata.michalska@linaro.org \
--cc=anthony.perard@citrix.com \
--cc=dgilbert@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--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).