Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-10-02 Thread leo . yan
On Tue, Oct 02, 2018 at 11:24:56AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sat, Sep 29, 2018 at 03:39:03PM +0800, leo@linaro.org escreveu:
> > On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > > > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > > > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > > > as well.  This patch is to document only for intel_pt, later if we
> > > > enable this feature on Arm platform we need to change the doc;
> > > > alternatively we can use more general description for these two options
> > > > at the first place.  How about you think for this?
> > > 
> > > Likely it already works for CoreSight
> > 
> > I think Kim played with this patch series and he also pointed me for
> > this series.
> > 
> > > I specified intel_pt, because if we just say traces the users won't
> > > know what PMU to specify for record. Being too abstract is
> > > often not helpful.
> > > 
> > > If someone successfully tests it on CoreSight they could submit
> > > a patch to the documentation to add "or " to these
> > > two cases. That would make it then clear for those users too.
> > 
> > Okay, agree.
> > 
> > Actually I applied your patch series v6 on the perf latest core branch
> > and tested on Arm Juno board, I observed there have couple issues, one
> > is CoreSight trace data doesn't support timestamp so I need to use
> > '-F,-time' to workaround the command failure; another issue is now
> > CoreSight is absent to set sample flags so perf fails to resolve
> > symbols [1]; these two issues are only related with CoreSight decoder
> > and it's no matter with this patch, so I didn't mention in my previous
> > replying.
> 
> Could I take that as a Tested-by? I.e. you actually applied the patches,
> run it and saw that it works as advertised, right?

Yes, Arnaldo.  This is my testing tag:

Tested-by: Leo Yan 

> - Arnaldo
>  
> > I need a bit more time to work out more formal CoreSight fixing patches
> > and will send for reviewing (also will include one patch to clarifying
> > Arm Coresight support in doc as suggested).
> > 
> > Thanks,
> > Leo Yan
> > 
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-10-02 Thread leo . yan
On Tue, Oct 02, 2018 at 11:24:56AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sat, Sep 29, 2018 at 03:39:03PM +0800, leo@linaro.org escreveu:
> > On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > > > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > > > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > > > as well.  This patch is to document only for intel_pt, later if we
> > > > enable this feature on Arm platform we need to change the doc;
> > > > alternatively we can use more general description for these two options
> > > > at the first place.  How about you think for this?
> > > 
> > > Likely it already works for CoreSight
> > 
> > I think Kim played with this patch series and he also pointed me for
> > this series.
> > 
> > > I specified intel_pt, because if we just say traces the users won't
> > > know what PMU to specify for record. Being too abstract is
> > > often not helpful.
> > > 
> > > If someone successfully tests it on CoreSight they could submit
> > > a patch to the documentation to add "or " to these
> > > two cases. That would make it then clear for those users too.
> > 
> > Okay, agree.
> > 
> > Actually I applied your patch series v6 on the perf latest core branch
> > and tested on Arm Juno board, I observed there have couple issues, one
> > is CoreSight trace data doesn't support timestamp so I need to use
> > '-F,-time' to workaround the command failure; another issue is now
> > CoreSight is absent to set sample flags so perf fails to resolve
> > symbols [1]; these two issues are only related with CoreSight decoder
> > and it's no matter with this patch, so I didn't mention in my previous
> > replying.
> 
> Could I take that as a Tested-by? I.e. you actually applied the patches,
> run it and saw that it works as advertised, right?

Yes, Arnaldo.  This is my testing tag:

Tested-by: Leo Yan 

