Commit 21d44be7 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

x86/debug: Simplify hw_breakpoint_handler()

This is called with interrupts disabled, there's no point in using
get_cpu() and per_cpu().
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Link: https://lore.kernel.org/r/20200902133201.292906672@infradead.org
parent b84d42b6
...@@ -487,7 +487,7 @@ EXPORT_SYMBOL_GPL(hw_breakpoint_restore); ...@@ -487,7 +487,7 @@ EXPORT_SYMBOL_GPL(hw_breakpoint_restore);
*/ */
static int hw_breakpoint_handler(struct die_args *args) static int hw_breakpoint_handler(struct die_args *args)
{ {
int i, cpu, rc = NOTIFY_STOP; int i, rc = NOTIFY_STOP;
struct perf_event *bp; struct perf_event *bp;
unsigned long dr6; unsigned long dr6;
unsigned long *dr6_p; unsigned long *dr6_p;
...@@ -505,12 +505,10 @@ static int hw_breakpoint_handler(struct die_args *args) ...@@ -505,12 +505,10 @@ static int hw_breakpoint_handler(struct die_args *args)
return NOTIFY_DONE; return NOTIFY_DONE;
/* /*
* Assert that local interrupts are disabled
* Reset the DRn bits in the virtualized register value. * Reset the DRn bits in the virtualized register value.
* The ptrace trigger routine will add in whatever is needed. * The ptrace trigger routine will add in whatever is needed.
*/ */
current->thread.debugreg6 &= ~DR_TRAP_BITS; current->thread.debugreg6 &= ~DR_TRAP_BITS;
cpu = get_cpu();
/* Handle all the breakpoints that were triggered */ /* Handle all the breakpoints that were triggered */
for (i = 0; i < HBP_NUM; ++i) { for (i = 0; i < HBP_NUM; ++i) {
...@@ -525,7 +523,7 @@ static int hw_breakpoint_handler(struct die_args *args) ...@@ -525,7 +523,7 @@ static int hw_breakpoint_handler(struct die_args *args)
*/ */
rcu_read_lock(); rcu_read_lock();
bp = per_cpu(bp_per_reg[i], cpu); bp = this_cpu_read(bp_per_reg[i]);
/* /*
* Reset the 'i'th TRAP bit in dr6 to denote completion of * Reset the 'i'th TRAP bit in dr6 to denote completion of
* exception handling * exception handling
...@@ -560,8 +558,6 @@ static int hw_breakpoint_handler(struct die_args *args) ...@@ -560,8 +558,6 @@ static int hw_breakpoint_handler(struct die_args *args)
(dr6 & (~DR_TRAP_BITS))) (dr6 & (~DR_TRAP_BITS)))
rc = NOTIFY_DONE; rc = NOTIFY_DONE;
put_cpu();
return rc; return rc;
} }
......
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