All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf script: Fix printing 'phys_addr' failure issue
@ 2022-01-21  6:59 Wei Li
  2022-01-21 11:24 ` German Gomez
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Li @ 2022-01-21  6:59 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim
  Cc: Peter Zijlstra, Ingo Molnar, linux-perf-users, linux-kernel,
	guohanjun, jinyao5

From: Yao Jin <jinyao5@huawei.com>

Perf script was failed to print the phys_addr for SPE profiling.
One 'dummy' event is added by SPE profiling but it doesn't have PHYS_ADDR
attribute set, perf script then exits with error.

Now referring to 'addr', use evsel__do_check_stype() to check the type.

Before:

  # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
  # perf script -F pid,tid,addr,phys_addr
  Samples for 'dummy:u' event do not have PHYS_ADDR attribute set. Cannot print 'phys_addr' field.

After:

  # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
  # perf script -F pid,tid,addr,phys_addr
  4064384/4064384 ffff802f921be0d0      2f921be0d0
  4064384/4064384 ffff802f921be0d0      2f921be0d0

Signed-off-by: Yao Jin <jinyao5@huawei.com>
Signed-off-by: Wei Li <liwei391@huawei.com>
---
 tools/perf/builtin-script.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index ecd4f99a6c14..abae8184e171 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -515,7 +515,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
 		return -EINVAL;
 
 	if (PRINT_FIELD(PHYS_ADDR) &&
-	    evsel__check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR))
+	    evsel__do_check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR, allow_user_set))
 		return -EINVAL;
 
 	if (PRINT_FIELD(DATA_PAGE_SIZE) &&
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf script: Fix printing 'phys_addr' failure issue
  2022-01-21  6:59 [PATCH] perf script: Fix printing 'phys_addr' failure issue Wei Li
@ 2022-01-21 11:24 ` German Gomez
  2022-01-22 20:04   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: German Gomez @ 2022-01-21 11:24 UTC (permalink / raw)
  To: Wei Li, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim
  Cc: Peter Zijlstra, Ingo Molnar, linux-perf-users, linux-kernel,
	guohanjun, jinyao5

Hi Wei,

This looks good to me. As a followup we could also fix the 'weight'
field, which was introduced recently.

On 21/01/2022 06:59, Wei Li wrote:
> From: Yao Jin <jinyao5@huawei.com>
>
> Perf script was failed to print the phys_addr for SPE profiling.
> One 'dummy' event is added by SPE profiling but it doesn't have PHYS_ADDR
> attribute set, perf script then exits with error.
>
> Now referring to 'addr', use evsel__do_check_stype() to check the type.
>
> Before:
>
>   # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
> 		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
>   # perf script -F pid,tid,addr,phys_addr
>   Samples for 'dummy:u' event do not have PHYS_ADDR attribute set. Cannot print 'phys_addr' field.
>
> After:
>
>   # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
> 		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
>   # perf script -F pid,tid,addr,phys_addr
>   4064384/4064384 ffff802f921be0d0      2f921be0d0
>   4064384/4064384 ffff802f921be0d0      2f921be0d0
>
> Signed-off-by: Yao Jin <jinyao5@huawei.com>
> Signed-off-by: Wei Li <liwei391@huawei.com>

Reviewed-by: German Gomez <german.gomez@arm.com>

Also it looks like the SPE samples are also missing the PHYS_ADDR flag.
I think we'll need to fix the consistency of the flags.

Many thanks,
German

> ---
>  tools/perf/builtin-script.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index ecd4f99a6c14..abae8184e171 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -515,7 +515,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
>  		return -EINVAL;
>  
>  	if (PRINT_FIELD(PHYS_ADDR) &&
> -	    evsel__check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR))
> +	    evsel__do_check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR, allow_user_set))
>  		return -EINVAL;
>  
>  	if (PRINT_FIELD(DATA_PAGE_SIZE) &&

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf script: Fix printing 'phys_addr' failure issue
  2022-01-21 11:24 ` German Gomez
@ 2022-01-22 20:04   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-01-22 20:04 UTC (permalink / raw)
  To: German Gomez
  Cc: Wei Li, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Ingo Molnar, linux-perf-users,
	linux-kernel, guohanjun, jinyao5

Em Fri, Jan 21, 2022 at 11:24:57AM +0000, German Gomez escreveu:
> Hi Wei,
> 
> This looks good to me. As a followup we could also fix the 'weight'
> field, which was introduced recently.
> 
> On 21/01/2022 06:59, Wei Li wrote:
> > From: Yao Jin <jinyao5@huawei.com>
> >
> > Perf script was failed to print the phys_addr for SPE profiling.
> > One 'dummy' event is added by SPE profiling but it doesn't have PHYS_ADDR
> > attribute set, perf script then exits with error.
> >
> > Now referring to 'addr', use evsel__do_check_stype() to check the type.
> >
> > Before:
> >
> >   # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
> > 		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
> >   # perf script -F pid,tid,addr,phys_addr
> >   Samples for 'dummy:u' event do not have PHYS_ADDR attribute set. Cannot print 'phys_addr' field.
> >
> > After:
> >
> >   # perf record -e arm_spe_0/branch_filter=0,ts_enable=1,pa_enable=1,load_filter=1,jitter=0,\
> > 		store_filter=0,min_latency=0,event_filter=2/ -p 4064384 -- sleep 3
> >   # perf script -F pid,tid,addr,phys_addr
> >   4064384/4064384 ffff802f921be0d0      2f921be0d0
> >   4064384/4064384 ffff802f921be0d0      2f921be0d0
> >
> > Signed-off-by: Yao Jin <jinyao5@huawei.com>
> > Signed-off-by: Wei Li <liwei391@huawei.com>
> 
> Reviewed-by: German Gomez <german.gomez@arm.com>
> 
> Also it looks like the SPE samples are also missing the PHYS_ADDR flag.
> I think we'll need to fix the consistency of the flags.

Thanks, applied.

- Arnaldo

 
> Many thanks,
> German
> 
> > ---
> >  tools/perf/builtin-script.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> > index ecd4f99a6c14..abae8184e171 100644
> > --- a/tools/perf/builtin-script.c
> > +++ b/tools/perf/builtin-script.c
> > @@ -515,7 +515,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session)
> >  		return -EINVAL;
> >  
> >  	if (PRINT_FIELD(PHYS_ADDR) &&
> > -	    evsel__check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR))
> > +	    evsel__do_check_stype(evsel, PERF_SAMPLE_PHYS_ADDR, "PHYS_ADDR", PERF_OUTPUT_PHYS_ADDR, allow_user_set))
> >  		return -EINVAL;
> >  
> >  	if (PRINT_FIELD(DATA_PAGE_SIZE) &&

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-22 20:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21  6:59 [PATCH] perf script: Fix printing 'phys_addr' failure issue Wei Li
2022-01-21 11:24 ` German Gomez
2022-01-22 20:04   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.