mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/x86: Fix PEBs threshold initialization
@ 2016-08-18  9:09 Jiri Olsa
  2016-08-18 11:04 ` [tip:perf/core] perf/x86: Fix PEBS " tip-bot for Jiri Olsa
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Olsa @ 2016-08-18  9:09 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: lkml, Ingo Molnar, Andi Kleen, Alexander Shishkin,
	Arnaldo Carvalho de Melo

Latest PEBS rework change could skip initialization
of the ds->pebs_interrupt_threshold for single event
PEBS threshold events.

Making sure the PEBS threshold gets always initialized.

Fixes: 09e61b4f7849 ("perf/x86/intel: Rework the large PEBS setup code")
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 arch/x86/events/intel/ds.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 248023f54c87..9fe3db5325d1 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -834,14 +834,24 @@ static inline void pebs_update_threshold(struct cpu_hw_events *cpuc)
 static void
 pebs_update_state(bool needed_cb, struct cpu_hw_events *cpuc, struct pmu *pmu)
 {
+	/*
+	 * Make sure we get updated with the first PEBs
+	 * event. It'll trigger also during removal, but
+	 * that does not hurt.
+	 */
+	bool update = cpuc->n_pebs == 1;
+
 	if (needed_cb != pebs_needs_sched_cb(cpuc)) {
 		if (!needed_cb)
 			perf_sched_cb_inc(pmu);
 		else
 			perf_sched_cb_dec(pmu);
 
-		pebs_update_threshold(cpuc);
+		update = true;
 	}
+
+	if (update)
+		pebs_update_threshold(cpuc);
 }
 
 void intel_pmu_pebs_add(struct perf_event *event)
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-18 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18  9:09 [PATCH] perf/x86: Fix PEBs threshold initialization Jiri Olsa
2016-08-18 11:04 ` [tip:perf/core] perf/x86: Fix PEBS " tip-bot for Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®