* [PATCH] perf/x86/intel: fix handling of wakeup_events for multi-entry PEBS
@ 2019-03-06 19:50 Stephane Eranian
2019-03-06 21:05 ` Andi Kleen
2019-04-03 8:43 ` [tip:perf/urgent] perf/x86/intel: Fix " tip-bot for Stephane Eranian
0 siblings, 2 replies; 3+ messages in thread
From: Stephane Eranian @ 2019-03-06 19:50 UTC (permalink / raw)
To: linux-kernel; +Cc: ak, kan.liang, peterz, mingo, acme, jolsa
When an event is programmed with attr.wakeup_events=N (N>0), it means
the caller is interested in getting a user level notification after
N samples have been recorded in the kernel sampling buffer.
With precise events on Intel processors, the kernel uses PEBS.
The kernel tries minimize sampling overhead by verifying
if the event configuration is compatible with multi-entry PEBS mode.
If so, the kernel is notified only when the buffer has reached its threshold.
Other PEBS operates in single-entry mode, the kenrel is notified for each
PEBS sample.
The problem is that the current implementation look at frequency
mode and event sample_type but ignores the wakeup_events field. Thus,
it may not be possible to receive a notification after each precise event.
This patch fixes this problem by disabling multi-entry PEBS if wakeup_events
is non-zero.
Signed-off-by: Stephane Eranian <eranian@google.com>
---
arch/x86/events/intel/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 7ec265b..13d7167 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3143,7 +3143,7 @@ static int intel_pmu_hw_config(struct perf_event *event)
return ret;
if (event->attr.precise_ip) {
- if (!event->attr.freq) {
+ if (!(event->attr.freq || event->attr.wakeup_events)) {
event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
if (!(event->attr.sample_type &
~intel_pmu_large_pebs_flags(event)))
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] perf/x86/intel: fix handling of wakeup_events for multi-entry PEBS
2019-03-06 19:50 [PATCH] perf/x86/intel: fix handling of wakeup_events for multi-entry PEBS Stephane Eranian
@ 2019-03-06 21:05 ` Andi Kleen
2019-04-03 8:43 ` [tip:perf/urgent] perf/x86/intel: Fix " tip-bot for Stephane Eranian
1 sibling, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2019-03-06 21:05 UTC (permalink / raw)
To: Stephane Eranian; +Cc: linux-kernel, kan.liang, peterz, mingo, acme, jolsa
> This patch fixes this problem by disabling multi-entry PEBS if wakeup_events
> is non-zero.
>
> Signed-off-by: Stephane Eranian <eranian@google.com>
Looks good
Reviewed-by: Andi Kleen <ak@linux.intel.com>
-Andi
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS
2019-03-06 19:50 [PATCH] perf/x86/intel: fix handling of wakeup_events for multi-entry PEBS Stephane Eranian
2019-03-06 21:05 ` Andi Kleen
@ 2019-04-03 8:43 ` tip-bot for Stephane Eranian
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Stephane Eranian @ 2019-04-03 8:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, ak, alexander.shishkin, mingo, torvalds,
peterz, eranian, tglx, hpa, jolsa, vincent.weaver
Commit-ID: 583feb08e7f7ac9d533b446882eb3a54737a6dbb
Gitweb: https://git.kernel.org/tip/583feb08e7f7ac9d533b446882eb3a54737a6dbb
Author: Stephane Eranian <eranian@google.com>
AuthorDate: Wed, 6 Mar 2019 11:50:48 -0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 3 Apr 2019 09:57:43 +0200
perf/x86/intel: Fix handling of wakeup_events for multi-entry PEBS
When an event is programmed with attr.wakeup_events=N (N>0), it means
the caller is interested in getting a user level notification after
N samples have been recorded in the kernel sampling buffer.
With precise events on Intel processors, the kernel uses PEBS.
The kernel tries minimize sampling overhead by verifying
if the event configuration is compatible with multi-entry PEBS mode.
If so, the kernel is notified only when the buffer has reached its threshold.
Other PEBS operates in single-entry mode, the kenrel is notified for each
PEBS sample.
The problem is that the current implementation look at frequency
mode and event sample_type but ignores the wakeup_events field. Thus,
it may not be possible to receive a notification after each precise event.
This patch fixes this problem by disabling multi-entry PEBS if wakeup_events
is non-zero.
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: kan.liang@intel.com
Link: https://lkml.kernel.org/r/20190306195048.189514-1-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/events/intel/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 8baa441d8000..1539647ea39d 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3185,7 +3185,7 @@ static int intel_pmu_hw_config(struct perf_event *event)
return ret;
if (event->attr.precise_ip) {
- if (!event->attr.freq) {
+ if (!(event->attr.freq || event->attr.wakeup_events)) {
event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
if (!(event->attr.sample_type &
~intel_pmu_large_pebs_flags(event)))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-03 8:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 19:50 [PATCH] perf/x86/intel: fix handling of wakeup_events for multi-entry PEBS Stephane Eranian
2019-03-06 21:05 ` Andi Kleen
2019-04-03 8:43 ` [tip:perf/urgent] perf/x86/intel: Fix " tip-bot for Stephane Eranian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome