Merge tag 'mvebu-dt-5.8-1' of git://git.infradead.org/linux-mvebu into arm/dt
[linux-2.6-microblaze.git] / tools / testing / selftests / ftrace / test.d / kprobe / multiple_kprobes.tc
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: Register/unregister many kprobe events
4
5 [ -f kprobe_events ] || exit_unsupported # this is configurable
6
7 # ftrace fentry skip size depends on the machine architecture.
8 # Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc64le
9 case `uname -m` in
10   x86_64|i[3456]86) OFFS=5;;
11   ppc64le) OFFS=8;;
12   *) OFFS=0;;
13 esac
14
15 N=0
16 echo "Setup up kprobes on first available 256 text symbols"
17 grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
18 while read i; do
19   echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
20   test $N -eq 256 && break
21 done
22
23 L=`cat kprobe_events | wc -l`
24 if [ $L -ne 256 ]; then
25   echo "The number of kprobes events ($L) is not 256"
26   exit_fail
27 fi
28
29 echo 1 > events/kprobes/enable
30 echo 0 > events/kprobes/enable
31 echo > kprobe_events
32 echo "Waiting for unoptimizing & freeing"
33 sleep 5
34 echo "Done"