linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Jin, Yao" <yao.jin@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: acme@kernel.org, jolsa@kernel.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com,
	linuxppc-dev@lists.ozlabs.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v3 2/5] perf/x86/intel: Record branch type
Date: Tue, 11 Apr 2017 19:51:57 +0800	[thread overview]
Message-ID: <23293db8-cf4b-c7ec-b1d2-5d7bdad5bdbb@linux.intel.com> (raw)
In-Reply-To: <20170411081830.57372og2mzkhiftr@hirez.programming.kicks-ass.net>



On 4/11/2017 4:18 PM, Peter Zijlstra wrote:
> On Tue, Apr 11, 2017 at 09:52:19AM +0200, Peter Zijlstra wrote:
>> On Tue, Apr 11, 2017 at 06:56:30PM +0800, Jin Yao wrote:
>>> @@ -960,6 +1006,11 @@ intel_pmu_lbr_filter(struct cpu_hw_events *cpuc)
>>>   			cpuc->lbr_entries[i].from = 0;
>>>   			compress = true;
>>>   		}
>>> +
>>> +		if ((br_sel & X86_BR_TYPE_SAVE) == X86_BR_TYPE_SAVE)
>>> +			cpuc->lbr_entries[i].type = common_branch_type(type);
>>> +		else
>>> +			cpuc->lbr_entries[i].type = PERF_BR_NONE;
>>>   	}
> I was wondering WTH you did that else; because it should already be 0
> (aka, BR_NONE).

Yes. I will remove the else code. Thanks!

> Then I found intel_pmu_lbr_read_32() is already broken,
> and you just broke intel_pmu_lbr_read_64().
>
> Arguably we should add a union on the last __u64 with a name for the
> entire thing, but the below is the minimal fix.
>
> ---
> Subject: perf,x86: Avoid exposing wrong/stale data in intel_pmu_lbr_read_32()
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Tue Apr 11 10:10:28 CEST 2017
>
> When the perf_branch_entry::{in_tx,abort,cycles} fields were added,
> intel_pmu_lbr_read_32() wasn't updated to initialize them.
>
> Fixes: 135c5612c460 ("perf/x86/intel: Support Haswell/v4 LBR format")
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> --- a/arch/x86/events/intel/lbr.c
> +++ b/arch/x86/events/intel/lbr.c
> @@ -507,6 +507,9 @@ static void intel_pmu_lbr_read_32(struct
>   		cpuc->lbr_entries[i].to		= msr_lastbranch.to;
>   		cpuc->lbr_entries[i].mispred	= 0;
>   		cpuc->lbr_entries[i].predicted	= 0;
> +		cpuc->lbr_entries[i].in_tx	= 0;
> +		cpuc->lbr_entries[i].abort	= 0;
> +		cpuc->lbr_entries[i].cycles	= 0;
>   		cpuc->lbr_entries[i].reserved	= 0;
>   	}
>   	cpuc->lbr_stack.nr = i;

I will add cpuc->lbr_entries[i].type = 0 in my patch.

  reply	other threads:[~2017-04-11 11:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 10:56 [PATCH v3 0/5] perf report: Show branch type Jin Yao
2017-04-11 10:56 ` [PATCH v3 1/5] perf/core: Define the common branch type classification Jin Yao
2017-04-11 10:56 ` [PATCH v3 2/5] perf/x86/intel: Record branch type Jin Yao
2017-04-11  7:52   ` Peter Zijlstra
2017-04-11  8:11     ` Jin, Yao
2017-04-11  8:35       ` Peter Zijlstra
2017-04-11 11:37         ` Jin, Yao
2017-04-11  8:18     ` Peter Zijlstra
2017-04-11 11:51       ` Jin, Yao [this message]
2017-04-11 10:56 ` [PATCH v3 3/5] perf record: Create a new option save_type in --branch-filter Jin Yao
2017-04-11 10:56 ` [PATCH v3 4/5] perf report: Show branch type statistics for stdio mode Jin Yao
2017-04-11 10:56 ` [PATCH v3 5/5] perf report: Show branch type in callchain entry Jin Yao

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=23293db8-cf4b-c7ec-b1d2-5d7bdad5bdbb@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=yao.jin@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).