diff mbox series

[PATCHv2,1/4] perf/core: Export is_kernel_event()

Message ID fbe7bf4fb07ecd8c77cf0321555eabc84421ed41.1603363729.git.saiprakash.ranjan@codeaurora.org
State New
Headers show
Series coresight: etf/etb10/etr: Fix NULL pointer dereference crashes | expand

Commit Message

Sai Prakash Ranjan Oct. 22, 2020, 10:57 a.m. UTC
Export is_kernel_event() to be used by coresight drivers
in later changes to check for kernel events and bail out.

Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
---
 include/linux/perf_event.h | 2 ++
 kernel/events/core.c       | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 04a49ccc7beb..230299168f3d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1415,6 +1415,7 @@  extern void perf_event_task_tick(void);
 extern int perf_event_account_interrupt(struct perf_event *event);
 extern int perf_event_period(struct perf_event *event, u64 value);
 extern u64 perf_event_pause(struct perf_event *event, bool reset);
+extern bool is_kernel_event(struct perf_event *event);
 #else /* !CONFIG_PERF_EVENTS: */
 static inline void *
 perf_aux_output_begin(struct perf_output_handle *handle,
@@ -1507,6 +1508,7 @@  static inline u64 perf_event_pause(struct perf_event *event, bool reset)
 {
 	return 0;
 }
+static bool is_kernel_event(struct perf_event *event) { return false; }
 #endif
 
 #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 7ed5248f0445..e5db79961a2c 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -173,10 +173,11 @@  static void perf_ctx_unlock(struct perf_cpu_context *cpuctx,
 
 #define TASK_TOMBSTONE ((void *)-1L)
 
-static bool is_kernel_event(struct perf_event *event)
+bool is_kernel_event(struct perf_event *event)
 {
 	return READ_ONCE(event->owner) == TASK_TOMBSTONE;
 }
+EXPORT_SYMBOL_GPL(is_kernel_event);
 
 /*
  * On task ctx scheduling...