From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752202AbdANMa1 (ORCPT ); Sat, 14 Jan 2017 07:30:27 -0500 Received: from terminus.zytor.com ([198.137.202.10]:50916 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752089AbdANMaZ (ORCPT ); Sat, 14 Jan 2017 07:30:25 -0500 Date: Sat, 14 Jan 2017 04:29:49 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: vincent.weaver@maine.edu, mingo@kernel.org, torvalds@linux-foundation.org, alexander.shishkin@linux.intel.com, eranian@google.com, acme@kernel.org, tglx@linutronix.de, peterz@infradead.org, hpa@zytor.com, acme@redhat.com, linux-kernel@vger.kernel.org, jolsa@redhat.com, vince@deater.net, jolsa@kernel.org Reply-To: vincent.weaver@maine.edu, mingo@kernel.org, torvalds@linux-foundation.org, tglx@linutronix.de, eranian@google.com, acme@kernel.org, alexander.shishkin@linux.intel.com, hpa@zytor.com, peterz@infradead.org, acme@redhat.com, jolsa@redhat.com, linux-kernel@vger.kernel.org, vince@deater.net, jolsa@kernel.org In-Reply-To: <20170103142454.GA26251@krava> References: <20170103142454.GA26251@krava> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/x86: Reject non sampling events with precise_ip Git-Commit-ID: 18e7a45af91acdde99d3aa1372cc40e1f8142f7b 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: 18e7a45af91acdde99d3aa1372cc40e1f8142f7b Gitweb: http://git.kernel.org/tip/18e7a45af91acdde99d3aa1372cc40e1f8142f7b Author: Jiri Olsa AuthorDate: Tue, 3 Jan 2017 15:24:54 +0100 Committer: Ingo Molnar CommitDate: Sat, 14 Jan 2017 11:06:50 +0100 perf/x86: Reject non sampling events with precise_ip As Peter suggested [1] rejecting non sampling PEBS events, because they dont make any sense and could cause bugs in the NMI handler [2]. [1] http://lkml.kernel.org/r/20170103094059.GC3093@worktop [2] http://lkml.kernel.org/r/1482931866-6018-3-git-send-email-jolsa@kernel.org Signed-off-by: Jiri Olsa Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: Vince Weaver Link: http://lkml.kernel.org/r/20170103142454.GA26251@krava Signed-off-by: Ingo Molnar --- arch/x86/events/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 019c588..1635c0c 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -505,6 +505,10 @@ int x86_pmu_hw_config(struct perf_event *event) if (event->attr.precise_ip > precise) return -EOPNOTSUPP; + + /* There's no sense in having PEBS for non sampling events: */ + if (!is_sampling_event(event)) + return -EINVAL; } /* * check that PEBS LBR correction does not conflict with