Hi Doug, On Tue, Jul 30, 2019 at 03:18:00PM -0700, Douglas Anderson wrote: > diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c > index 43119922341f..b666210fbc75 100644 > --- a/arch/arm64/kernel/kgdb.c > +++ b/arch/arm64/kernel/kgdb.c > @@ -148,6 +148,45 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, > struct task_struct *task) > gdb_regs[32] = cpu_context->pc; > } > > +void kgdb_call_nmi_hook(void *ignored) > +{ > + struct pt_regs *regs; > + > + /* > + * NOTE: get_irq_regs() is supposed to get the registers from > + * before the IPI interrupt happened and so is supposed to > + * show where the processor was. In some situations it's > + * possible we might be called without an IPI, so it might be > + * safer to figure out how to make kgdb_breakpoint() work > + * properly here. > + */ > + regs = get_irq_regs(); > + > + /* > + * Some commands (like 'btc') assume that they can find info about > + * a task in the 'cpu_context'. Unfortunately that's only valid > + * for sleeping tasks. ...but let's make it work anyway by just > + * writing the registers to the right place. This is safe because > + * nobody else is using the 'cpu_context' for a running task. > + */ > + current->thread.cpu_context.x19 = regs->regs[19]; > + current->thread.cpu_context.x20 = regs->regs[20]; > + current->thread.cpu_context.x21 = regs->regs[21]; > + current->thread.cpu_context.x22 = regs->regs[22]; > + current->thread.cpu_context.x23 = regs->regs[23]; > + current->thread.cpu_context.x24 = regs->regs[24]; > + current->thread.cpu_context.x25 = regs->regs[25]; > + current->thread.cpu_context.x26 = regs->regs[26]; > + current->thread.cpu_context.x27 = regs->regs[27]; > + current->thread.cpu_context.x28 = regs->regs[28]; > + current->thread.cpu_context.fp = regs->regs[29]; > + > + current->thread.cpu_context.sp = regs->sp; > + current->thread.cpu_context.pc = regs->pc; > + > + kgdb_nmicallback(raw_smp_processor_id(), regs); > +}
This is really gross... :/ Can you IPI the other CPUs instead and have them backtrace locally, like we do for things like magic sysrq (sysrq_handle_showallcpus())? Will