xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Cc: Gianluca Guida <glguida@gmail.com>,
	Jan Beulich <jbeulich@suse.com>,
	xen-devel@lists.xen.org
Subject: [PATCH] Re:  Shadow domains left zombie
Date: Thu, 19 Apr 2012 18:08:40 +0100	[thread overview]
Message-ID: <20120419170840.GD23663@ocelot.phlegethon.org> (raw)
In-Reply-To: <b5856216c6c888126d40e9b32781ee52.squirrel@webmail.lagarcavilla.org>

[-- Attachment #1: Type: text/plain, Size: 667 bytes --]

At 09:19 -0700 on 13 Apr (1334308772), Andres Lagar-Cavilla wrote:
> After a hvm+shadow domain dies (either clean shutdown or merciless
> destroy), the domain is left in a zombie state with 1 (one) page left
> dangling with a single reference.

The reference is to the top-level pagetable that was pointed to by CR3
when the domain was killed.  This bug came in with:

 changeset:   23142:f5e8d152a565
 user:        Jan Beulich <jbeulich@novell.com>
 date:        Tue Apr 05 13:01:25 2011 +0100
 description: x86: split struct vcpu

where HVM domains no longer have vcpu_destroy_pagetables(v) called on
their VCPUs as they die.  Proposed fix attached.

Cheers,

Tim.

[-- Attachment #2: guest-table-ref --]
[-- Type: text/plain, Size: 1083 bytes --]

x86: restore vcpu_destroy_pagetables() call on HVM domain teardown.

HVM vcpus that are using shadow pagetables have valid guest_table fields,
which need to be tidied up on domain teardown.

Signed-off-by: Tim Deegan <tim@xen.org>

diff -r 29e4f8cefc5a -r e67b344afe8e xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Thu Apr 19 15:48:30 2012 +0100
+++ b/xen/arch/x86/domain.c	Thu Apr 19 18:04:29 2012 +0100
@@ -2105,13 +2105,14 @@ int domain_relinquish_resources(struct d
         /* Tear down paging-assistance stuff. */
         paging_teardown(d);
 
+        /* Drop the in-use references to page-table bases. */
+        for_each_vcpu ( d, v )
+            vcpu_destroy_pagetables(v);
+
         if ( !is_hvm_domain(d) )
         {
             for_each_vcpu ( d, v )
             {
-                /* Drop the in-use references to page-table bases. */
-                vcpu_destroy_pagetables(v);
-
                 /*
                  * Relinquish GDT mappings. No need for explicit unmapping of
                  * the LDT as it automatically gets squashed with the guest

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

  parent reply	other threads:[~2012-04-19 17:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 16:19 Shadow domains left zombie Andres Lagar-Cavilla
2012-04-13 17:35 ` Gianluca Guida
2012-04-13 17:38   ` Andres Lagar-Cavilla
2012-04-19 17:08 ` Tim Deegan [this message]
2012-04-19 20:10   ` [PATCH] " Andres Lagar-Cavilla
2012-04-20  7:59   ` Jan Beulich
2012-04-20  8:51     ` Tim Deegan
2012-04-20  9:26   ` Ian Campbell

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=20120419170840.GD23663@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=andres@lagarcavilla.org \
    --cc=glguida@gmail.com \
    --cc=jbeulich@suse.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).