xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Alex Bligh <alex@alex.org.uk>
To: xen-devel <xen-devel@lists.xen.org>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	Alex Bligh <alex@alex.org.uk>
Subject: [PATCH 5/5] xen: Set the vram dirty when an error occur.
Date: Wed, 13 Feb 2013 18:33:45 +0000	[thread overview]
Message-ID: <1360780425-19607-6-git-send-email-alex@alex.org.uk> (raw)
In-Reply-To: <1360780425-19607-1-git-send-email-alex@alex.org.uk>

If the call to xc_hvm_track_dirty_vram() fails, then we set dirtybit on all the
video ram. This case happens during migration.

Backport of 8aba7dc02d5660df7e7d8651304b3079908358be

Signed-off-by: Alex Bligh <alex@alex.org.uk>
---
 xen-all.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/xen-all.c b/xen-all.c
index 121289d..dbd759c 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -470,7 +470,21 @@ static int xen_sync_dirty_bitmap(XenIOState *state,
     rc = xc_hvm_track_dirty_vram(xen_xc, xen_domid,
                                  start_addr >> TARGET_PAGE_BITS, npages,
                                  bitmap);
-    if (rc) {
+    if (rc < 0) {
+        if (rc != -ENODATA) {
+            ram_addr_t addr, end;
+
+            xen_modified_memory(start_addr, size);
+            
+            end = TARGET_PAGE_ALIGN(start_addr + size);
+            for (addr = start_addr & TARGET_PAGE_MASK; addr < end; addr += TARGET_PAGE_SIZE) {
+                cpu_physical_memory_set_dirty(addr);
+            }
+
+            DPRINTF("xen: track_dirty_vram failed (0x" TARGET_FMT_plx
+                    ", 0x" TARGET_FMT_plx "): %s\n",
+                    start_addr, start_addr + size, strerror(-rc));
+        }
         return rc;
     }
 
@@ -479,7 +493,9 @@ static int xen_sync_dirty_bitmap(XenIOState *state,
         while (map != 0) {
             j = ffsl(map) - 1;
             map &= ~(1ul << j);
-            cpu_physical_memory_set_dirty(vram_offset + (i * width + j) * TARGET_PAGE_SIZE);
+            target_phys_addr_t todirty = vram_offset + (i * width + j) * TARGET_PAGE_SIZE;
+            xen_modified_memory(todirty, TARGET_PAGE_SIZE);
+            cpu_physical_memory_set_dirty(todirty);
         };
     }
 
-- 
1.7.4.1

  parent reply	other threads:[~2013-02-13 18:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 18:33 QEMU: Enabling live-migrate on HVM on qemu-xen device model in 4.2 Alex Bligh
2013-02-13 18:33 ` [PATCH 1/5] QMP, Introduce xen-set-global-dirty-log command Alex Bligh
2013-02-13 18:33 ` [PATCH 2/5] xen: Introduce xen_modified_memory Alex Bligh
2013-02-13 18:33 ` [PATCH 3/5] exec: Introduce helper to set dirty flags Alex Bligh
2013-02-13 18:33 ` [PATCH 4/5] exec, memory: Call to xen_modified_memory Alex Bligh
2013-02-13 18:33 ` Alex Bligh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-01-19 17:56 QEMU: Enabling live-migrate on HVM on qemu-xen device model in 4.2 Alex Bligh
2013-01-19 17:56 ` [PATCH 5/5] xen: Set the vram dirty when an error occur Alex Bligh
2012-12-21 19:37 [RFC] QEMU: Enabling live-migrate on HVM on qemu-xen device model in 4.2 Alex Bligh
2012-12-21 19:37 ` [PATCH 5/5] xen: Set the vram dirty when an error occur Alex Bligh

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=1360780425-19607-6-git-send-email-alex@alex.org.uk \
    --to=alex@alex.org.uk \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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).