From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945907AbcHRLqR (ORCPT ); Thu, 18 Aug 2016 07:46:17 -0400 Received: from terminus.zytor.com ([198.137.202.10]:59480 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752348AbcHRLqC (ORCPT ); Thu, 18 Aug 2016 07:46:02 -0400 Date: Thu, 18 Aug 2016 04:04:29 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: hpa@zytor.com, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, peterz@infradead.org, jolsa@kernel.org, acme@kernel.org, a.p.zijlstra@chello.nl, torvalds@linux-foundation.org, tglx@linutronix.de, jolsa@redhat.com, mingo@kernel.org Reply-To: peterz@infradead.org, linux-kernel@vger.kernel.org, hpa@zytor.com, alexander.shishkin@linux.intel.com, a.p.zijlstra@chello.nl, acme@kernel.org, mingo@kernel.org, jolsa@redhat.com, tglx@linutronix.de, torvalds@linux-foundation.org, jolsa@kernel.org In-Reply-To: <1471511392-29875-1-git-send-email-jolsa@kernel.org> References: <1471511392-29875-1-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86: Fix PEBS threshold initialization Git-Commit-ID: b6a32f023fcc9cbd1602f78a467fd8d41bbc9457 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: b6a32f023fcc9cbd1602f78a467fd8d41bbc9457 Gitweb: http://git.kernel.org/tip/b6a32f023fcc9cbd1602f78a467fd8d41bbc9457 Author: Jiri Olsa AuthorDate: Thu, 18 Aug 2016 11:09:52 +0200 Committer: Ingo Molnar CommitDate: Thu, 18 Aug 2016 11:58:02 +0200 perf/x86: Fix PEBS threshold initialization Latest PEBS rework change could skip initialization of the ds->pebs_interrupt_threshold for single event PEBS threshold events. Make sure the PEBS threshold gets always initialized. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Peter Zijlstra Cc: Thomas Gleixner Fixes: 09e61b4f7849 ("perf/x86/intel: Rework the large PEBS setup code") Link: http://lkml.kernel.org/r/1471511392-29875-1-git-send-email-jolsa@kernel.org Signed-off-by: Ingo Molnar --- 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 248023f..e0288d5 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 will 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)