xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
@ 2013-03-28 10:35 Tim Deegan
  2013-04-02 10:09 ` Andrew Cooper
  2013-04-05  8:11 ` Jan Beulich
  0 siblings, 2 replies; 7+ messages in thread
From: Tim Deegan @ 2013-03-28 10:35 UTC (permalink / raw)
  To: xen-devel

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
  2013-03-28 10:35 [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages Tim Deegan
@ 2013-04-02 10:09 ` Andrew Cooper
  2013-04-05  8:11 ` Jan Beulich
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Cooper @ 2013-04-02 10:09 UTC (permalink / raw)
  To: Tim Deegan; +Cc: xen-devel@lists.xen.org

On 28/03/13 10:35, Tim Deegan wrote:
> 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>

Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>

> ---
>  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), 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
  2013-03-28 10:35 [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages Tim Deegan
  2013-04-02 10:09 ` Andrew Cooper
@ 2013-04-05  8:11 ` Jan Beulich
  2013-04-05  8:30   ` Tim Deegan
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2013-04-05  8:11 UTC (permalink / raw)
  To: Tim Deegan; +Cc: xen-devel

>>> On 28.03.13 at 11:35, Tim Deegan <tim@xen.org> wrote:
> 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>

I suppose this ought to go into 4.2.2 and 4.1.5 as well?

Jan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
  2013-04-05  8:11 ` Jan Beulich
@ 2013-04-05  8:30   ` Tim Deegan
  2013-04-05  8:37     ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Deegan @ 2013-04-05  8:30 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

At 09:11 +0100 on 05 Apr (1365153095), Jan Beulich wrote:
> >>> On 28.03.13 at 11:35, Tim Deegan <tim@xen.org> wrote:
> > 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>
> 
> I suppose this ought to go into 4.2.2 and 4.1.5 as well?

Could do -- it's just suppressing a printk, so not a particularly urgent
fix AFAICT.

Tim.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
  2013-04-05  8:30   ` Tim Deegan
@ 2013-04-05  8:37     ` Jan Beulich
  2013-04-05  8:46       ` Tim Deegan
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2013-04-05  8:37 UTC (permalink / raw)
  To: Tim Deegan; +Cc: xen-devel

>>> On 05.04.13 at 10:30, Tim Deegan <tim@xen.org> wrote:
> At 09:11 +0100 on 05 Apr (1365153095), Jan Beulich wrote:
>> >>> On 28.03.13 at 11:35, Tim Deegan <tim@xen.org> wrote:
>> > 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>
>> 
>> I suppose this ought to go into 4.2.2 and 4.1.5 as well?
> 
> Could do -- it's just suppressing a printk, so not a particularly urgent
> fix AFAICT.

But the message, if present when inspecting some random log,
looks worrying, so getting rid of the false positive is likely going
to help assessing the health of systems/guests.

Jan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
  2013-04-05  8:37     ` Jan Beulich
@ 2013-04-05  8:46       ` Tim Deegan
  2013-04-05 10:40         ` Andrew Cooper
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Deegan @ 2013-04-05  8:46 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

At 09:37 +0100 on 05 Apr (1365154638), Jan Beulich wrote:
> >>> On 05.04.13 at 10:30, Tim Deegan <tim@xen.org> wrote:
> > At 09:11 +0100 on 05 Apr (1365153095), Jan Beulich wrote:
> >> >>> On 28.03.13 at 11:35, Tim Deegan <tim@xen.org> wrote:
> >> > 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>
> >> 
> >> I suppose this ought to go into 4.2.2 and 4.1.5 as well?
> > 
> > Could do -- it's just suppressing a printk, so not a particularly urgent
> > fix AFAICT.
> 
> But the message, if present when inspecting some random log,
> looks worrying, so getting rid of the false positive is likely going
> to help assessing the health of systems/guests.

Sure.  In any case the patch is harmless, so there should be no risk to
putting it in.

Tim.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages.
  2013-04-05  8:46       ` Tim Deegan
@ 2013-04-05 10:40         ` Andrew Cooper
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cooper @ 2013-04-05 10:40 UTC (permalink / raw)
  To: Tim Deegan; +Cc: Jan Beulich, xen-devel@lists.xen.org

On 05/04/13 09:46, Tim Deegan wrote:
> At 09:37 +0100 on 05 Apr (1365154638), Jan Beulich wrote:
>>>>> On 05.04.13 at 10:30, Tim Deegan <tim@xen.org> wrote:
>>> At 09:11 +0100 on 05 Apr (1365153095), Jan Beulich wrote:
>>>>>>> On 28.03.13 at 11:35, Tim Deegan <tim@xen.org> wrote:
>>>>> 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>
>>>> I suppose this ought to go into 4.2.2 and 4.1.5 as well?
>>> Could do -- it's just suppressing a printk, so not a particularly urgent
>>> fix AFAICT.
>> But the message, if present when inspecting some random log,
>> looks worrying, so getting rid of the false positive is likely going
>> to help assessing the health of systems/guests.
> Sure.  In any case the patch is harmless, so there should be no risk to
> putting it in.
>
> Tim.

The reason I started debugging it was because it is an scary message for
what turns out to be a safe action.

So please backport :)

~Andrew

>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-05 10:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 10:35 [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages Tim Deegan
2013-04-02 10:09 ` 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

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).