xen/dump-exec-state.patch

99 lines
3.7 KiB
Diff
Raw Normal View History

Index: xen-3.3.1-testing/xen/arch/ia64/linux-xen/smp.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/ia64/linux-xen/smp.c
+++ xen-3.3.1-testing/xen/arch/ia64/linux-xen/smp.c
@@ -175,7 +175,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-3.3.1-testing/xen/arch/x86/smp.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/smp.c
+++ xen-3.3.1-testing/xen/arch/x86/smp.c
@@ -356,7 +356,7 @@ fastcall void smp_call_function_interrup
if ( call_data->wait )
{
- (*func)(info);
+ (*func)(info ?: regs);
mb();
atomic_inc(&call_data->finished);
}
@@ -364,7 +364,7 @@ fastcall void smp_call_function_interrup
{
mb();
atomic_inc(&call_data->started);
- (*func)(info);
+ (*func)(info ?: regs);
}
irq_exit();
Index: xen-3.3.1-testing/xen/common/keyhandler.c
===================================================================
--- xen-3.3.1-testing.orig/xen/common/keyhandler.c
+++ xen-3.3.1-testing/xen/common/keyhandler.c
@@ -91,14 +91,25 @@ static void show_handlers(unsigned char
key_table[i].desc);
}
-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)
@@ -111,14 +122,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(cpu), __dump_execstate, NULL, 1, 1);
}
Index: xen-3.3.1-testing/xen/include/asm-ia64/linux-xen/asm/ptrace.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-ia64/linux-xen/asm/ptrace.h
+++ xen-3.3.1-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) \