Commit 5959f5c2 authored by Philippe Gerum's avatar Philippe Gerum

arm64: ipipe: track IRQ state consistently upon BRK event

Two related issues to address:

1. Only after do_debug_exception() has told the irqsoff tracer about
the IRQ state on entry to the handler should we invoke
__ipipe_report_trap(), since the latter may have to switch the caller
to the root domain, unstalling it in the same move, which will
certainly affect the interrupt state.

2. the debug monitor handler should be called once the hardware and
virtual IRQ states are reconciled. To this end, enclose such call
inside the fault_entry/fault_exit section.
parent 0e5059bb
......@@ -973,9 +973,6 @@ asmlinkage int __exception do_debug_exception(unsigned long addr_if_watchpoint,
if (cortex_a76_erratum_1463225_debug_handler(regs))
return 0;
if (__ipipe_report_trap(IPIPE_TRAP_BREAK, regs))
return 1;
/*
* Tell lockdep we disabled irqs in entry.S. Do nothing if they were
* already disabled to preserve the last enabled/disabled addresses.
......@@ -986,25 +983,33 @@ asmlinkage int __exception do_debug_exception(unsigned long addr_if_watchpoint,
if (user_mode(regs) && pc > TASK_SIZE)
arm64_apply_bp_hardening();
if (__ipipe_report_trap(IPIPE_TRAP_BREAK, regs))
return 1;
irqflags = fault_entry(regs);
if (!inf->fn(addr_if_watchpoint, esr, regs)) {
rv = 1;
} else {
struct siginfo info;
irqflags = fault_entry(regs);
clear_siginfo(&info);
info.si_signo = inf->sig;
info.si_errno = 0;
info.si_code = inf->code;
info.si_addr = (void __user *)pc;
arm64_notify_die(inf->name, regs, &info, esr);
fault_exit(irqflags);
rv = 0;
}
if (interrupts_enabled(regs))
trace_hardirqs_on();
fault_exit(irqflags);
if (interrupts_enabled(regs)) {
if (IS_ENABLED(CONFIG_IPIPE))
local_irq_enable();
else
trace_hardirqs_on();
}
return rv;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment