2 # SPDX-License-Identifier: GPL-2.0+
4 # Extract any RCU CPU stall warnings present in specified file.
5 # Filter out clocksource lines. Note that preceding-lines excludes the
6 # initial line of the stall warning but trailing-lines includes it.
8 # Usage: extract-stall.sh dmesg-file [ preceding-lines [ trailing-lines ] ]
11 preceding_lines="${2-3}"
12 trailing_lines="${3-10}"
14 awk -v preceding_lines="$preceding_lines" -v trailing_lines="$trailing_lines" '
16 for (i = preceding_lines; i > 0; i--)
17 last[i] = last[i - 1];
28 suffix <= 0 && /detected stall/ {
29 for (i = preceding_lines; i >= 0; i--)
32 suffix = trailing_lines;
33 }' < "$1" | tr -d '\015' | grep -v clocksource