]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[mirror_ubuntu-jammy-kernel.git] / tools / testing / selftests / ftrace / test.d / ftrace / func_cpumask.tc
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: ftrace - function trace with cpumask
4
5 if ! which nproc ; then
6 nproc() {
7 ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l
8 }
9 fi
10
11 NP=`nproc`
12
13 if [ $NP -eq 1 ] ;then
14 echo "We can not test cpumask on UP environment"
15 exit_unresolved
16 fi
17
18 if ! grep -q "function" available_tracers ; then
19 echo "Function trace is not enabled"
20 exit_unsupported
21 fi
22
23 ORIG_CPUMASK=`cat tracing_cpumask`
24
25 do_reset() {
26 echo $ORIG_CPUMASK > tracing_cpumask
27 }
28
29 echo 0 > tracing_on
30 echo > trace
31 : "Bitmask only record on CPU1"
32 echo 2 > tracing_cpumask
33 MASK=0x`cat tracing_cpumask`
34 test `printf "%d" $MASK` -eq 2 || do_reset
35
36 echo function > current_tracer
37 echo 1 > tracing_on
38 (echo "forked")
39 echo 0 > tracing_on
40
41 : "Check CPU1 events are recorded"
42 grep -q -e "\[001\]" trace || do_reset
43
44 : "There should be No other cpu events"
45 ! grep -qv -e "\[001\]" -e "^#" trace || do_reset
46
47 do_reset