Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755217AbdGCPRL (ORCPT ); Mon, 3 Jul 2017 11:17:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755138AbdGCPQ5 (ORCPT ); Mon, 3 Jul 2017 11:16:57 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 26EB1624DD Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jolsa@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 26EB1624DD Date: Mon, 3 Jul 2017 17:16:54 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , lkml , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern , Thomas Richter Subject: [PATCHv2 01/15] perf tools: Fix -n option Message-ID: <20170703151654.GA16010@krava> References: <20170703145030.12903-1-jolsa@kernel.org> <20170703145030.12903-2-jolsa@kernel.org> <20170703145739.GA16278@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170703145739.GA16278@kernel.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 03 Jul 2017 15:16:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1953 Lines: 60 On Mon, Jul 03, 2017 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote: > Em Mon, Jul 03, 2017 at 04:50:16PM +0200, Jiri Olsa escreveu: > > The kernel fails to add a non sampling event event > > with having precise_ip set. > > > > Make sure the precise_ip is 0 when using -n option > > to create non sampling event in record. > > Ok, but how could that happen? What was the scenario? Which command? Can > you provide a command line that causes the problem? [jolsa@krava perf]$ ./perf record -e cycles:ppp -n ls Lowering default frequency rate to 3000. Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate. Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu). /bin/dmesg may provide additional information. No CONFIG_PERF_EVENTS=y kernel support configured? v2 attached, thanks jirka --- The kernel fails to add a non sampling event event with having precise_ip set, like: $ perf record -e cycles:ppp -n ls Error: The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles:pppu). /bin/dmesg may provide additional information. No CONFIG_PERF_EVENTS=y kernel support configured? Make sure the precise_ip is 0 when using -n option to create non sampling event in record. Link: http://lkml.kernel.org/n/tip-l513fzc1houvu7tl1bo5y65y@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/evsel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 6f4882f8d61f..915fe3cd6544 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -890,8 +890,10 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts, attr->sample_period = 0; } - if (opts->no_samples) + if (opts->no_samples) { attr->sample_freq = 0; + attr->precise_ip = 0; + } if (opts->inherit_stat) attr->inherit_stat = 1; -- 2.9.4