Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1549811

[PATCH] perf/x86: Reject non sampling events with precise_ip

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] perf/x86: Reject non sampling events with precise_ip
Date 2017-01-03 15:30 +0100
Message-ID <sVyga-7AS-25@gated-at.bofh.it> (permalink)
References <sTmCt-n7-5@gated-at.bofh.it> <sTmCt-n7-11@gated-at.bofh.it> <sVtTb-4n9-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@kernel.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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/4] perf/x86: Fix period for non sampling events Jiri Olsa <jolsa@kernel.org> - 2016-12-28 14:40 +0100
  Re: [PATCH 2/4] perf/x86: Fix period for non sampling events Peter Zijlstra <peterz@infradead.org> - 2017-01-03 10:50 +0100
    [PATCH] perf/x86: Reject non sampling events with precise_ip Jiri Olsa <jolsa@redhat.com> - 2017-01-03 15:30 +0100
      Re: [PATCH] perf/x86: Reject non sampling events with precise_ip Vince Weaver <vince@deater.net> - 2017-01-03 23:10 +0100
      [tip:perf/urgent] perf/x86: Reject non sampling events with  precise_ip tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-01-14 13:40 +0100
  Re: [PATCH 2/4] perf/x86: Fix period for non sampling events Peter Zijlstra <peterz@infradead.org> - 2017-01-03 16:20 +0100
    Re: [PATCH 2/4] perf/x86: Fix period for non sampling events Jiri Olsa <jolsa@redhat.com> - 2017-01-03 16:30 +0100

csiph-web