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


Groups > linux.kernel > #1680374 > unrolled thread

Re: [PATCH 01/15] perf tools: Fix -n option

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2017-07-03 17:00 +0200
Last post2017-07-03 19:50 +0200
Articles 7 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 01/15] perf tools: Fix -n option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-03 17:00 +0200
    [PATCHv2 01/15] perf tools: Fix -n option Jiri Olsa <jolsa@redhat.com> - 2017-07-03 17:20 +0200
      Re: [PATCHv2 01/15] perf tools: Fix -n option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-03 18:20 +0200
        Re: [PATCHv2 01/15] perf tools: Fix -n option Jiri Olsa <jolsa@redhat.com> - 2017-07-03 18:30 +0200
          Re: [PATCHv2 01/15] perf tools: Fix -n option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-03 18:50 +0200
            Re: [PATCHv2 01/15] perf tools: Fix -n option Jiri Olsa <jolsa@redhat.com> - 2017-07-03 19:00 +0200
              Re: [PATCHv2 01/15] perf tools: Fix -n option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-07-03 19:50 +0200

#1680374 — Re: [PATCH 01/15] perf tools: Fix -n option

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-07-03 17:00 +0200
SubjectRe: [PATCH 01/15] perf tools: Fix -n option
Message-ID<tZaZt-2UC-79@gated-at.bofh.it>
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?

I ask this because perhaps we should tell the user that what its being
asked on a command line doesn't make sense instead of dropping the
precise_ip as in your patch.

- Arnaldo
 
> Link: http://lkml.kernel.org/n/tip-l513fzc1houvu7tl1bo5y65y@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  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

[toc] | [next] | [standalone]


#1680431 — [PATCHv2 01/15] perf tools: Fix -n option

FromJiri Olsa <jolsa@redhat.com>
Date2017-07-03 17:20 +0200
Subject[PATCHv2 01/15] perf tools: Fix -n option
Message-ID<tZbiO-3ib-31@gated-at.bofh.it>
In reply to#1680374
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 <jolsa@kernel.org>
---
 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

[toc] | [prev] | [next] | [standalone]


#1680470 — Re: [PATCHv2 01/15] perf tools: Fix -n option

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-07-03 18:20 +0200
SubjectRe: [PATCHv2 01/15] perf tools: Fix -n option
Message-ID<tZceS-3TE-3@gated-at.bofh.it>
In reply to#1680431
Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> 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

Ok, so the user asks for --no-samples but at the same time asks for
precision equal to :ppp, we should stop right there and warn the user
that that is not possible, instead of silently dropping off what the
user explicitely asked.

I'm cooking a few patches to allow that, then we can apply your patch,
that, with the current set of users will never kick in :-)

- Arnaldo

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

[toc] | [prev] | [next] | [standalone]


#1680477 — Re: [PATCHv2 01/15] perf tools: Fix -n option

FromJiri Olsa <jolsa@redhat.com>
Date2017-07-03 18:30 +0200
SubjectRe: [PATCHv2 01/15] perf tools: Fix -n option
Message-ID<tZcox-3WY-15@gated-at.bofh.it>
In reply to#1680470
On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> > 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
> 
> Ok, so the user asks for --no-samples but at the same time asks for
> precision equal to :ppp, we should stop right there and warn the user
> that that is not possible, instead of silently dropping off what the
> user explicitely asked.

well I take this option more like debug/devel one.. you have
failing command line and want to investigate the kernel state
without having samples generated under your fingers

can't see why would normal user need it

> 
> I'm cooking a few patches to allow that, then we can apply your patch,
> that, with the current set of users will never kick in :-)


ok

jirka

[toc] | [prev] | [next] | [standalone]


