[RFC][PATCH 0/5] hw-breakpoints: Make the API generic + support for perfcounters

From: Frederic Weisbecker
Date: Mon Jul 20 2009 - 13:08:20 EST


Hi,

This patchset aims to make the hardware breakpoint API generic and
also to provide the support for hardware breakpoints from perfcounters.

The hardware breakpoint API changes are a first shot of idea.

The support for perf counter has strange effects. It looks like only
a part of the breakpoint events are actually recorded. The triggered callback
receives well the events but if there are only few of them, none is passed
in userspace (or userspace ignores them, dunno). Once I have some time, I'll
take a deeper look inside the perf mmap syscall or whatever could be
the origin.

Thanks.

Example which traces the BKL accesses by stressing reiserfs:

bkl=0x$(cat ../../System.map | grep kernel_flag | cut -d" " -f 1)
./perf record -f -g -e 5:$bkl -- dbench -t 20 20
./perf report -g -s s
# Samples: 36
#
# Overhead Symbol
# ........ ......
#
83.33% [k] lock_kernel
|
|--51.72%-- __pwrite64
|
|--27.59%-- 0x7f9d83a17b15
|
|--13.79%-- __open
|
--10.34%-- unlink

16.67% [k] unlock_kernel
|
|--80.00%-- 0x7f9d83a17b15
|
|--20.00%-- unlink
|
--20.00%-- __pwrite64

Frederic Weisbecker (5):
hw-breakpoints: Make kernel breakpoints API truly generic
hw-breakpoints: Pull up the target symbol in a generic field
hw-breakpoints: Make user breakpoints API truly generic
perfcounter: Grow the event number to 64 bits
perfcounter: Add support for kernel hardware breakpoints

arch/x86/include/asm/hw_breakpoint.h | 9 ++-
arch/x86/kernel/hw_breakpoint.c | 91 +++++++++++-----
arch/x86/kernel/ptrace.c | 21 ++--
include/asm-generic/hw_breakpoint.h | 116 ++++++++-------------
include/linux/perf_counter.h | 1 +
kernel/hw_breakpoint.c | 173 ++++++++++++++++++++++++++++---
kernel/perf_counter.c | 41 +++++++-
kernel/trace/trace.h | 5 +-
kernel/trace/trace_ksym.c | 67 ++++++------
kernel/trace/trace_selftest.c | 2 +-
samples/hw_breakpoint/data_breakpoint.c | 10 +--
11 files changed, 368 insertions(+), 168 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/