[PATCH] perf stat: Disable NMI watchdog message on hybrid

From: Jin Yao
Date: Thu May 27 2021 - 23:56:53 EST


If we run a single workload that only runs on big core, there is always a
ugly message about disabling the NMI watchdog because the atom is not
counted.

Before:

# perf stat ls
...

Performance counter stats for 'ls':

0.94 msec task-clock # 0.620 CPUs utilized
0 context-switches # 0.000 /sec
0 cpu-migrations # 0.000 /sec
111 page-faults # 118.603 K/sec
3,111,368 cpu_core/cycles/ # 3.324 G/sec
<not counted> cpu_atom/cycles/ (0.00%)
2,965,942 cpu_core/instructions/ # 3.169 G/sec
<not counted> cpu_atom/instructions/ (0.00%)
596,579 cpu_core/branches/ # 637.442 M/sec
<not counted> cpu_atom/branches/ (0.00%)
15,744 cpu_core/branch-misses/ # 16.822 M/sec
<not counted> cpu_atom/branch-misses/ (0.00%)

0.001509271 seconds time elapsed

0.001572000 seconds user
0.000000000 seconds sys

Some events weren't counted. Try disabling the NMI watchdog:
echo 0 > /proc/sys/kernel/nmi_watchdog
perf stat ...
echo 1 > /proc/sys/kernel/nmi_watchdog

Now we disable the NMI watchdog message on hybrid, otherwise there
are too many false positives.

After:

# perf stat ls
...

Performance counter stats for 'ls':

2.32 msec task-clock # 0.712 CPUs utilized
0 context-switches # 0.000 /sec
0 cpu-migrations # 0.000 /sec
110 page-faults # 47.327 K/sec
2,313,349 cpu_core/cycles/ # 995.308 M/sec
<not counted> cpu_atom/cycles/ (0.00%)
2,986,113 cpu_core/instructions/ # 1.285 G/sec
<not counted> cpu_atom/instructions/ (0.00%)
598,861 cpu_core/branches/ # 257.657 M/sec
<not counted> cpu_atom/branches/ (0.00%)
16,090 cpu_core/branch-misses/ # 6.923 M/sec
<not counted> cpu_atom/branch-misses/ (0.00%)

0.003265716 seconds time elapsed

0.000000000 seconds user
0.003307000 seconds sys

Signed-off-by: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
Reviewed-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
tools/perf/util/stat-display.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index b759dfd633b4..db3c7a105a2b 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -465,7 +465,8 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int
config->csv_sep);

if (counter->supported) {
- config->print_free_counters_hint = 1;
+ if (!perf_pmu__is_hybrid(counter->pmu_name))
+ config->print_free_counters_hint = 1;
if (is_mixed_hw_group(counter))
config->print_mixed_hw_group_error = 1;
}
--
2.17.1