xen/dump-exec-state.patch

99 lines
3.7 KiB
Diff

Index: xen-4.0.0-testing/xen/arch/ia64/linux-xen/smp.c
===================================================================
--- xen-4.0.0-testing.orig/xen/arch/ia64/linux-xen/smp.c
+++ xen-4.0.0-testing/xen/arch/ia64/linux-xen/smp.c
@@ -189,7 +189,7 @@ handle_IPI (int irq, void *dev_id, struc
* At this point the structure may be gone unless
* wait is true.
*/
- (*func)(info);
+ (*func)(info ?: regs);
/* Notify the sending CPU that the task is done. */
mb();
Index: xen-4.0.0-testing/xen/arch/x86/smp.c
===================================================================
--- xen-4.0.0-testing.orig/xen/arch/x86/smp.c
+++ xen-4.0.0-testing/xen/arch/x86/smp.c
@@ -394,7 +394,7 @@ static void __smp_call_function_interrup
if ( call_data.wait )
{
- (*func)(info);
+ (*func)(info ?: get_irq_regs());
mb();
atomic_inc(&call_data.finished);
}
@@ -402,7 +402,7 @@ static void __smp_call_function_interrup
{
mb();
atomic_inc(&call_data.started);
- (*func)(info);
+ (*func)(info ?: get_irq_regs());
}
irq_exit();
Index: xen-4.0.0-testing/xen/common/keyhandler.c
===================================================================
--- xen-4.0.0-testing.orig/xen/common/keyhandler.c
+++ xen-4.0.0-testing/xen/common/keyhandler.c
@@ -71,14 +71,25 @@ static struct keyhandler show_handlers_k
.desc = "show this message"
};
-static void __dump_execstate(void *unused)
+static void __dump_execstate(void *_regs)
{
- dump_execution_state();
- printk("*** Dumping CPU%d guest state: ***\n", smp_processor_id());
+ struct cpu_user_regs *regs = _regs;
+ unsigned int cpu = smp_processor_id();
+
+ if ( !guest_mode(regs) )
+ {
+ printk("\n*** Dumping CPU%u host state: ***\n", cpu);
+ show_execution_state(regs);
+ }
if ( is_idle_vcpu(current) )
- printk("No guest context (CPU is idle).\n");
+ printk("No guest context (CPU%u is idle).\n", cpu);
else
+ {
+ printk("*** Dumping CPU%u guest state (d%d:v%d): ***\n",
+ smp_processor_id(), current->domain->domain_id,
+ current->vcpu_id);
show_execution_state(guest_cpu_user_regs());
+ }
}
static void dump_registers(unsigned char key, struct cpu_user_regs *regs)
@@ -92,14 +103,12 @@ static void dump_registers(unsigned char
printk("'%c' pressed -> dumping registers\n", key);
/* Get local execution state out immediately, in case we get stuck. */
- printk("\n*** Dumping CPU%d host state: ***\n", smp_processor_id());
- __dump_execstate(NULL);
+ __dump_execstate(regs);
for_each_online_cpu ( cpu )
{
if ( cpu == smp_processor_id() )
continue;
- printk("\n*** Dumping CPU%d host state: ***\n", cpu);
on_selected_cpus(cpumask_of(cpu), __dump_execstate, NULL, 1);
}
Index: xen-4.0.0-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h
===================================================================
--- xen-4.0.0-testing.orig/xen/include/asm-ia64/linux-xen/asm/ptrace.h
+++ xen-4.0.0-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h
@@ -278,7 +278,7 @@ struct switch_stack {
# define ia64_task_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
# define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr)
#ifdef XEN
-# define guest_mode(regs) (ia64_psr(regs)->cpl != 0)
+# define guest_mode(regs) (ia64_psr(regs)->cpl && !ia64_psr(regs)->vm)
# define guest_kernel_mode(regs) (ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL)
# define vmx_guest_kernel_mode(regs) (ia64_psr(regs)->cpl == 0)
# define regs_increment_iip(regs) \