> - Arnaldo
>  
> > I need a bit more time to work out more formal CoreSight fixing patches
> > and will send for reviewing (also will include one patch to clarifying
> > Arm Coresight support in doc as suggested).
> > 
> > Thanks,
> > Leo Yan
> > 
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-10-02 Thread Arnaldo Carvalho de Melo
Em Sat, Sep 29, 2018 at 03:39:03PM +0800, leo@linaro.org escreveu:
> On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > > as well.  This patch is to document only for intel_pt, later if we
> > > enable this feature on Arm platform we need to change the doc;
> > > alternatively we can use more general description for these two options
> > > at the first place.  How about you think for this?
> > 
> > Likely it already works for CoreSight
> 
> I think Kim played with this patch series and he also pointed me for
> this series.
> 
> > I specified intel_pt, because if we just say traces the users won't
> > know what PMU to specify for record. Being too abstract is
> > often not helpful.
> > 
> > If someone successfully tests it on CoreSight they could submit
> > a patch to the documentation to add "or " to these
> > two cases. That would make it then clear for those users too.
> 
> Okay, agree.
> 
> Actually I applied your patch series v6 on the perf latest core branch
> and tested on Arm Juno board, I observed there have couple issues, one
> is CoreSight trace data doesn't support timestamp so I need to use
> '-F,-time' to workaround the command failure; another issue is now
> CoreSight is absent to set sample flags so perf fails to resolve
> symbols [1]; these two issues are only related with CoreSight decoder
> and it's no matter with this patch, so I didn't mention in my previous
> replying.

Could I take that as a Tested-by? I.e. you actually applied the patches,
run it and saw that it works as advertised, right?

- Arnaldo
 
> I need a bit more time to work out more formal CoreSight fixing patches
> and will send for reviewing (also will include one patch to clarifying
> Arm Coresight support in doc as suggested).
> 
> Thanks,
> Leo Yan
> 
> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-10-02 Thread Arnaldo Carvalho de Melo
Em Sat, Sep 29, 2018 at 03:39:03PM +0800, leo@linaro.org escreveu:
> On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > > as well.  This patch is to document only for intel_pt, later if we
> > > enable this feature on Arm platform we need to change the doc;
> > > alternatively we can use more general description for these two options
> > > at the first place.  How about you think for this?
> > 
> > Likely it already works for CoreSight
> 
> I think Kim played with this patch series and he also pointed me for
> this series.
> 
> > I specified intel_pt, because if we just say traces the users won't
> > know what PMU to specify for record. Being too abstract is
> > often not helpful.
> > 
> > If someone successfully tests it on CoreSight they could submit
> > a patch to the documentation to add "or " to these
> > two cases. That would make it then clear for those users too.
> 
> Okay, agree.
> 
> Actually I applied your patch series v6 on the perf latest core branch
> and tested on Arm Juno board, I observed there have couple issues, one
> is CoreSight trace data doesn't support timestamp so I need to use
> '-F,-time' to workaround the command failure; another issue is now
> CoreSight is absent to set sample flags so perf fails to resolve
> symbols [1]; these two issues are only related with CoreSight decoder
> and it's no matter with this patch, so I didn't mention in my previous
> replying.

Could I take that as a Tested-by? I.e. you actually applied the patches,
run it and saw that it works as advertised, right?

- Arnaldo
 
> I need a bit more time to work out more formal CoreSight fixing patches
> and will send for reviewing (also will include one patch to clarifying
> Arm Coresight support in doc as suggested).
> 
> Thanks,
> Leo Yan
> 
> [1] 
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-29 Thread leo . yan
On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > as well.  This patch is to document only for intel_pt, later if we
> > enable this feature on Arm platform we need to change the doc;
> > alternatively we can use more general description for these two options
> > at the first place.  How about you think for this?
> 
> Likely it already works for CoreSight

I think Kim played with this patch series and he also pointed me for
this series.

> I specified intel_pt, because if we just say traces the users won't
> know what PMU to specify for record. Being too abstract is
> often not helpful.
> 
> If someone successfully tests it on CoreSight they could submit
> a patch to the documentation to add "or " to these
> two cases. That would make it then clear for those users too.

Okay, agree.

Actually I applied your patch series v6 on the perf latest core branch
and tested on Arm Juno board, I observed there have couple issues, one
is CoreSight trace data doesn't support timestamp so I need to use
'-F,-time' to workaround the command failure; another issue is now
CoreSight is absent to set sample flags so perf fails to resolve
symbols [1]; these two issues are only related with CoreSight decoder
and it's no matter with this patch, so I didn't mention in my previous
replying.

I need a bit more time to work out more formal CoreSight fixing patches
and will send for reviewing (also will include one patch to clarifying
Arm Coresight support in doc as suggested).

