lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 30 Oct 2023 13:28:29 +0100
From:   Thomas Richter <tmricht@...ux.ibm.com>
To:     linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        acme@...nel.org, iii@...ux.ibm.com, namhyung@...nel.org
Cc:     svens@...ux.ibm.com, gor@...ux.ibm.com, sumanthk@...ux.ibm.com,
        hca@...ux.ibm.com, Thomas Richter <tmricht@...ux.ibm.com>
Subject: [PATCH] perf test: Adjust test case perf record offcpu profiling tests for s390

On s390 using linux-next the test case
    87: perf record offcpu profiling tests
fails. The root cause is this command

 # ./perf  record --off-cpu -e dummy -- ./perf bench sched messaging -l 10
 # Running 'sched/messaging' benchmark:
 # 20 sender and receiver processes per group
 # 10 groups == 400 processes run

     Total time: 0.231 [sec]
 [ perf record: Woken up 1 times to write data ]
 [ perf record: Captured and wrote 0.077 MB perf.data (401 samples) ]
 #

It does not generate 800+ sample entries, on s390 usually around 40[1-9],
sometimes a few more, but never more than 450. The higher the number
of CPUs the lower the number of samples.

Looking at function chain
  bench_sched_messaging()
  +--> group()
the senders and receiver threads are created. The senders and receivers
call function ready() which writes one bytes and wait for a reply using
poll system() call.

As context switches are counted, the function ready() will trigger
a context switch when no input data is available after the write
system call. The write system call does not trigger context switches
when the data size is small. And writing 1000 bytes (10 iterations with
100 bytes) is not much and certainly won't block.

Each process waits for poll, so it should be more than 400 events.
Note that read and write will not necessarily result in waits,
in particular in a situation where the writers run first.

Lower the number of expected context switches to 400 to succeed on
s390.

Output before:
 # ./perf test offcpu
 86: perf record offcpu profiling tests        : FAILED!
 #

Output after:
 # ./perf test offcpu
 86: perf record offcpu profiling tests        : Ok
 #

Fixes: 831d06c8d1b3 ("perf test: Add a basic offcpu profiling test")
Suggested-by: Namhyung Kim <namhyung@...nel.org>
Signed-off-by: Thomas Richter <tmricht@...ux.ibm.com>
Co-developed-by: Ilya Leoshkevich <iii@...ux.ibm.com>
---
 tools/perf/tests/shell/record_offcpu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/record_offcpu.sh b/tools/perf/tests/shell/record_offcpu.sh
index a1ef8f0d2b5c..565e40a881d6 100755
--- a/tools/perf/tests/shell/record_offcpu.sh
+++ b/tools/perf/tests/shell/record_offcpu.sh
@@ -79,7 +79,7 @@ test_offcpu_child() {
   fi
   # each process waits for read and write, so it should be more than 800 events
   if ! perf report -i ${perfdata} -s comm -q -n -t ';' --percent-limit=90 | \
-    awk -F ";" '{ if (NF > 3 && int($3) < 800) exit 1; }'
+    awk -F ";" '{ if (NF > 3 && int($3) < 400) exit 1; }'
   then
     echo "Child task off-cpu test [Failed invalid output]"
     err=1
-- 
2.41.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