提交 d3a8c1cd 编写于 作者: K Krzysztof Kozlowski 提交者: Zheng Zengkai

selftests/ftrace: fix event-no-pid on 1-core machine

stable inclusion
from stable-5.10.50
commit 786461739ac4bcd87218478920ade53c7ca04ce9
bugzilla: 174522 https://gitee.com/openeuler/kernel/issues/I4DNFY

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=786461739ac4bcd87218478920ade53c7ca04ce9

--------------------------------

[ Upstream commit 07b60713 ]

When running event-no-pid test on small machines (e.g. cloud 1-core
instance), other events might not happen:

    + cat trace
    + cnt=0
    + [ 0 -eq 0 ]
    + fail No other events were recorded
    [15] event tracing - restricts events based on pid notrace filtering [FAIL]

Schedule a simple sleep task to be sure that some other process events
get recorded.

Fixes: ebed9628 ("selftests/ftrace: Add test to test new set_event_notrace_pid file")
Signed-off-by: NKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: NShuah Khan <skhan@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 2f89acfa
...@@ -57,6 +57,10 @@ enable_events() { ...@@ -57,6 +57,10 @@ enable_events() {
echo 1 > tracing_on echo 1 > tracing_on
} }
other_task() {
sleep .001 || usleep 1 || sleep 1
}
echo 0 > options/event-fork echo 0 > options/event-fork
do_reset do_reset
...@@ -94,6 +98,9 @@ child=$! ...@@ -94,6 +98,9 @@ child=$!
echo "child = $child" echo "child = $child"
wait $child wait $child
# Be sure some other events will happen for small systems (e.g. 1 core)
other_task
echo 0 > tracing_on echo 0 > tracing_on
cnt=`count_pid $mypid` cnt=`count_pid $mypid`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册