From: Anthony PERARD <anthony.perard@citrix.com> To: <qemu-devel@nongnu.org> Cc: Peter Maydell <peter.maydell@linaro.org>, xen-devel@lists.xenproject.org Subject: [PULL 3/3] Memory: Only call ramblock_ptr when needed in qemu_ram_writeback Date: Thu, 27 Feb 2020 12:16:45 +0000 [thread overview] Message-ID: <20200227121645.2601280-4-anthony.perard@citrix.com> (raw) In-Reply-To: <20200227121645.2601280-1-anthony.perard@citrix.com> 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> Reviewed-by: Juan Quintela <quintela@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20191219154323.325255-1-anthony.perard@citrix.com> --- exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 231d6e564109..0cc500d53a23 100644 --- a/exec.c +++ b/exec.c @@ -2116,14 +2116,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; } @@ -2134,6 +2133,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, -- Anthony PERARD
WARNING: multiple messages have this Message-ID (diff)
From: Anthony PERARD <anthony.perard@citrix.com> To: <qemu-devel@nongnu.org> Cc: Peter Maydell <peter.maydell@linaro.org>, xen-devel@lists.xenproject.org Subject: [Xen-devel] [PULL 3/3] Memory: Only call ramblock_ptr when needed in qemu_ram_writeback Date: Thu, 27 Feb 2020 12:16:45 +0000 [thread overview] Message-ID: <20200227121645.2601280-4-anthony.perard@citrix.com> (raw) In-Reply-To: <20200227121645.2601280-1-anthony.perard@citrix.com> 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> Reviewed-by: Juan Quintela <quintela@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20191219154323.325255-1-anthony.perard@citrix.com> --- exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exec.c b/exec.c index 231d6e564109..0cc500d53a23 100644 --- a/exec.c +++ b/exec.c @@ -2116,14 +2116,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; } @@ -2134,6 +2133,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, -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-02-27 12:18 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-27 12:16 [PULL 0/3] Xen queue 2020-02-27 Anthony PERARD 2020-02-27 12:16 ` [Xen-devel] " Anthony PERARD 2020-02-27 12:16 ` [PULL 1/3] hw/xen/xen_pt_load_rom: Remove unused includes Anthony PERARD 2020-02-27 12:16 ` [Xen-devel] " Anthony PERARD 2020-02-27 12:16 ` [PULL 2/3] xen-bus/block: explicitly assign event channels to an AioContext Anthony PERARD 2020-02-27 12:16 ` [Xen-devel] " Anthony PERARD 2020-02-27 12:16 ` Anthony PERARD [this message] 2020-02-27 12:16 ` [Xen-devel] [PULL 3/3] Memory: Only call ramblock_ptr when needed in qemu_ram_writeback Anthony PERARD 2020-02-28 11:19 ` [PULL 0/3] Xen queue 2020-02-27 Peter Maydell 2020-02-28 11:19 ` [Xen-devel] " Peter Maydell
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=20200227121645.2601280-4-anthony.perard@citrix.com \ --to=anthony.perard@citrix.com \ --cc=peter.maydell@linaro.org \ --cc=qemu-devel@nongnu.org \ --cc=xen-devel@lists.xenproject.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: linkBe 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.