#1680492 — Re: [PATCHv2 01/15] perf tools: Fix -n option

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-07-03 18:50 +0200
SubjectRe: [PATCHv2 01/15] perf tools: Fix -n option
Message-ID<tZcHU-43W-21@gated-at.bofh.it>
In reply to#1680477
Em Mon, Jul 03, 2017 at 06:22:28PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> > > 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
> > 
> > Ok, so the user asks for --no-samples but at the same time asks for
> > precision equal to :ppp, we should stop right there and warn the user
> > that that is not possible, instead of silently dropping off what the
> > user explicitely asked.
> 
> well I take this option more like debug/devel one.. you have
> failing command line and want to investigate the kernel state
> without having samples generated under your fingers
> 
> can't see why would normal user need it
> 
> > 
> > I'm cooking a few patches to allow that, then we can apply your patch,
> > that, with the current set of users will never kick in :-)

Take a look at:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=9f6e7e8bbb99feb6d721be7ccefb8c9139fa5abb

and:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=f9a4297945a99b47f92b111b5b1802a3b295a1a7

Its in my perf/core branch now.

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1680498 — Re: [PATCHv2 01/15] perf tools: Fix -n option

FromJiri Olsa <jolsa@redhat.com>
Date2017-07-03 19:00 +0200
SubjectRe: [PATCHv2 01/15] perf tools: Fix -n option
Message-ID<tZcRA-47B-11@gated-at.bofh.it>
In reply to#1680492
On Mon, Jul 03, 2017 at 01:40:01PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 03, 2017 at 06:22:28PM +0200, Jiri Olsa escreveu:
> > On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Jul 03, 2017 at 05:16:54PM +0200, Jiri Olsa escreveu:
> > > > 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
> > > 
> > > Ok, so the user asks for --no-samples but at the same time asks for
> > > precision equal to :ppp, we should stop right there and warn the user
> > > that that is not possible, instead of silently dropping off what the
> > > user explicitely asked.
> > 
> > well I take this option more like debug/devel one.. you have
> > failing command line and want to investigate the kernel state
> > without having samples generated under your fingers
> > 
> > can't see why would normal user need it
> > 
> > > 
> > > I'm cooking a few patches to allow that, then we can apply your patch,
> > > that, with the current set of users will never kick in :-)
> 
> Take a look at:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=9f6e7e8bbb99feb6d721be7ccefb8c9139fa5abb
> 
> and:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=f9a4297945a99b47f92b111b5b1802a3b295a1a7
> 
> Its in my perf/core branch now.

I think I'd just go for simple warning once we detect -n and :p
but if you think error is necessary I'll live ;-)

jirka

[toc] | [prev] | [next] | [standalone]


#1680516 — Re: [PATCHv2 01/15] perf tools: Fix -n option

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-07-03 19:50 +0200
SubjectRe: [PATCHv2 01/15] perf tools: Fix -n option
Message-ID<tZdDX-4Ft-9@gated-at.bofh.it>
In reply to#1680498
Em Mon, Jul 03, 2017 at 06:58:38PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 03, 2017 at 01:40:01PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jul 03, 2017 at 06:22:28PM +0200, Jiri Olsa escreveu:
> > > On Mon, Jul 03, 2017 at 01:10:04PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > Ok, so the user asks for --no-samples but at the same time asks for
> > > > precision equal to :ppp, we should stop right there and warn the user
> > > > that that is not possible, instead of silently dropping off what the
> > > > user explicitely asked.

> > > well I take this option more like debug/devel one.. you have
> > > failing command line and want to investigate the kernel state
> > > without having samples generated under your fingers

> > > can't see why would normal user need it

> > > > I'm cooking a few patches to allow that, then we can apply your patch,
> > > > that, with the current set of users will never kick in :-)

> > Take a look at:

> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=9f6e7e8bbb99feb6d721be7ccefb8c9139fa5abb

> > and:

> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=f9a4297945a99b47f92b111b5b1802a3b295a1a7

> > Its in my perf/core branch now.

> I think I'd just go for simple warning once we detect -n and :p
> but if you think error is necessary I'll live ;-)

Ok, so you don't find any error in my patches, good :-)

I don't like options that are developer-only-that-knows-what-is-doing,
nor things that get chopped up behind your feet, so I think the way I
did covers your case and provides meaningful error messages when an
invalid combination of options is used.

- Arnaldo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web