]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/perf-x86-intel-fix-handling-of-wakeup_events-for-mul.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / perf-x86-intel-fix-handling-of-wakeup_events-for-mul.patch
CommitLineData
7264e8a9
SL
1From ff9acdd435edf2a89c5c9ec652b792dbe8df0a1f Mon Sep 17 00:00:00 2001
2From: Stephane Eranian <eranian@google.com>
3Date: Wed, 6 Mar 2019 11:50:48 -0800
4Subject: perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS
5
6[ Upstream commit 583feb08e7f7ac9d533b446882eb3a54737a6dbb ]
7
8When an event is programmed with attr.wakeup_events=N (N>0), it means
9the caller is interested in getting a user level notification after
10N samples have been recorded in the kernel sampling buffer.
11
12With precise events on Intel processors, the kernel uses PEBS.
13The kernel tries minimize sampling overhead by verifying
14if the event configuration is compatible with multi-entry PEBS mode.
15If so, the kernel is notified only when the buffer has reached its threshold.
16Other PEBS operates in single-entry mode, the kenrel is notified for each
17PEBS sample.
18
19The problem is that the current implementation look at frequency
20mode and event sample_type but ignores the wakeup_events field. Thus,
21it may not be possible to receive a notification after each precise event.
22
23This patch fixes this problem by disabling multi-entry PEBS if wakeup_events
24is non-zero.
25
26Signed-off-by: Stephane Eranian <eranian@google.com>
27Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
28Reviewed-by: Andi Kleen <ak@linux.intel.com>
29Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
30Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
31Cc: Jiri Olsa <jolsa@redhat.com>
32Cc: Linus Torvalds <torvalds@linux-foundation.org>
33Cc: Peter Zijlstra <peterz@infradead.org>
34Cc: Thomas Gleixner <tglx@linutronix.de>
35Cc: Vince Weaver <vincent.weaver@maine.edu>
36Cc: kan.liang@intel.com
37Link: https://lkml.kernel.org/r/20190306195048.189514-1-eranian@google.com
38Signed-off-by: Ingo Molnar <mingo@kernel.org>
39Signed-off-by: Sasha Levin <sashal@kernel.org>
40---
41 arch/x86/kernel/cpu/perf_event_intel.c | 2 +-
42 1 file changed, 1 insertion(+), 1 deletion(-)
43
44diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
45index 7b79c80ce029a..325ed90511cff 100644
46--- a/arch/x86/kernel/cpu/perf_event_intel.c
47+++ b/arch/x86/kernel/cpu/perf_event_intel.c
48@@ -2513,7 +2513,7 @@ static int intel_pmu_hw_config(struct perf_event *event)
49 return ret;
50
51 if (event->attr.precise_ip) {
52- if (!event->attr.freq) {
53+ if (!(event->attr.freq || event->attr.wakeup_events)) {
54 event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
55 if (!(event->attr.sample_type &
56 ~intel_pmu_free_running_flags(event)))
57--
582.20.1
59