WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XEN] Console keystroke to reset shadows.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Console keystroke to reset shadows.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 09 Nov 2006 18:40:23 +0000
Delivery-date: Thu, 09 Nov 2006 10:41:30 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Node ID a5153d9c8c9f7a8cbd6f51f4cce2c2ecc1a0c498
# Parent  ddc4bc24f07c9cf833b2099e79f5e23c49822ed9
[XEN] Console keystroke to reset shadows.
In debug builds, adds a keyhandler that blows away all shadows, to
force them to be rebuilt.
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/common.c |   50 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+)

diff -r ddc4bc24f07c -r a5153d9c8c9f xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Thu Nov 09 15:38:15 2006 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Thu Nov 09 16:05:23 2006 +0000
@@ -635,6 +635,56 @@ void shadow_prealloc(struct domain *d, u
     BUG();
 }
 
+#ifndef NDEBUG
+/* Deliberately free all the memory we can: this can be used to cause the
+ * guest's pagetables to be re-shadowed if we suspect that the shadows
+ * have somehow got out of sync */
+static void shadow_blow_tables(unsigned char c)
+{
+    struct list_head *l, *t;
+    struct page_info *pg;
+    struct domain *d;
+    struct vcpu *v;
+    mfn_t smfn;
+
+    for_each_domain(d)
+    {
+        if ( shadow_mode_enabled(d) && (v = d->vcpu[0]) != NULL)
+        {
+            shadow_lock(d);
+            printk("Blowing shadow tables for domain %u\n", d->domain_id);
+
+            /* Pass one: unpin all top-level pages */
+            list_for_each_backwards_safe(l,t, &d->arch.shadow.toplevel_shadows)
+            {
+                pg = list_entry(l, struct page_info, list);
+                smfn = page_to_mfn(pg);
+                sh_unpin(v, smfn);
+            }
+
+            /* Second pass: unhook entries of in-use shadows */
+            list_for_each_backwards_safe(l,t, &d->arch.shadow.toplevel_shadows)
+            {
+                pg = list_entry(l, struct page_info, list);
+                smfn = page_to_mfn(pg);
+                shadow_unhook_mappings(v, smfn);
+            }
+            
+            /* Make sure everyone sees the unshadowings */
+            flush_tlb_mask(d->domain_dirty_cpumask);
+            shadow_unlock(d);
+        }
+    }
+}
+
+/* Register this function in the Xen console keypress table */
+static __init int shadow_blow_tables_keyhandler_init(void)
+{
+    register_keyhandler('S', shadow_blow_tables, "reset shadow pagetables");
+    return 0;
+}
+__initcall(shadow_blow_tables_keyhandler_init);
+#endif /* !NDEBUG */
 
 /* Allocate another shadow's worth of (contiguous, aligned) pages,
  * and fill in the type and backpointer fields of their page_infos. 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] Console keystroke to reset shadows., Xen patchbot-unstable <=