1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: ftrace - Max stack tracer 4# requires: stack_trace stack_trace_filter 5# Test the basic function of max-stack usage tracing 6 7echo > stack_trace_filter 8echo 0 > stack_max_size 9echo 1 > /proc/sys/kernel/stack_tracer_enabled 10 11: "Fork and wait for the first entry become !lock" 12timeout=10 13while [ $timeout -ne 0 ]; do 14 ( echo "forked" ) 15 FL=`grep " 0)" stack_trace` 16 echo $FL | grep -q "lock" || break; 17 timeout=$((timeout - 1)) 18done 19echo 0 > /proc/sys/kernel/stack_tracer_enabled 20 21echo '*lock*' > stack_trace_filter 22test `cat stack_trace_filter | wc -l` -eq `grep lock stack_trace_filter | wc -l` 23 24echo 0 > stack_max_size 25echo 1 > /proc/sys/kernel/stack_tracer_enabled 26 27: "Fork and always the first entry including lock" 28timeout=10 29while [ $timeout -ne 0 ]; do 30 ( echo "forked" ) 31 FL=`grep " 0)" stack_trace` 32 echo $FL | grep -q "lock" 33 timeout=$((timeout - 1)) 34done 35echo 0 > /proc/sys/kernel/stack_tracer_enabled 36