qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jason J. Herne" <jjherne@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [Qemu-devel] Bug-fix: Align cpu_physical_memory_set_dirty_flags() addr to page boundary
Date: Thu, 08 Nov 2012 15:58:12 -0500	[thread overview]
Message-ID: <509C1CE4.1060305@linux.vnet.ibm.com> (raw)

As part of some Qemu Migration related development work I'm doing I 
stumbled upon what appears to be a bug (patch to follow in separate 
email).

exec-obsolete.h : cpu_physical_memory_set_dirty_flags() seems to assume 
the caller provided a page boundary aligned address.

Some code paths call cpu_physical_memory_set_dirty_flags() with an 
address that is not on a page boundary. The subsequent call to 
cpu_physical_memory_get_dirty is assuming page boundary alignment 
because it hard codes a length of TARGET_PAGE_SIZE.  This causes 
problems when the target address lies within a page whose "migration 
dirty bit" is NOT set, but the following page's "migration dirty bit" is 
set.  In this case, cpu_physical_memory_get_dirty will claim that the 
page is already dirty when it is not. 
cpu_physical_memory_set_dirty_flags then skips incrementing 
ram_list.dirty_pages but still updates the target page's dirty bit with 
the following code: ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= 
dirty_flags; This causes the counter (ram_list.dirty_pages) to be less 
than the actual number of dirty bits. This can cause our migration 
remaining ram counter to underflow and can even hang migration in some 
cases.

In my development/test environment (non-x86 platform) I am experiencing 
this problem fairly frequently.  I'm wondering if anyone knows if 
cpu_physical_memory_set_dirty_flags() should be performing a page 
boundary alignment on the target address or if there is some reason this 
is a bad idea?

-- 
-- Jason J. Herne (jjherne@linux.vnet.ibm.com)

                 reply	other threads:[~2012-11-08 20:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=509C1CE4.1060305@linux.vnet.ibm.com \
    --to=jjherne@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=qemu-devel@nongnu.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).