[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170103142454.GA26251@krava>
Date: Tue, 3 Jan 2017 15:24:54 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andi Kleen <andi@...stfloor.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Vince Weaver <vince@...ter.net>
Subject: [PATCH] perf/x86: Reject non sampling events with precise_ip
On Tue, Jan 03, 2017 at 10:40:59AM +0100, Peter Zijlstra wrote:
> On Wed, Dec 28, 2016 at 02:31:04PM +0100, Jiri Olsa wrote:
> > When in counting mode we setup the counter with the
> > longest possible period and read the value with read
> > syscall.
> >
> > We also still setup the PMI to be triggered when such
> > counter overflow to reconfigure it.
> >
> > We also get PEBS interrupt if such counter has precise_ip
> > set (which makes no sense, but it's possible).
>
> I think we should reject non sampling pebs events, as you say they make
> no sense what so ever.
ook, attached
jirka
---
As Peter suggested [1] rejecting non sampling PEBS events,
because they dont make any sense and could cause issues
in 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 <jolsa@...nel.org>
---
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 64582cfa6976..48b851f0ef89 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
--
2.9.3
Powered by blists - more mailing lists