From: Peter Zijlstra <peterz@infradead.org>
To: David Carrillo-Cisneros <davidcc@google.com>
Cc: linux-kernel@vger.kernel.org, "x86@kernel.org" <x86@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
"Yan, Zheng" <zheng.z.yan@intel.com>,
Andi Kleen <ak@linux.intel.com>, Kan Liang <kan.liang@intel.com>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 2/3] perf/x86/intel: fix for MSR_LAST_BRANCH_FROM_x quirk when no TSX
Date: Thu, 2 Jun 2016 10:37:28 +0200 [thread overview]
Message-ID: <20160602083728.GR3193@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1464835323-33872-3-git-send-email-davidcc@google.com>
On Wed, Jun 01, 2016 at 07:42:02PM -0700, David Carrillo-Cisneros wrote:
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index a5e52ad4..1ce172d 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -3309,6 +3309,7 @@ static void intel_snb_check_microcode(void)
> static bool check_msr(unsigned long msr, u64 mask)
> {
> u64 val_old, val_new, val_tmp;
> + u64 (*wr_quirk)(u64);
>
> /*
> * Read the current value, change it and read it back to see if it
> @@ -3322,13 +3323,30 @@ static bool check_msr(unsigned long msr, u64 mask)
> * Only change the bits which can be updated by wrmsrl.
> */
> val_tmp = val_old ^ mask;
> +
> + /* Use wr quirk for lbr msr's. */
> + if ((x86_pmu.lbr_from <= msr &&
> + msr < x86_pmu.lbr_from + x86_pmu.lbr_nr) ||
> + (x86_pmu.lbr_to <= msr &&
> + msr < x86_pmu.lbr_to + x86_pmu.lbr_nr))
> + wr_quirk = lbr_from_signext_quirk_wr;
This is unreadable code..
static inline bool within(unsigned long msr, unsigned long base, unsigned long size)
{
return base <= msr && msr < base + size;
}
static inline bool is_lbr_msr(unsigned long msr)
{
if (within(msr, x86_pmu.lbr_from, x86_pmu.lbr_nr))
return true;
if (within(msr, x86_pmu.lbr_to, x86_pmu.lbr_nr))
return true;
return false;
}
Yes, its a few more lines, but its bloody obvious what it does at any
time of the day.
Also, seeing how the write quirk is for the LBR_FROM only, wth are you
testing against _TO too?
next prev parent reply other threads:[~2016-06-02 8:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 2:42 [PATCH 0/3] fix MSR_LAST_BRANCH_FROM Haswell support David Carrillo-Cisneros
2016-06-02 2:42 ` [PATCH 1/3] perf/x86/intel: output LBR support statement after validation David Carrillo-Cisneros
2016-06-02 8:21 ` Peter Zijlstra
2016-06-02 16:04 ` Andi Kleen
2016-06-02 17:28 ` Stephane Eranian
2016-06-06 1:59 ` Andi Kleen
2016-06-08 7:27 ` Stephane Eranian
2016-06-08 9:08 ` Andi Kleen
2016-06-02 2:42 ` [PATCH 2/3] perf/x86/intel: fix for MSR_LAST_BRANCH_FROM_x quirk when no TSX David Carrillo-Cisneros
2016-06-02 8:23 ` Peter Zijlstra
2016-06-02 8:37 ` Peter Zijlstra [this message]
2016-06-02 8:53 ` Peter Zijlstra
[not found] ` <CALcN6mhMsNHgRVuYmYsE+O+Neq6PcaDy1-ARzBd=Vej=0rHr0Q@mail.gmail.com>
2016-06-03 9:21 ` Peter Zijlstra
2016-06-02 8:54 ` Peter Zijlstra
2016-06-02 8:55 ` Peter Zijlstra
2016-06-02 16:07 ` Andi Kleen
2016-06-02 2:42 ` [PATCH 3/3] perf, perf/tool: trigger lbr_from signext bug David Carrillo-Cisneros
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=20160602083728.GR3193@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ak@linux.intel.com \
--cc=davidcc@google.com \
--cc=eranian@google.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=x86@kernel.org \
--cc=zheng.z.yan@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).