From: Peter Zijlstra <peterz@infradead.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr
Date: Wed, 21 Oct 2015 15:27:42 +0200 [thread overview]
Message-ID: <20151021132742.GF3604@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1445366797-30894-3-git-send-email-andi@firstfloor.org>
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?
> 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
>
next prev parent reply other threads:[~2015-10-21 13:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 18:46 [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Andi Kleen
2015-10-20 18:46 ` [PATCH 2/5] x86, perf: Add option to disable reading branch flags/cycles Andi Kleen
2015-11-23 16:25 ` [tip:perf/core] perf/x86: " tip-bot for Andi Kleen
2015-10-20 18:46 ` [PATCH 3/5] perf, tools: Disable branch flags/cycles for --callgraph lbr Andi Kleen
2015-10-21 13:27 ` Peter Zijlstra [this message]
2015-10-21 18:04 ` Arnaldo Carvalho de Melo
2015-10-20 18:46 ` [PATCH 4/5] perf, tools: Print branch filter state with -vv Andi Kleen
2015-10-20 18:51 ` Arnaldo Carvalho de Melo
2015-10-21 8:27 ` Peter Zijlstra
2015-10-22 9:23 ` [tip:perf/core] perf evsel: " tip-bot for Andi Kleen
2015-10-20 18:46 ` [PATCH 5/5] x86, perf: Avoid context switching LBR_INFO when not needed Andi Kleen
2015-10-21 13:44 ` Peter Zijlstra
2015-10-21 13:13 ` [PATCH 1/5] x86, perf: Fix LBR call stack save/restore Peter Zijlstra
2015-10-21 14:35 ` Andi Kleen
2015-10-21 16:24 ` Ingo Molnar
2015-11-23 16:20 ` [tip:perf/core] perf/x86: " tip-bot for Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151021132742.GF3604@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome