xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: xen-devel@lists.xen.org
Subject: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
Date: Thu, 28 Mar 2013 10:35:50 +0000	[thread overview]
Message-ID: <1364466950-15682-1-git-send-email-tim@xen.org> (raw)

Xenheap pages will always have an extra typecount, taken in
share_xen_page_with_guest(), which doesn't come from a shadow PTE.
Adjust the warning in sh_remove_all_mappings() to account for it.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Tim Deegan <tim@xen.org>
---
 xen/arch/x86/mm/shadow/common.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 4b576ac..adffa06 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2437,10 +2437,13 @@ int sh_remove_all_mappings(struct vcpu *v, mfn_t gmfn)
     {
         /* Don't complain if we're in HVM and there are some extra mappings: 
          * The qemu helper process has an untyped mapping of this dom's RAM 
-         * and the HVM restore program takes another. */
+         * and the HVM restore program takes another.
+         * Also allow one typed refcount for xenheap pages, to match
+         * share_xen_page_with_guest(). */
         if ( !(shadow_mode_external(v->domain)
                && (page->count_info & PGC_count_mask) <= 3
-               && (page->u.inuse.type_info & PGT_count_mask) == 0) )
+               && ((page->u.inuse.type_info & PGT_count_mask)
+                   == !!is_xen_heap_page(page))) )
         {
             SHADOW_ERROR("can't find all mappings of mfn %lx: "
                           "c=%08lx t=%08lx\n", mfn_x(gmfn), 
-- 
1.7.10.4

             reply	other threads:[~2013-03-28 10:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 10:35 Tim Deegan [this message]
2013-04-02 10:09 ` [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages Andrew Cooper
2013-04-05  8:11 ` Jan Beulich
2013-04-05  8:30   ` Tim Deegan
2013-04-05  8:37     ` Jan Beulich
2013-04-05  8:46       ` Tim Deegan
2013-04-05 10:40         ` Andrew Cooper

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=1364466950-15682-1-git-send-email-tim@xen.org \
    --to=tim@xen.org \
    --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).