qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	quintela@redhat.com, lersek@redhat.com, kraxel@redhat.com,
	pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH v4 1/2] arch_init: align MR size to target page size
Date: Mon, 19 Aug 2013 17:26:52 +0300	[thread overview]
Message-ID: <1376922370-5681-2-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1376922370-5681-1-git-send-email-mst@redhat.com>

Migration code assumes that each MR is a multiple of TARGET_PAGE_SIZE:
MR size is divided by TARGET_PAGE_SIZE, so if it isn't migration
never completes.
But this isn't really required for regions set up with
memory_region_init_ram, since that calls qemu_ram_alloc
which aligns size up using TARGET_PAGE_ALIGN.

Align MR size up to full target page sizes, this way
migration completes even if we create a RAM MR
which is not a full target page size.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch_init.c b/arch_init.c
index 68a7ab7..ac8eb59 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -342,7 +342,8 @@ ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr,
 {
     unsigned long base = mr->ram_addr >> TARGET_PAGE_BITS;
     unsigned long nr = base + (start >> TARGET_PAGE_BITS);
-    unsigned long size = base + (int128_get64(mr->size) >> TARGET_PAGE_BITS);
+    uint64_t mr_size = TARGET_PAGE_ALIGN(memory_region_size(mr));
+    unsigned long size = base + (mr_size >> TARGET_PAGE_BITS);
 
     unsigned long next;
 
-- 
MST

  reply	other threads:[~2013-08-19 14:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 14:26 [Qemu-devel] [PATCH v4 0/2] future proof rom loading for cross versiom migration Michael S. Tsirkin
2013-08-19 14:26 ` Michael S. Tsirkin [this message]
2013-08-19 17:37   ` [Qemu-devel] [PATCH v4 1/2] arch_init: align MR size to target page size Laszlo Ersek
2013-08-19 17:45     ` Peter Maydell
2013-08-19 17:51       ` Michael S. Tsirkin
2013-08-19 17:48     ` Michael S. Tsirkin
2013-08-19 18:04       ` Laszlo Ersek
2013-08-19 14:26 ` [Qemu-devel] [PATCH v4 2/2] loader: store FW CFG ROM files in RAM Michael S. Tsirkin
2013-08-19 17:28   ` Paolo Bonzini
2013-08-19 17:40     ` Michael S. Tsirkin
2013-08-19 17:50       ` Paolo Bonzini
2013-08-19 18:05   ` Laszlo Ersek
2013-08-19 16:35 ` [Qemu-devel] [PATCH v4 0/2] future proof rom loading for cross versiom migration 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=1376922370-5681-2-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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).