Skip to content

Commit

Permalink
powerpc/watchpoints: Simplify watchpoint reinsertion
Browse files Browse the repository at this point in the history
We only remove watchpoints when they have the perf_single_step flag set,
so we can reinsert them during the first iteration.

Signed-off-by: Benjamin Gray <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
  • Loading branch information
BenjaminGrayNp1 authored and mpe committed Aug 16, 2023
1 parent 1e60f35 commit 5a2d8b9
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions arch/powerpc/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,24 +772,14 @@ static int single_step_dabr_instruction(struct die_args *args)
perf_bp_event(bp, regs);

info->perf_single_step = false;
}

if (!found)
return NOTIFY_DONE;

for (int i = 0; i < nr_wp_slots(); i++) {
struct perf_event *bp = __this_cpu_read(bp_per_reg[i]);
if (!bp)
continue;

__set_breakpoint(i, counter_arch_bp(bp));
}

/*
* If the process was being single-stepped by ptrace, let the
* other single-step actions occur (e.g. generate SIGTRAP).
*/
if (test_thread_flag(TIF_SINGLESTEP))
if (!found || test_thread_flag(TIF_SINGLESTEP))
return NOTIFY_DONE;

return NOTIFY_STOP;
Expand Down

0 comments on commit 5a2d8b9

Please sign in to comment.