Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1676727 > unrolled thread
| Started by | kan.liang@intel.com |
|---|---|
| First post | 2017-06-28 16:40 +0200 |
| Last post | 2017-06-29 17:40 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] perf tools: set no branch type for dummy event in PT kan.liang@intel.com - 2017-06-28 16:40 +0200
Re: [PATCH] perf tools: set no branch type for dummy event in PT Jiri Olsa <jolsa@redhat.com> - 2017-06-29 17:30 +0200
Re: [PATCH] perf tools: set no branch type for dummy event in PT Jiri Olsa <jolsa@redhat.com> - 2017-06-29 17:40 +0200
RE: [PATCH] perf tools: set no branch type for dummy event in PT "Liang, Kan" <kan.liang@intel.com> - 2017-06-29 18:00 +0200
Re: [PATCH] perf tools: set no branch type for dummy event in PT Jiri Olsa <jolsa@redhat.com> - 2017-06-30 09:10 +0200
RE: [PATCH] perf tools: set no branch type for dummy event in PT "Liang, Kan" <kan.liang@intel.com> - 2017-06-30 16:10 +0200
RE: [PATCH] perf tools: set no branch type for dummy event in PT "Liang, Kan" <kan.liang@intel.com> - 2017-06-29 17:40 +0200
| From | kan.liang@intel.com |
|---|---|
| Date | 2017-06-28 16:40 +0200 |
| Subject | [PATCH] perf tools: set no branch type for dummy event in PT |
| Message-ID | <tXmim-7Xs-21@gated-at.bofh.it> |
From: Kan Liang <kan.liang@intel.com>
An earlier kernel patch allowed enabling PT and LBR at the same
time on Goldmont.
commit ccbebba4c6bf ("perf/x86/intel/pt: Bypass PT vs. LBR
exclusivity if the core supports it")
However, users still cannot use Intel PT and LBRs simultaneously.
$ sudo perf record -e cycles,intel_pt//u -b -- sleep 1
Error:
PMU Hardware doesn't support sampling/overflow-interrupts.
PT implicitly adds dummy event in perf tool. dummy event is
software event which doesn't support LBR.
Always setting branch_type=no for dummy event in Intel PT.
Signed-off-by: Kan Liang <kan.liang@intel.com>
---
tools/perf/arch/x86/util/intel-pt.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index f630de0..651ab9e 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -544,6 +544,22 @@ static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu,
evsel->attr.config);
}
+static int add_no_lbr_config_term(struct list_head *config_terms)
+{
+ struct perf_evsel_config_term *lbr_term;
+
+ lbr_term = zalloc(sizeof(*lbr_term));
+ if (!lbr_term)
+ return -ENOMEM;
+
+ INIT_LIST_HEAD(&lbr_term->list);
+ lbr_term->type = PERF_EVSEL__CONFIG_TERM_BRANCH;
+ lbr_term->val.branch = strdup("no");
+ list_add_tail(&lbr_term->list, config_terms);
+
+ return 0;
+}
+
static int intel_pt_recording_options(struct auxtrace_record *itr,
struct perf_evlist *evlist,
struct record_opts *opts)
@@ -701,6 +717,8 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
perf_evsel__set_sample_bit(switch_evsel, TIME);
perf_evsel__set_sample_bit(switch_evsel, CPU);
+ add_no_lbr_config_term(&switch_evsel->config_terms);
+
opts->record_switch_events = false;
ptr->have_sched_switch = 3;
} else {
@@ -760,6 +778,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
/* And the CPU for switch events */
perf_evsel__set_sample_bit(tracking_evsel, CPU);
}
+ add_no_lbr_config_term(&tracking_evsel->config_terms);
}
/*
--
2.9.4
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2017-06-29 17:30 +0200 |
| Message-ID | <tXJyj-P8-43@gated-at.bofh.it> |
| In reply to | #1676727 |
On Wed, Jun 28, 2017 at 10:31:53AM -0400, kan.liang@intel.com wrote:
> From: Kan Liang <kan.liang@intel.com>
>
> An earlier kernel patch allowed enabling PT and LBR at the same
> time on Goldmont.
> commit ccbebba4c6bf ("perf/x86/intel/pt: Bypass PT vs. LBR
> exclusivity if the core supports it")
> However, users still cannot use Intel PT and LBRs simultaneously.
> $ sudo perf record -e cycles,intel_pt//u -b -- sleep 1
> Error:
> PMU Hardware doesn't support sampling/overflow-interrupts.
>
> PT implicitly adds dummy event in perf tool. dummy event is
> software event which doesn't support LBR.
>
> Always setting branch_type=no for dummy event in Intel PT.
>
> Signed-off-by: Kan Liang <kan.liang@intel.com>
> ---
> tools/perf/arch/x86/util/intel-pt.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
> index f630de0..651ab9e 100644
> --- a/tools/perf/arch/x86/util/intel-pt.c
> +++ b/tools/perf/arch/x86/util/intel-pt.c
> @@ -544,6 +544,22 @@ static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu,
> evsel->attr.config);
> }
>
> +static int add_no_lbr_config_term(struct list_head *config_terms)
> +{
> + struct perf_evsel_config_term *lbr_term;
> +
> + lbr_term = zalloc(sizeof(*lbr_term));
> + if (!lbr_term)
> + return -ENOMEM;
> +
> + INIT_LIST_HEAD(&lbr_term->list);
> + lbr_term->type = PERF_EVSEL__CONFIG_TERM_BRANCH;
> + lbr_term->val.branch = strdup("no");
> + list_add_tail(&lbr_term->list, config_terms);
> +
> + return 0;
> +}
> +
> static int intel_pt_recording_options(struct auxtrace_record *itr,
> struct perf_evlist *evlist,
> struct record_opts *opts)
> @@ -701,6 +717,8 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
> perf_evsel__set_sample_bit(switch_evsel, TIME);
> perf_evsel__set_sample_bit(switch_evsel, CPU);
>
> + add_no_lbr_config_term(&switch_evsel->config_terms);
> +
hum, why can't you change the sample bit directly? with:
perf_evsel__reset_sample_bit(switch_evsel, BRANCH_STACK);
jirka
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2017-06-29 17:40 +0200 |
| Message-ID | <tXJHZ-Sn-35@gated-at.bofh.it> |
| In reply to | #1677869 |
On Thu, Jun 29, 2017 at 03:31:45PM +0000, Liang, Kan wrote: SNIP > > > static int intel_pt_recording_options(struct auxtrace_record *itr, > > > struct perf_evlist *evlist, > > > struct record_opts *opts) > > > @@ -701,6 +717,8 @@ static int intel_pt_recording_options(struct > > auxtrace_record *itr, > > > perf_evsel__set_sample_bit(switch_evsel, > > TIME); > > > perf_evsel__set_sample_bit(switch_evsel, > > CPU); > > > > > > + add_no_lbr_config_term(&switch_evsel- > > >config_terms); > > > + > > > > hum, why can't you change the sample bit directly? with: > > > > perf_evsel__reset_sample_bit(switch_evsel, > > BRANCH_STACK); > > It will be overwrite in perf_evsel__config. > where? you set the evsel->no_aux_samples jirka
[toc] | [prev] | [next] | [standalone]
| From | "Liang, Kan" <kan.liang@intel.com> |
|---|---|
| Date | 2017-06-29 18:00 +0200 |
| Message-ID | <tXK1m-11t-45@gated-at.bofh.it> |
| In reply to | #1677877 |
> > On Thu, Jun 29, 2017 at 03:31:45PM +0000, Liang, Kan wrote: > > SNIP > > > > > static int intel_pt_recording_options(struct auxtrace_record *itr, > > > > struct perf_evlist *evlist, > > > > struct record_opts *opts) @@ -701,6 > +717,8 @@ static > > > > int intel_pt_recording_options(struct > > > auxtrace_record *itr, > > > > perf_evsel__set_sample_bit(switch_evsel, > > > TIME); > > > > perf_evsel__set_sample_bit(switch_evsel, > > > CPU); > > > > > > > > + add_no_lbr_config_term(&switch_evsel- > > > >config_terms); > > > > + > > > > > > hum, why can't you change the sample bit directly? with: > > > > > > perf_evsel__reset_sample_bit(switch_evsel, > > > BRANCH_STACK); > > > > It will be overwrite in perf_evsel__config. > > > > where? you set the evsel->no_aux_samples Yes for switch_evsel, but no for tracking_evsel. If it's only for switch_evsel, yes, we can change the sample bit directly. But I think we should use the same method for both of them. Thanks, Kan
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2017-06-30 09:10 +0200 |
| Message-ID | <tXYdY-2mX-27@gated-at.bofh.it> |
| In reply to | #1677901 |
On Thu, Jun 29, 2017 at 03:50:29PM +0000, Liang, Kan wrote: > > > > > > On Thu, Jun 29, 2017 at 03:31:45PM +0000, Liang, Kan wrote: > > > > SNIP > > > > > > > static int intel_pt_recording_options(struct auxtrace_record *itr, > > > > > struct perf_evlist *evlist, > > > > > struct record_opts *opts) @@ -701,6 > > +717,8 @@ static > > > > > int intel_pt_recording_options(struct > > > > auxtrace_record *itr, > > > > > perf_evsel__set_sample_bit(switch_evsel, > > > > TIME); > > > > > perf_evsel__set_sample_bit(switch_evsel, > > > > CPU); > > > > > > > > > > + add_no_lbr_config_term(&switch_evsel- > > > > >config_terms); > > > > > + > > > > > > > > hum, why can't you change the sample bit directly? with: > > > > > > > > perf_evsel__reset_sample_bit(switch_evsel, > > > > BRANCH_STACK); > > > > > > It will be overwrite in perf_evsel__config. > > > > > > > where? you set the evsel->no_aux_samples > > Yes for switch_evsel, but no for tracking_evsel. > > If it's only for switch_evsel, yes, we can change the sample bit directly. > But I think we should use the same method for both of them. we could set the no_aux_samples for the tracking_evsel as well jirka
[toc] | [prev] | [next] | [standalone]
| From | "Liang, Kan" <kan.liang@intel.com> |
|---|---|
| Date | 2017-06-30 16:10 +0200 |
| Message-ID | <tY4Mp-6tC-9@gated-at.bofh.it> |
| In reply to | #1678546 |
> On Thu, Jun 29, 2017 at 03:50:29PM +0000, Liang, Kan wrote: > > > > > > > > > > On Thu, Jun 29, 2017 at 03:31:45PM +0000, Liang, Kan wrote: > > > > > > SNIP > > > > > > > > > static int intel_pt_recording_options(struct auxtrace_record *itr, > > > > > > struct perf_evlist *evlist, > > > > > > struct record_opts *opts) @@ - > 701,6 > > > +717,8 @@ static > > > > > > int intel_pt_recording_options(struct > > > > > auxtrace_record *itr, > > > > > > > perf_evsel__set_sample_bit(switch_evsel, > > > > > TIME); > > > > > > > perf_evsel__set_sample_bit(switch_evsel, > > > > > CPU); > > > > > > > > > > > > + > add_no_lbr_config_term(&switch_evsel- > > > > > >config_terms); > > > > > > + > > > > > > > > > > hum, why can't you change the sample bit directly? with: > > > > > > > > > > perf_evsel__reset_sample_bit(switch_evsel, > > > > > BRANCH_STACK); > > > > > > > > It will be overwrite in perf_evsel__config. > > > > > > > > > > where? you set the evsel->no_aux_samples > > > > Yes for switch_evsel, but no for tracking_evsel. > > > > If it's only for switch_evsel, yes, we can change the sample bit directly. > > But I think we should use the same method for both of them. > > > we could set the no_aux_samples for the tracking_evsel as well > Yes, I will do it in next version. Thanks, Kan
[toc] | [prev] | [next] | [standalone]
| From | "Liang, Kan" <kan.liang@intel.com> |
|---|---|
| Date | 2017-06-29 17:40 +0200 |
| Message-ID | <tXJHZ-Sn-37@gated-at.bofh.it> |
| In reply to | #1677869 |
> On Wed, Jun 28, 2017 at 10:31:53AM -0400, kan.liang@intel.com wrote:
> > From: Kan Liang <kan.liang@intel.com>
> >
> > An earlier kernel patch allowed enabling PT and LBR at the same time
> > on Goldmont.
> > commit ccbebba4c6bf ("perf/x86/intel/pt: Bypass PT vs. LBR exclusivity
> > if the core supports it") However, users still cannot use Intel PT and
> > LBRs simultaneously.
> > $ sudo perf record -e cycles,intel_pt//u -b -- sleep 1
> > Error:
> > PMU Hardware doesn't support sampling/overflow-interrupts.
> >
> > PT implicitly adds dummy event in perf tool. dummy event is software
> > event which doesn't support LBR.
> >
> > Always setting branch_type=no for dummy event in Intel PT.
> >
> > Signed-off-by: Kan Liang <kan.liang@intel.com>
> > ---
> > tools/perf/arch/x86/util/intel-pt.c | 19 +++++++++++++++++++
> > 1 file changed, 19 insertions(+)
> >
> > diff --git a/tools/perf/arch/x86/util/intel-pt.c
> > b/tools/perf/arch/x86/util/intel-pt.c
> > index f630de0..651ab9e 100644
> > --- a/tools/perf/arch/x86/util/intel-pt.c
> > +++ b/tools/perf/arch/x86/util/intel-pt.c
> > @@ -544,6 +544,22 @@ static int intel_pt_validate_config(struct perf_pmu
> *intel_pt_pmu,
> > evsel->attr.config);
> > }
> >
> > +static int add_no_lbr_config_term(struct list_head *config_terms) {
> > + struct perf_evsel_config_term *lbr_term;
> > +
> > + lbr_term = zalloc(sizeof(*lbr_term));
> > + if (!lbr_term)
> > + return -ENOMEM;
> > +
> > + INIT_LIST_HEAD(&lbr_term->list);
> > + lbr_term->type = PERF_EVSEL__CONFIG_TERM_BRANCH;
> > + lbr_term->val.branch = strdup("no");
> > + list_add_tail(&lbr_term->list, config_terms);
> > +
> > + return 0;
> > +}
> > +
> > static int intel_pt_recording_options(struct auxtrace_record *itr,
> > struct perf_evlist *evlist,
> > struct record_opts *opts)
> > @@ -701,6 +717,8 @@ static int intel_pt_recording_options(struct
> auxtrace_record *itr,
> > perf_evsel__set_sample_bit(switch_evsel,
> TIME);
> > perf_evsel__set_sample_bit(switch_evsel,
> CPU);
> >
> > + add_no_lbr_config_term(&switch_evsel-
> >config_terms);
> > +
>
> hum, why can't you change the sample bit directly? with:
>
> perf_evsel__reset_sample_bit(switch_evsel,
> BRANCH_STACK);
It will be overwrite in perf_evsel__config.
Thanks,
Kan
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web