Skip to content

Commit 21d44be

Browse files
Peter ZijlstraKAGA-KOKO
authored andcommitted
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: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Daniel Thompson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b84d42b commit 21d44be

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arch/x86/kernel/hw_breakpoint.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ EXPORT_SYMBOL_GPL(hw_breakpoint_restore);
487487
*/
488488
static int hw_breakpoint_handler(struct die_args *args)
489489
{
490-
int i, cpu, rc = NOTIFY_STOP;
490+
int i, rc = NOTIFY_STOP;
491491
struct perf_event *bp;
492492
unsigned long dr6;
493493
unsigned long *dr6_p;
@@ -505,12 +505,10 @@ static int hw_breakpoint_handler(struct die_args *args)
505505
return NOTIFY_DONE;
506506

507507
/*
508-
* Assert that local interrupts are disabled
509508
* Reset the DRn bits in the virtualized register value.
510509
* The ptrace trigger routine will add in whatever is needed.
511510
*/
512511
current->thread.debugreg6 &= ~DR_TRAP_BITS;
513-
cpu = get_cpu();
514512

515513
/* Handle all the breakpoints that were triggered */
516514
for (i = 0; i < HBP_NUM; ++i) {
@@ -525,7 +523,7 @@ static int hw_breakpoint_handler(struct die_args *args)
525523
*/
526524
rcu_read_lock();
527525

528-
bp = per_cpu(bp_per_reg[i], cpu);
526+
bp = this_cpu_read(bp_per_reg[i]);
529527
/*
530528
* Reset the 'i'th TRAP bit in dr6 to denote completion of
531529
* exception handling
@@ -560,8 +558,6 @@ static int hw_breakpoint_handler(struct die_args *args)
560558
(dr6 & (~DR_TRAP_BITS)))
561559
rc = NOTIFY_DONE;
562560

563-
put_cpu();
564-
565561
return rc;
566562
}
567563

0 commit comments

Comments
 (0)