Thanks,
Leo Yan

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-29 Thread leo . yan
On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > as well.  This patch is to document only for intel_pt, later if we
> > enable this feature on Arm platform we need to change the doc;
> > alternatively we can use more general description for these two options
> > at the first place.  How about you think for this?
> 
> Likely it already works for CoreSight

I think Kim played with this patch series and he also pointed me for
this series.

> I specified intel_pt, because if we just say traces the users won't
> know what PMU to specify for record. Being too abstract is
> often not helpful.
> 
> If someone successfully tests it on CoreSight they could submit
> a patch to the documentation to add "or " to these
> two cases. That would make it then clear for those users too.

Okay, agree.

Actually I applied your patch series v6 on the perf latest core branch
and tested on Arm Juno board, I observed there have couple issues, one
is CoreSight trace data doesn't support timestamp so I need to use
'-F,-time' to workaround the command failure; another issue is now
CoreSight is absent to set sample flags so perf fails to resolve
symbols [1]; these two issues are only related with CoreSight decoder
and it's no matter with this patch, so I didn't mention in my previous
replying.

I need a bit more time to work out more formal CoreSight fixing patches
and will send for reviewing (also will include one patch to clarifying
Arm Coresight support in doc as suggested).

Thanks,
Leo Yan

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-28 Thread Andi Kleen
> Seems to me, these two features are _NOT_ only benefit for intel_pt,
> other hardware tracing (e.g. Arm CoreSight) can enable these features
> as well.  This patch is to document only for intel_pt, later if we
> enable this feature on Arm platform we need to change the doc;
> alternatively we can use more general description for these two options
> at the first place.  How about you think for this?

Likely it already works for CoreSight

I specified intel_pt, because if we just say traces the users won't
know what PMU to specify for record. Being too abstract is
often not helpful.

If someone successfully tests it on CoreSight they could submit
a patch to the documentation to add "or " to these
two cases. That would make it then clear for those users too.

-Andi


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-28 Thread Andi Kleen
> Seems to me, these two features are _NOT_ only benefit for intel_pt,
> other hardware tracing (e.g. Arm CoreSight) can enable these features
> as well.  This patch is to document only for intel_pt, later if we
> enable this feature on Arm platform we need to change the doc;
> alternatively we can use more general description for these two options
> at the first place.  How about you think for this?

Likely it already works for CoreSight

I specified intel_pt, because if we just say traces the users won't
know what PMU to specify for record. Being too abstract is
often not helpful.

If someone successfully tests it on CoreSight they could submit
a patch to the documentation to add "or " to these
two cases. That would make it then clear for those users too.

-Andi


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-28 Thread leo . yan
Hi Andi,

On Thu, Sep 20, 2018 at 11:05:38AM -0700, Andi Kleen wrote:
> From: Andi Kleen 
> 
> Add short cut options to print PT call trace and call-ret-trace,
> for calls and call and returns. Roughly corresponds to ftrace
> function tracer and function graph tracer.
> 
> Just makes these common use cases nicer to use.
> 
> % perf record -a -e intel_pt// sleep 1
> % perf script --call-trace
>   perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> perf_pmu_enable
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> __x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> event_filter_match
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> group_sched_in
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   __x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   event_sched_in.isra.107
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_event_set_state.part.71
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_event_update_time
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_pmu_disable
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_log_itrace_start
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   __x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_event_update_userpage
> 
> % perf script --call-ret-trace
>   perf   900 [000] 194167.205652203:   tr strt ([unknown])
> pt_config
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])pt_config
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])pt_event_add
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])perf_pmu_enable
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])perf_pmu_nop_void
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])event_sched_in.isra.107
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])__x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])perf_pmu_nop_int
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])group_sched_in
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])event_filter_match
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])event_filter_match
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])group_sched_in
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])__x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])perf_pmu_nop_txn
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])event_sched_in.isra.107
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])perf_event_set_state.part.71
> 
> Signed-off-by: Andi Kleen 
> ---
> v2: Print errors, power, ptwrite too
> ---
>  tools/perf/Documentation/perf-script.txt |  7 +++
>  tools/perf/builtin-script.c  | 24 
>  2 files changed, 31 insertions(+)
> 
> diff --git a/tools/perf/Documentation/perf-script.txt 
> b/tools/perf/Documentation/perf-script.txt
> index 00c655ab4968..805baabd238e 100644
> --- a/tools/perf/Documentation/perf-script.txt
> +++ b/tools/perf/Documentation/perf-script.txt
> @@ -390,6 +390,13 @@ include::itrace.txt[]
>  --xed::
>   Run xed disassembler on output. Requires installing the xed 
> disassembler.
>  
> +--call-trace::
> + Show call stream for intel_pt traces. The CPUs are interleaved, but
> + can be filtered with -C.
> +
> +--call-ret-trace::
> + Show call and return stream for intel_pt traces.

