2021-05-28 08:52:23

by Jin Yao

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

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 <[email protected]>
Reviewed-by: Andi Kleen <[email protected]>
---
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


2021-05-30 22:20:19

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH] perf stat: Disable NMI watchdog message on hybrid

On Fri, May 28, 2021 at 11:55:47AM +0800, Jin Yao wrote:
> 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 <[email protected]>
> Reviewed-by: Andi Kleen <[email protected]>

Acked-by: Jiri Olsa <[email protected]>

thanks,
jirka

> ---
> 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
>