Skip to content

Commit bdd7e3d

Browse files
mhiramatrostedt
authored andcommitted
selftests/ftrace: Add a testcase for many kprobe events
Add a testcase to test kprobes via ftrace interface with many concurrent kprobe events. This tries to add many kprobe events (up to 256) on kernel functions. To avoid making ftrace-based kprobes (kprobes on fentry), it skips first N bytes (on x86 N=5, on ppc or arm N=4) of function entry. After that, it enables all those events, disable it, and remove it. Since the unoptimization buffer reclaiming will be delayed, after removing events, it will wait enough time. Link: http://lkml.kernel.org/r/149577388470.11702.11832460851769204511.stgit@devbox Signed-off-by: Masami Hiramatsu <[email protected]> Suggested-by: Steven Rostedt <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent c93f5cf commit bdd7e3d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
# description: Register/unregister many kprobe events
3+
4+
# ftrace fentry skip size depends on the machine architecture.
5+
# Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc
6+
case `uname -m` in
7+
x86_64|i[3456]86) OFFS=5;;
8+
ppc*) OFFS=4;;
9+
*) OFFS=0;;
10+
esac
11+
12+
echo "Setup up to 256 kprobes"
13+
grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
14+
head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||:
15+
16+
echo 1 > events/kprobes/enable
17+
echo 0 > events/kprobes/enable
18+
echo > kprobe_events
19+
echo "Waiting for unoptimizing & freeing"
20+
sleep 5
21+
echo "Done"

0 commit comments

Comments
 (0)