lkml.org 
[lkml]   [2020]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] perf/arm64: Allow per-task kernel breakpoints
Date
commit 478fcb2cdb23 ("arm64: Debugging support") disallowed per-task
kernel breakpoints on arm64 since these would have potentially
complicated the stepping code.

However, we now have several use-cases (for e.g. perf) which require
per-task address execution h/w breakpoint to be exercised/set on arm64:

For e.g. we can set address execution h/w breakpoints, using the
format prescribed by 'perf-list' command:
mem:<addr>[/len][:access] [Hardware breakpoint]

Without this patch, currently 'perf stat -e' reports that per-task
address execution h/w breakpoints are 'not supported' on arm64. See
below:

$ TEST_FUNC="vfs_read"
$ ADDR=0x`cat /proc/kallsyms | grep -P "\\s$TEST_FUNC\$" | cut -f1 -d' '`
$ perf stat -e mem:$ADDR:x -x';' -- cat /proc/cpuinfo > /dev/null

<not supported>;;mem:0xffff00001031dd68:x;0;100.00;;

After this patch, this use-case can be supported:

$ TEST_FUNC="vfs_read"
$ ADDR=0x`cat /proc/kallsyms | grep -P "\\s$TEST_FUNC\$" | cut -f1 -d' '`
$ perf stat -e mem:$ADDR:x -x';' -- cat /proc/cpuinfo > /dev/null

5;;mem:0xfffffe0010361d20:x;912200;100.00;;

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
---
arch/arm64/kernel/hw_breakpoint.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 0b727edf4104..c28f04e02845 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -562,13 +562,6 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
hw->address &= ~alignment_mask;
hw->ctrl.len <<= offset;

- /*
- * Disallow per-task kernel breakpoints since these would
- * complicate the stepping code.
- */
- if (hw->ctrl.privilege == AARCH64_BREAKPOINT_EL1 && bp->hw.target)
- return -EINVAL;
-
return 0;
}

--
2.7.4
\
 
 \ /
  Last update: 2020-02-03 23:28    [W:4.028 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site