All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test
@ 2026-09-08 21:31 Eva Kurchatova
  2026-09-08 21:31 ` [Devel] [PATCH vz10 2/2] selftests/ftrace: skip gcov symbols when picking a function to probe Eva Kurchatova
  2026-09-23 19:30 ` [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test Konstantin Khorenko
  0 siblings, 2 replies; 3+ messages in thread
From: Eva Kurchatova @ 2026-09-08 21:31 UTC (permalink / raw)
  To: khorenko; +Cc: devel

From: Steven Rostedt <rostedt@goodmis.org>

The subsystem event test enables all "sched" events and makes sure there's
at least 3 different events in the output. It used to cat the entire trace
file to | wc -l, but on slow machines, that could last a very long time.
To solve that, it was changed to just read the first 100 lines of the
trace file. This can cause false failures as some events repeat so often,
that the 100 lines that are examined could possibly be of only one event.

Instead, create an awk script that looks for 3 different events and will
exit out after it finds them. This will find the 3 events the test looks
for (eventually if it works), and still exit out after the test is
satisfied and not cause slower machines to run forever.

Link: https://lore.kernel.org/r/20250721134212.53c3e140@batman.local.home
Reported-by: Tengda Wu <wutengda@huaweicloud.com>
Closes: https://lore.kernel.org/all/20250710130134.591066-1-wutengda@huaweicloud.com/
Fixes: 1a4ea83a6e67 ("selftests/ftrace: Limit length in subsystem-enable tests")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
(cherry picked from commit 213879061a9c60200ba971330dbefec6df3b4a30)

https://virtuozzo.atlassian.net/browse/VSTOR-144622
Feature: fix selftests coverage

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 .../ftrace/test.d/event/subsystem-enable.tc   | 28 +++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
index b7c8f29c09a9..65916bb55dfb 100644
--- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
@@ -14,11 +14,35 @@ fail() { #msg
     exit_fail
 }
 
+# As reading trace can last forever, simply look for 3 different
+# events then exit out of reading the file. If there's not 3 different
+# events, then the test has failed.
+check_unique() {
+    cat trace | grep -v '^#' | awk '
+	BEGIN { cnt = 0; }
+	{
+	    for (i = 0; i < cnt; i++) {
+		if (event[i] == $5) {
+		    break;
+		}
+	    }
+	    if (i == cnt) {
+		event[cnt++] = $5;
+		if (cnt > 2) {
+		    exit;
+		}
+	    }
+	}
+	END {
+	    printf "%d", cnt;
+	}'
+}
+
 echo 'sched:*' > set_event
 
 yield
 
-count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
+count=`check_unique`
 if [ $count -lt 3 ]; then
     fail "at least fork, exec and exit events should be recorded"
 fi
@@ -29,7 +53,7 @@ echo 1 > events/sched/enable
 
 yield
 
-count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
+count=`check_unique`
 if [ $count -lt 3 ]; then
     fail "at least fork, exec and exit events should be recorded"
 fi
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Devel] [PATCH vz10 2/2] selftests/ftrace: skip gcov symbols when picking a function to probe
  2026-09-08 21:31 [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test Eva Kurchatova
@ 2026-09-08 21:31 ` Eva Kurchatova
  2026-09-23 19:30 ` [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test Konstantin Khorenko
  1 sibling, 0 replies; 3+ messages in thread
From: Eva Kurchatova @ 2026-09-08 21:31 UTC (permalink / raw)
  To: khorenko; +Cc: devel

kprobe_eventname.tc takes the last kallsyms entry whose name ends in
vfs_read and puts a probe on it. On a kernel built with
CONFIG_GCOV_PROFILE_ALL=y the counter symbol gcc emits for the function
sorts after it:

  ffffffff819bd1e0 T vfs_read
  ffffffff845013e0 t __gcov_.vfs_read

so the test picks __gcov_.vfs_read, which is not a function entry, and
the write fails:

  kprobe_eventname.tc: line 10: echo: write error: Invalid argument

Leave those symbols out of the choice. The test then picks vfs_read and
passes; without a coverage build nothing changes, as no such symbol
exists there.

This is the same class of problem as commit 23a4b108accc
("tracing/selftests: Fix kprobe event name test for .isra. functions"),
where a compiler-generated symbol was picked instead of a real function.

https://virtuozzo.atlassian.net/browse/VSTOR-144622
Feature: fix selftests

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 .../testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
index ba19b81cef39..0688a5c47d1e 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc
@@ -5,7 +5,7 @@
 
 :;: "Add an event on function without name" ;:
 
-FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "`
+FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | grep -v __gcov | tail -n 1 | cut -f 3 -d " "`
 [ "x" != "x$FUNC" ] || exit_unresolved
 echo "p $FUNC" > kprobe_events
 PROBE_NAME=`echo $FUNC | tr ".:" "_"`
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test
  2026-09-08 21:31 [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test Eva Kurchatova
  2026-09-08 21:31 ` [Devel] [PATCH vz10 2/2] selftests/ftrace: skip gcov symbols when picking a function to probe Eva Kurchatova
@ 2026-09-23 19:30 ` Konstantin Khorenko
  1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-09-23 19:30 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Wed, 09 Sep 2026 00:31:47 +0300, Eva Kurchatova wrote:
> ms/selftests/tracing: Fix false failure of subsystem event test

Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.3.vz10, thanks!

[1/2] ms/selftests/tracing: Fix false failure of subsystem event test
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/25dcf65e3116
[2/2] selftests/ftrace: skip gcov symbols when picking a function to probe
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/b3bd8f01bee9

-- 
Konstantin Khorenko <khorenko@virtuozzo.com>

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-23 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 21:31 [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test Eva Kurchatova
2026-09-08 21:31 ` [Devel] [PATCH vz10 2/2] selftests/ftrace: skip gcov symbols when picking a function to probe Eva Kurchatova
2026-09-23 19:30 ` [Devel] [PATCH vz10 1/2] ms/selftests/tracing: Fix false failure of subsystem event test Konstantin Khorenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.