Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-08-16 22:01:45 +0200
committerJiri Slaby <jslaby@suse.cz>2019-08-16 22:25:10 +0200
commit45fa7c15b2debc5fd112778133525dafff33d2eb (patch)
treed5656134ed11b1f24cd732e6b665f6af9c5c0958
parent5d96b9c9f141acd049e29813309e1adac5fabdb3 (diff)
perf/core: Fix creating kernel counters for PMUs that override
event->cpu (bnc#1012628).
-rw-r--r--patches.kernel.org/5.2.9-115-perf-core-Fix-creating-kernel-counters-for-PMUs.patch64
-rw-r--r--series.conf1
2 files changed, 65 insertions, 0 deletions
diff --git a/patches.kernel.org/5.2.9-115-perf-core-Fix-creating-kernel-counters-for-PMUs.patch b/patches.kernel.org/5.2.9-115-perf-core-Fix-creating-kernel-counters-for-PMUs.patch
new file mode 100644
index 0000000000..e81372e3a8
--- /dev/null
+++ b/patches.kernel.org/5.2.9-115-perf-core-Fix-creating-kernel-counters-for-PMUs.patch
@@ -0,0 +1,64 @@
+From: Leonard Crestez <leonard.crestez@nxp.com>
+Date: Wed, 24 Jul 2019 15:53:24 +0300
+Subject: [PATCH] perf/core: Fix creating kernel counters for PMUs that
+ override event->cpu
+References: bnc#1012628
+Patch-mainline: 5.2.9
+Git-commit: 4ce54af8b33d3e21ca935fc1b89b58cbba956051
+
+[ Upstream commit 4ce54af8b33d3e21ca935fc1b89b58cbba956051 ]
+
+Some hardware PMU drivers will override perf_event.cpu inside their
+event_init callback. This causes a lockdep splat when initialized through
+the kernel API:
+
+ WARNING: CPU: 0 PID: 250 at kernel/events/core.c:2917 ctx_sched_out+0x78/0x208
+ pc : ctx_sched_out+0x78/0x208
+ Call trace:
+ ctx_sched_out+0x78/0x208
+ __perf_install_in_context+0x160/0x248
+ remote_function+0x58/0x68
+ generic_exec_single+0x100/0x180
+ smp_call_function_single+0x174/0x1b8
+ perf_install_in_context+0x178/0x188
+ perf_event_create_kernel_counter+0x118/0x160
+
+Fix this by calling perf_install_in_context with event->cpu, just like
+perf_event_open
+
+Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Mark Rutland <mark.rutland@arm.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
+Cc: Frank Li <Frank.li@nxp.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Will Deacon <will@kernel.org>
+Link: https://lkml.kernel.org/r/c4ebe0503623066896d7046def4d6b1e06e0eb2e.1563972056.git.leonard.crestez@nxp.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ kernel/events/core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kernel/events/core.c b/kernel/events/core.c
+index f851934d55d4..4bc15cff1026 100644
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -11266,7 +11266,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
+ goto err_unlock;
+ }
+
+- perf_install_in_context(ctx, event, cpu);
++ perf_install_in_context(ctx, event, event->cpu);
+ perf_unpin_context(ctx);
+ mutex_unlock(&ctx->mutex);
+
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index e66fc69e3e..b91c4e8f89 100644
--- a/series.conf
+++ b/series.conf
@@ -1135,6 +1135,7 @@
patches.kernel.org/5.2.9-112-perf-x86-intel-Fix-SLOTS-PEBS-event-constraint.patch
patches.kernel.org/5.2.9-113-perf-x86-intel-Fix-invalid-Bit-13-for-Icelake-M.patch
patches.kernel.org/5.2.9-114-perf-x86-Apply-more-accurate-check-on-hyperviso.patch
+ patches.kernel.org/5.2.9-115-perf-core-Fix-creating-kernel-counters-for-PMUs.patch
########################################################
# Build fixes that apply to the vanilla kernel too.