perf/x86/intel/uncore: Handle invalid event coding for free-running counter
authorKan Liang <kan.liang@linux.intel.com>
Wed, 1 May 2019 00:53:43 +0000 (17:53 -0700)
committerIngo Molnar <mingo@kernel.org>
Mon, 17 Jun 2019 10:36:17 +0000 (12:36 +0200)
commit543ac280b3576c0009e8c0fcd4d6bfc9978d7bd0
treebb62b6e61f94b638ad07b2e5d05218d1825c1c0c
parentfaaeff98666c24376cebd0b106504d05a36881d1
perf/x86/intel/uncore: Handle invalid event coding for free-running counter

Counting with invalid event coding for free-running counter may cause
OOPs, e.g. uncore_iio_free_running_0/event=1/.

Current code only validate the event with free-running event format,
event=0xff,umask=0xXY. Non-free-running event format never be checked
for the PMU with free-running counters.

Add generic hw_config() to check and reject the invalid event coding
for free-running PMU.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@kernel.org
Cc: eranian@google.com
Fixes: 0f519f0352e3 ("perf/x86/intel/uncore: Support IIO free-running counters on SKX")
Link: https://lkml.kernel.org/r/1556672028-119221-2-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/events/intel/uncore.h
arch/x86/events/intel/uncore_snbep.c