Messages in this thread | | | From | Namhyung Kim <> | Date | Thu, 7 Dec 2023 15:26:43 -0800 | Subject | Re: [PATCH] perf test: Fix fails of perf stat --bpf-counters --for-each-cgroup on s390 |
| |
Hello,
On Thu, Dec 7, 2023 at 4:57 AM Thomas Richter <tmricht@linux.ibm.com> wrote: > > On s390 this test fails very often, as can be observed in the output > below. This is caused by the second test function > check_cpu_list_counted(). The perf stat is triggered for 2 CPUs > 0 and 1. On s390, which usually has a lot more CPUs, most often > this ends up in no counter increments on these 2 CPUs 0 and 1. > > Fix this and trigger explicit workload on CPU 0 and 1 for > systemd. This is a better approach than calculating a long > list of CPUs (which is basicly the same as option -a), or > wait a longer period of time. > > Output before: > # for i in $(seq 10) > > do ./perf test 100 > > done > 100: perf stat --bpf-counters --for-each-cgroup test : FAILED! > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : FAILED! > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : FAILED! > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : FAILED! > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > # > > Output after: > # for i in $(seq 10); > do ./perf test 100; > done > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > 100: perf stat --bpf-counters --for-each-cgroup test : Ok > # > > Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> > --- > tools/perf/tests/shell/stat_bpf_counters_cgrp.sh | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh > index e75d0780dc78..f67602321403 100755 > --- a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh > +++ b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh > @@ -60,6 +60,7 @@ check_system_wide_counted() > > check_cpu_list_counted() > { > + taskset -c 0,1 systemctl daemon-reexec &
Thanks for the patch. But I think it should support machines without systemd (or maybe with old versions).
Also probably you want to reset the behavior after the test. I think we can just run some built-in test workload like `perf test -w thloop`.
Thanks, Namhyung
> check_cpu_list_counted_output=$(perf stat -C 0,1 --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, taskset -c 1 sleep 1 2>&1) > if echo ${check_cpu_list_counted_output} | grep -q -F "<not "; then > echo "Some CPU events are not counted" > -- > 2.43.0 >
| |