tools/testing/selftests/ftrace/test.d/remotes/hotplug.tc
Source file repositories/reference/linux-study-clean/tools/testing/selftests/ftrace/test.d/remotes/hotplug.tc
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/ftrace/test.d/remotes/hotplug.tc- Extension
.tc- Size
- 1493 bytes
- Lines
- 89
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: Test trace remote read with an offline CPU
# requires: remotes/test
. $TEST_DIR/remotes/functions
hotunplug_one_cpu()
{
[ "$(get_cpu_ids | wc -l)" -ge 2 ] || return 1
for cpu in $(get_cpu_ids); do
echo 0 > /sys/devices/system/cpu/cpu$cpu/online || return 1
break
done
echo $cpu
}
# Check non-consuming and consuming read
check_read()
{
for i in $(seq 1 8); do
echo $i > write_event
done
check_trace 1 8 trace
output=$(dump_trace_pipe)
check_trace 1 8 $output
rm $output
}
test_hotplug()
{
echo 0 > trace
assert_loaded
#
# Test a trace buffer containing an offline CPU
#
cpu=$(hotunplug_one_cpu) || exit_unsupported
trap "echo 1 > /sys/devices/system/cpu/cpu$cpu/online" EXIT
check_read
#
# Test a trace buffer with a missing CPU
#
reload_remote
check_read
#
# Test a trace buffer with a CPU added later
#
echo 1 > /sys/devices/system/cpu/cpu$cpu/online
trap "" EXIT
assert_loaded
check_read
# Test if the ring-buffer for the newly added CPU is both writable and
# readable
for i in $(seq 1 8); do
taskset -c $cpu echo $i > write_event
done
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.