[Xen-devel] xen: arm: increase priority of SGIs used as IPIs

Message ID 1390927915.31814.9.camel@kazak.uk.xensource.com
State New
Headers show

Commit Message

Ian Campbell Jan. 28, 2014, 4:51 p.m.
On Tue, 2014-01-28 at 16:51 +0000, Ian Campbell wrote:
> Tested with "HACK: dump pcpu state keyhandler" which I'll post for
> completeness. 

From 7975fb2a9a27e738d3b551fa2258d65a8c4b0d9a Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Tue, 28 Jan 2014 15:57:33 +0000
Subject: [PATCH] HACK: dump pcpu state keyhandler

---
 xen/arch/arm/gic.c        |    3 +++
 xen/common/keyhandler.c   |   20 ++++++++++++++++++++
 xen/include/asm-arm/gic.h |    1 +
 3 files changed, 24 insertions(+)

Patch

diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index e6257a7..dcf9cd4 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -811,6 +811,9 @@  static void do_sgi(struct cpu_user_regs *regs, int othercpu, enum gic_sgi sgi)
     case GIC_SGI_CALL_FUNCTION:
         smp_call_function_interrupt();
         break;
+    case GIC_SGI_DUMP_HOST_STATE:
+        show_execution_state(regs);
+        break;
     default:
         panic("Unhandled SGI %d on CPU%d", sgi, smp_processor_id());
         break;
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 8e4b3f8..52f0916 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -20,6 +20,7 @@ 
 #include <xen/init.h>
 #include <asm/debugger.h>
 #include <asm/div64.h>
+#include <asm/gic.h>
 
 static struct keyhandler *key_table[256];
 static unsigned char keypress_key;
@@ -149,6 +150,24 @@  static struct keyhandler dump_registers_keyhandler = {
     .desc = "dump registers"
 };
 
+static void dump_pcpus(unsigned char key, struct cpu_user_regs *regs)
+{
+    printk("'%c' pressed -> dumping PCPU state\n\n", key);
+
+    send_SGI_self(GIC_SGI_DUMP_HOST_STATE);
+
+    dsb(); /* Wait for SGI write to occur, or else it might be delayed
+            * until later, meaning we don't make a point of having an
+            * IPI interrupting an interrupt. */
+}
+
+static struct keyhandler dump_pcpus_keyhandler = {
+    .irq_callback = 1,
+    .diagnostic = 1,
+    .u.irq_fn = dump_pcpus,
+    .desc = "dump pcpus"
+};
+
 static DECLARE_TASKLET(dump_dom0_tasklet, NULL, 0);
 
 static void dump_dom0_action(unsigned long arg)
@@ -539,6 +558,7 @@  void __init initialize_keytable(void)
     }
     register_keyhandler('A', &toggle_alt_keyhandler);
     register_keyhandler('d', &dump_registers_keyhandler);
+    register_keyhandler('P', &dump_pcpus_keyhandler);
     register_keyhandler('h', &show_handlers_keyhandler);
     register_keyhandler('q', &dump_domains_keyhandler);
     register_keyhandler('r', &dump_runq_keyhandler);
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 87f4298..9c6f9bb 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -183,6 +183,7 @@  enum gic_sgi {
     GIC_SGI_EVENT_CHECK = 0,
     GIC_SGI_DUMP_STATE  = 1,
     GIC_SGI_CALL_FUNCTION = 2,
+    GIC_SGI_DUMP_HOST_STATE  = 3,
 };
 extern void send_SGI_mask(const cpumask_t *cpumask, enum gic_sgi sgi);
 extern void send_SGI_one(unsigned int cpu, enum gic_sgi sgi);