summary refs log tree commit diff
diff options
context:
space:
mode:
authorKan Liang <kan.liang@linux.intel.com>2021-04-12 07:30:59 -0700
committerPeter Zijlstra <peterz@infradead.org>2021-04-19 20:03:28 +0200
commit3e9a8b219e4cc897dba20e19185d0471f129f6f3 (patch)
treec3e7cda32c02a61c724f133959868cb7613c2fb0
parent58ae30c29a370c09eb49e0007d881a9aed13c5a3 (diff)
downloadlinux-3e9a8b219e4cc897dba20e19185d0471f129f6f3.tar.gz
perf/x86: Support filter_match callback
Implement filter_match callback for X86, which check whether an event is
schedulable on the current CPU.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Link: https://lkml.kernel.org/r/1618237865-33448-20-git-send-email-kan.liang@linux.intel.com
-rw-r--r--arch/x86/events/core.c10
-rw-r--r--arch/x86/events/perf_event.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 37ab109a4108..4f6595ee6359 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -2641,6 +2641,14 @@ static int x86_pmu_aux_output_match(struct perf_event *event)
 	return 0;
 }
 
+static int x86_pmu_filter_match(struct perf_event *event)
+{
+	if (x86_pmu.filter_match)
+		return x86_pmu.filter_match(event);
+
+	return 1;
+}
+
 static struct pmu pmu = {
 	.pmu_enable		= x86_pmu_enable,
 	.pmu_disable		= x86_pmu_disable,
@@ -2668,6 +2676,8 @@ static struct pmu pmu = {
 	.check_period		= x86_pmu_check_period,
 
 	.aux_output_match	= x86_pmu_aux_output_match,
+
+	.filter_match		= x86_pmu_filter_match,
 };
 
 void arch_perf_update_userpage(struct perf_event *event,
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index e2be927158d5..606fb6e14419 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -879,6 +879,7 @@ struct x86_pmu {
 
 	int (*aux_output_match) (struct perf_event *event);
 
+	int (*filter_match)(struct perf_event *event);
 	/*
 	 * Hybrid support
 	 *