mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 22:52:19 +02:00
The hotplug testing only tries reading a trace remote buffer, loaded before a CPU is offline. Extend this testing to cover: * A trace remote buffer loaded after a CPU is offline. * A trace remote buffer loaded before a CPU is online. Because of these added test cases, move the hotplug testing into a separate hotplug.tc file. Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Vincent Donnefort <vdonnefort@google.com> Link: https://patch.msgid.link/20260401045100.3394299-3-vdonnefort@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
103 lines
1.9 KiB
Bash
103 lines
1.9 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# description: Test trace remote consuming read
|
|
# requires: remotes/test
|
|
|
|
. $TEST_DIR/remotes/functions
|
|
|
|
test_trace_pipe()
|
|
{
|
|
echo 0 > tracing_on
|
|
assert_unloaded
|
|
|
|
# Emit events from the same CPU
|
|
for cpu in $(get_cpu_ids); do
|
|
break
|
|
done
|
|
|
|
#
|
|
# Simple test: Emit enough events to fill few pages
|
|
#
|
|
|
|
echo 1024 > buffer_size_kb
|
|
echo 1 > tracing_on
|
|
assert_loaded
|
|
|
|
events_per_page=$(($(get_page_size) / $(get_selftest_event_size)))
|
|
nr_events=$(($events_per_page * 4))
|
|
|
|
output=$(mktemp $TMPDIR/remote_test.XXXXXX)
|
|
|
|
cat trace_pipe > $output &
|
|
pid=$!
|
|
|
|
for i in $(seq 1 $nr_events); do
|
|
taskset -c $cpu echo $i > write_event
|
|
done
|
|
|
|
echo 0 > tracing_on
|
|
sleep 1
|
|
kill $pid
|
|
|
|
check_trace 1 $nr_events $output
|
|
|
|
rm $output
|
|
|
|
#
|
|
# Test interaction with lost events
|
|
#
|
|
|
|
assert_unloaded
|
|
echo 7 > buffer_size_kb
|
|
echo 1 > tracing_on
|
|
assert_loaded
|
|
|
|
nr_events=$((events_per_page * 2))
|
|
for i in $(seq 1 $nr_events); do
|
|
taskset -c $cpu echo $i > write_event
|
|
done
|
|
|
|
output=$(dump_trace_pipe)
|
|
|
|
lost_events=$(sed -n -e '1s/CPU:.*\[LOST \([0-9]*\) EVENTS\]/\1/p' $output)
|
|
test -n "$lost_events"
|
|
|
|
id=$(sed -n -e '2s/\[[0-9]*\]\s*[0-9]*.[0-9]*: [a-z]* id=\([0-9]*\)/\1/p' $output)
|
|
test "$id" -eq $(($lost_events + 1))
|
|
|
|
# Drop [LOST EVENTS] line
|
|
sed -i '1d' $output
|
|
|
|
check_trace $id $nr_events $output
|
|
|
|
rm $output
|
|
|
|
#
|
|
# Test per-CPU interface
|
|
#
|
|
|
|
echo 0 > trace
|
|
echo 1 > tracing_on
|
|
|
|
for cpu in $(get_cpu_ids); do
|
|
taskset -c $cpu echo $cpu > write_event
|
|
done
|
|
|
|
for cpu in $(get_cpu_ids); do
|
|
cd per_cpu/cpu$cpu/
|
|
output=$(dump_trace_pipe)
|
|
|
|
check_trace $cpu $cpu $output
|
|
|
|
rm $output
|
|
cd - > /dev/null
|
|
done
|
|
}
|
|
|
|
if [ -z "$SOURCE_REMOTE_TEST" ]; then
|
|
set -e
|
|
|
|
setup_remote_test
|
|
test_trace_pipe
|
|
fi
|