powerpc/watchpoint: Introduce is_ptrace_bp() function
authorRavi Bangoria <ravi.bangoria@linux.ibm.com>
Thu, 14 May 2020 11:17:36 +0000 (16:47 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 18 May 2020 14:11:05 +0000 (00:11 +1000)
Introduce is_ptrace_bp() function and move the check inside the
function. It will be utilize more in later set of patches.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Michael Neuling <mikey@neuling.org>
Link: https://lore.kernel.org/r/20200514111741.97993-12-ravi.bangoria@linux.ibm.com
arch/powerpc/kernel/hw_breakpoint.c

index 917cca73dbc361e313d806037557d45841daca9d..8028a2704874157c39350ad49d948e813734c99f 100644 (file)
@@ -91,6 +91,11 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
        hw_breakpoint_disable();
 }
 
+static bool is_ptrace_bp(struct perf_event *bp)
+{
+       return bp->overflow_handler == ptrace_triggered;
+}
+
 /*
  * Perform cleanup of arch-specific counters during unregistration
  * of the perf-event
@@ -325,7 +330,7 @@ int hw_breakpoint_handler(struct die_args *args)
         * one-shot mode. The ptrace-ed process will receive the SIGTRAP signal
         * generated in do_dabr().
         */
-       if (bp->overflow_handler == ptrace_triggered) {
+       if (is_ptrace_bp(bp)) {
                perf_bp_event(bp, regs);
                rc = NOTIFY_DONE;
                goto out;