OSDN Git Service

powerpc/watchpoint: Don't allow concurrent perf and ptrace events
authorRavi Bangoria <ravi.bangoria@linux.ibm.com>
Thu, 14 May 2020 11:17:39 +0000 (16:47 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 18 May 2020 14:14:45 +0000 (00:14 +1000)
commit29da4f91c0c1fbda12b8a31be0d564930208c92e
tree5ae2bc339c5d581722f099efd4110efa05dde5be
parent74c6881019b7d56c327fffc268d97adb5eb1b4f9
powerpc/watchpoint: Don't allow concurrent perf and ptrace events

With Book3s DAWR, ptrace and perf watchpoints on powerpc behaves
differently. Ptrace watchpoint works in one-shot mode and generates
signal before executing instruction. It's ptrace user's job to
single-step the instruction and re-enable the watchpoint. OTOH, in
case of perf watchpoint, kernel emulates/single-steps the instruction
and then generates event. If perf and ptrace creates two events with
same or overlapping address ranges, it's ambiguous to decide who
should single-step the instruction. Because of this issue, don't
allow perf and ptrace watchpoint at the same time if their address
range overlaps.

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-15-ravi.bangoria@linux.ibm.com
arch/powerpc/include/asm/hw_breakpoint.h
arch/powerpc/kernel/hw_breakpoint.c
kernel/events/hw_breakpoint.c