xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH 3/3] DO NOT APPLY - debugging code for gpf when accessing invalid per_cpu() data
Date: Thu, 26 Sep 2013 10:49:26 +0100	[thread overview]
Message-ID: <1380188966-26665-4-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1380188966-26665-1-git-send-email-andrew.cooper3@citrix.com>

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

  parent reply	other threads:[~2013-09-26  9:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26  9:49 [PATCH 0/3] per_cpu() fixes Andrew Cooper
2013-09-26  9:49 ` [PATCH 1/3] x86/idle: Fix get_cpu_idle_time()'s interaction with offline pcpus Andrew Cooper
2013-09-26  9:49 ` [PATCH 2/3] x86/percpu: Force INVALID_PERCPU_AREA into the non-canonical address region Andrew Cooper
2013-09-26 10:04   ` Andrew Cooper
2013-09-26  9:49 ` Andrew Cooper [this message]
2013-10-03 17:55 ` [PATCH 0/3] per_cpu() fixes Andrew Cooper
2013-10-03 19:52   ` Keir Fraser

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=1380188966-26665-4-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.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).