Re: [PATCH 1/3] perf/x86/intel: Factor out common code of PMI handler

From: Liang, Kan
Date: Tue Aug 07 2018 - 11:29:06 EST




On 8/6/2018 2:20 PM, Peter Zijlstra wrote:
On Mon, Aug 06, 2018 at 10:23:41AM -0700, kan.liang@xxxxxxxxxxxxxxx wrote:
+ if (++loops > 100) {
+ static bool warned;
+
+ if (!warned) {
+ WARN(1, "perfevents: irq loop stuck!\n");
+ perf_event_print_debug();
+ warned = true;
+ }

Bah, that really reads like we want WARN_ONCE(), except for that
perf_event_print_debug() thing :/


Yes. I went though the log. To make the WARN text pair with perf_event_print_debug(), we open-coded WARN_ONCE()'s
one-time-only logic here since commit ae0def05ed85 ("perf/x86: Only print PMU state when also WARN()'ing")

I think I will still keep the logic here and just fix the complaint from checkpatch.pl.

Thanks,
Kan