[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/3] DO NOT APPLY - debugging code for gpf when accessing invalid per_cpu() data



---
 xen/common/schedule.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 1ddfb22..8b17555 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -36,6 +36,7 @@
 #include <xen/preempt.h>
 #include <public/sched.h>
 #include <xsm/xsm.h>
+#include <xen/keyhandler.h>
 
 /* opt_sched: scheduler - default to credit */
 static char __initdata opt_sched[10] = "credit";
@@ -1529,6 +1530,30 @@ void wait(void)
 #include "compat/schedule.c"
 #endif
 
+static void percpu_gpf(unsigned char key)
+{
+    unsigned int cpu = NR_CPUS - 1;
+    printk("'%c' pressed -> Looking up schedule lock for cpu %d\n", key, cpu);
+
+    if ( spin_is_locked(per_cpu(schedule_data, cpu).schedule_lock) )
+        printk("It is locked\n");
+    else
+        printk("It is unlocked\n");
+}
+
+static struct keyhandler percpu_gpf_keyhandler = {
+    .diagnostic = 1,
+    .u.fn = percpu_gpf,
+    .desc = "per-cpu gpf test"
+};
+
+static int __init percpu_gpf_key_init(void)
+{
+    register_keyhandler('1', &percpu_gpf_keyhandler);
+    return 0;
+}
+__initcall(percpu_gpf_key_init);
+
 #endif /* !COMPAT */
 
 /*
-- 
1.7.10.4


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.