Seems to me, these two features are _NOT_ only benefit for intel_pt,
other hardware tracing (e.g. Arm CoreSight) can enable these features
as well.  This patch is to document only for intel_pt, later if we
enable this feature on Arm platform we need to change the doc;
alternatively we can use more general description for these two options
at the first place.  How about you think for this?

Except this question, this patch looks good for me.

Thanks,
Leo Yan

>  SEE ALSO
>  
>  linkperf:perf-record[1], linkperf:perf-script-perl[1],
> diff --git 

Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-09-28 Thread leo . yan
Hi Andi,

On Thu, Sep 20, 2018 at 11:05:38AM -0700, Andi Kleen wrote:
> From: Andi Kleen 
> 
> Add short cut options to print PT call trace and call-ret-trace,
> for calls and call and returns. Roughly corresponds to ftrace
> function tracer and function graph tracer.
> 
> Just makes these common use cases nicer to use.
> 
> % perf record -a -e intel_pt// sleep 1
> % perf script --call-trace
>   perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> perf_pmu_enable
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> __x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> event_filter_match
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])  
> group_sched_in
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   __x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   event_sched_in.isra.107
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_event_set_state.part.71
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_event_update_time
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_pmu_disable
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_log_itrace_start
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   __x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203: ([kernel.kallsyms])
>   perf_event_update_userpage
> 
> % perf script --call-ret-trace
>   perf   900 [000] 194167.205652203:   tr strt ([unknown])
> pt_config
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])pt_config
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])pt_event_add
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])perf_pmu_enable
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])perf_pmu_nop_void
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])event_sched_in.isra.107
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])__x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])perf_pmu_nop_int
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])group_sched_in
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])event_filter_match
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])event_filter_match
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])group_sched_in
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])__x86_indirect_thunk_rax
> perf   900 [000] 194167.205652203:   return  
> ([kernel.kallsyms])perf_pmu_nop_txn
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])event_sched_in.isra.107
> perf   900 [000] 194167.205652203:   call
> ([kernel.kallsyms])perf_event_set_state.part.71
> 
> Signed-off-by: Andi Kleen 
> ---
> v2: Print errors, power, ptwrite too
> ---
>  tools/perf/Documentation/perf-script.txt |  7 +++
>  tools/perf/builtin-script.c  | 24 
>  2 files changed, 31 insertions(+)
> 
> diff --git a/tools/perf/Documentation/perf-script.txt 
> b/tools/perf/Documentation/perf-script.txt
> index 00c655ab4968..805baabd238e 100644
> --- a/tools/perf/Documentation/perf-script.txt
> +++ b/tools/perf/Documentation/perf-script.txt
> @@ -390,6 +390,13 @@ include::itrace.txt[]
>  --xed::
>   Run xed disassembler on output. Requires installing the xed 
> disassembler.
>  
> +--call-trace::
> + Show call stream for intel_pt traces. The CPUs are interleaved, but
> + can be filtered with -C.
> +
> +--call-ret-trace::
> + Show call and return stream for intel_pt traces.

Seems to me, these two features are _NOT_ only benefit for intel_pt,
other hardware tracing (e.g. Arm CoreSight) can enable these features
as well.  This patch is to document only for intel_pt, later if we
enable this feature on Arm platform we need to change the doc;
alternatively we can use more general description for these two options
at the first place.  How about you think for this?

Except this question, this patch looks good for me.

Thanks,
Leo Yan

>  SEE ALSO
>  
>  linkperf:perf-record[1], linkperf:perf-script-perl[1],
> diff --git