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


Groups > linux.kernel > #1253098

Re: [PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr
Date 2015-10-21 20:10 +0200
Message-ID <qm5ZM-2ld-21@gated-at.bofh.it> (permalink)
References <qlK8W-3Ji-9@gated-at.bofh.it> <qlKiC-3V5-9@gated-at.bofh.it> <qm1CO-4fn-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Wed, Oct 21, 2015 at 03:27:42PM +0200, Peter Zijlstra escreveu:
> On Tue, Oct 20, 2015 at 11:46:35AM -0700, Andi Kleen wrote:
> > From: Andi Kleen <ak@linux.intel.com>
> > 
> > Automatically disable collecting branch flags and cycles with
> > --call-graph lbr. This allows avoiding a bunch of extra MSR
> > reads in the PMI on Skylake.
> > 
> > When the kernel doesn't support the new flags they are automatically
> > cleared in the fallback code.
> > 
> > Signed-off-by: Andi Kleen <ak@linux.intel.com>
> > ---
> 
> Arnaldo, ACK?

I looked at this yesterday, seems to follow the existing mechanisms for
fallbacking on older kernels, etc.

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 
> >  tools/perf/util/evsel.c | 14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > index 8be867c..e8724b4 100644
> > --- a/tools/perf/util/evsel.c
> > +++ b/tools/perf/util/evsel.c
> > @@ -36,6 +36,7 @@ static struct {
> >  	bool cloexec;
> >  	bool clockid;
> >  	bool clockid_wrong;
> > +	bool lbr_flags;
> >  } perf_missing_features;
> >  
> >  static clockid_t clockid;
> > @@ -573,7 +574,9 @@ perf_evsel__config_callgraph(struct perf_evsel *evsel,
> >  			} else {
> >  				perf_evsel__set_sample_bit(evsel, BRANCH_STACK);
> >  				attr->branch_sample_type = PERF_SAMPLE_BRANCH_USER |
> > -							PERF_SAMPLE_BRANCH_CALL_STACK;
> > +							PERF_SAMPLE_BRANCH_CALL_STACK |
> > +							PERF_SAMPLE_BRANCH_NO_CYCLES |
> > +							PERF_SAMPLE_BRANCH_NO_FLAGS;
> >  			}
> >  		} else
> >  			 pr_warning("Cannot use LBR callstack with branch stack. "
> > @@ -1312,6 +1315,9 @@ fallback_missing_features:
> >  		evsel->attr.mmap2 = 0;
> >  	if (perf_missing_features.exclude_guest)
> >  		evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
> > +	if (perf_missing_features.lbr_flags)
> > +		evsel->attr.branch_sample_type &= ~(PERF_SAMPLE_BRANCH_NO_FLAGS |
> > +				     PERF_SAMPLE_BRANCH_NO_CYCLES);
> >  retry_sample_id:
> >  	if (perf_missing_features.sample_id_all)
> >  		evsel->attr.sample_id_all = 0;
> > @@ -1414,6 +1420,12 @@ try_fallback:
> >  	} else if (!perf_missing_features.sample_id_all) {
> >  		perf_missing_features.sample_id_all = true;
> >  		goto retry_sample_id;
> > +	} else if (!perf_missing_features.lbr_flags &&
> > +			(evsel->attr.branch_sample_type &
> > +			 (PERF_SAMPLE_BRANCH_NO_CYCLES |
> > +			  PERF_SAMPLE_BRANCH_NO_FLAGS))) {
> > +		perf_missing_features.lbr_flags = true;
> > +		goto fallback_missing_features;
> >  	}
> >  
> >  out_close:
> > -- 
> > 2.4.3
> > 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] x86, perf: Fix LBR call stack save/restore Andi Kleen <andi@firstfloor.org> - 2015-10-20 20:50 +0200
  [PATCH 5/5] x86, perf: Avoid context switching LBR_INFO when not needed Andi Kleen <andi@firstfloor.org> - 2015-10-20 20:50 +0200
    Re: [PATCH 5/5] x86, perf: Avoid context switching LBR_INFO when not  needed Peter Zijlstra <peterz@infradead.org> - 2015-10-21 15:50 +0200
  [PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr Andi Kleen <andi@firstfloor.org> - 2015-10-20 21:00 +0200
    Re: [PATCH 3/5] perf, tools: Disable branch flags/cycles for  --callgraph lbr Peter Zijlstra <peterz@infradead.org> - 2015-10-21 15:30 +0200
      Re: [PATCH 3/5] perf, tools: Disable branch flags/cycles for  --callgraph lbr Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-21 20:10 +0200
  Re: [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Peter Zijlstra <peterz@infradead.org> - 2015-10-21 15:20 +0200
    Re: [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Andi Kleen <andi@firstfloor.org> - 2015-10-21 16:40 +0200
    Re: [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Ingo Molnar <mingo@kernel.org> - 2015-10-21 18:30 +0200

csiph-web