mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mingo@kernel.org, tglx@linutronix.de, ak@linux.intel.com,
	eranian@google.com, dzickus@redhat.com, andi@firstfloor.org,
	jmario@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] perf,x86: De-obfuscate HSW offcore bits
Date: Thu, 23 Oct 2014 14:16:19 +0200	[thread overview]
Message-ID: <20141023121619.GB4643@pd.tnic> (raw)
In-Reply-To: <20141023105658.111371548@infradead.org>

On Thu, Oct 23, 2014 at 12:51:20PM +0200, Peter Zijlstra wrote:
> Andi introduced the HSW cache events array, but used magic constants
> against convention as set by all the other uarchs. Try and deobfuscate
> these a bit.
> 
> This patch should not change the actual values generated; however
> weird they seems.
> 
> In that patch Andi also said there were differences between the
> SNB/IVB and HSW/BDW offcore tables but failed to specify which and
> why.
> 
> Fixes: 86a349a28b24 ("perf/x86/intel: Add Broadwell core support")
> Cc: Andi Kleen <ak@linux.intel.com>
> Cc: Stephane Eranian <eranian@google.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Link: http://lkml.kernel.org/n/tip-@git.kernel.org

This link looks funny.

> ---
>  arch/x86/kernel/cpu/perf_event_intel.c |   48 +++++++++++++++++++++++++++------
>  1 file changed, 40 insertions(+), 8 deletions(-)
> 
> --- a/arch/x86/kernel/cpu/perf_event_intel.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel.c
> @@ -247,6 +247,7 @@ static u64 intel_pmu_event_map(int hw_ev
>  #define SNB_BUS_LOCKS		(1ULL << 10)
>  #define SNB_STRM_ST		(1ULL << 11)
>  #define SNB_OTHER		(1ULL << 15)
> +
>  #define SNB_RESP_ANY		(1ULL << 16)
>  #define SNB_NO_SUPP		(1ULL << 17)
>  #define SNB_LLC_HITM		(1ULL << 18)
> @@ -255,6 +256,7 @@ static u64 intel_pmu_event_map(int hw_ev
>  #define SNB_LLC_HITF		(1ULL << 21)
>  #define SNB_LOCAL		(1ULL << 22)
>  #define SNB_REMOTE		(0xffULL << 23)
> +
>  #define SNB_SNP_NONE		(1ULL << 31)
>  #define SNB_SNP_NOT_NEEDED	(1ULL << 32)
>  #define SNB_SNP_MISS		(1ULL << 33)
> @@ -519,6 +521,40 @@ static __initconst const u64 hsw_hw_cach
>   },
>  };
>  
> +/* HSW Request type */
> +#define HSW_DMND_DATA_RD	(1ULL << 0)
> +#define HSW_DMND_RFO		(1ULL << 1)
> +#define HSW_DMND_IFETCH		(1ULL << 2)
> +
> +#define HSW_PF_DATA_RD		(1ULL << 4)
> +#define HSW_PF_RFO		(1ULL << 5)
> +#define HSW_PF_IFETCH		(1ULL << 6)
> +
> +#define HSW_OTHER		(1ULL << 15)
> +
> +/* HSW Supplier info := SNB Supplier info */
> +/* HSW Snoop Info := SNB Snoop Info */
> +
> +/*
> + * SNB_LLC_* is specified as 'reserved' in the SDM
> + * but Andi added it anyhow, suggesting HSW/BDW have it just fine
> + *
> + * XXX NHM/WSM/SNB/IVB don't have the PF/IFETCH bits set
> + */
> +#define HSW_DMND_READ		(HSW_DMND_DATA_RD|HSW_DMND_IFETCH| \
> +				 HSW_PF_DATA_RD|HSW_PF_IFETCH| \
> +				 SNB_LLC_DATA_RD|SNB_LLC_IFETCH)
> +
> +/* XXX NHM/WSM/SNB/IVB dont have the PF bits set */
> +#define HSW_DMND_WRITE		(HSW_DMND_RFO|HSW_PF_RFO|SNB_LLC_RFO)
> +
> +#define HSW_DMND_PREFETCH	(0) /* XXX broken ? */
> +
> +#define HSW_DRAM_ANY		(SNB_NO_SUPP|SNB_SNP_ANY|(0x78ULL << 23)) /* WTF */
> +
> +#define HSW_L3_ACCESS		(0) /* XXX no supplier! */
> +#define NSW_L3_MISS		(HSW_DRAM_ANY|SNB_NON_DRAM)

You probably mean HSW and not NSW here...

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2014-10-23 12:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 10:51 [PATCH 0/4] Attempt to cleanup the " Peter Zijlstra
2014-10-23 10:51 ` [PATCH 1/4] perf,x86: De-obfuscate " Peter Zijlstra
2014-10-23 12:16   ` Borislav Petkov [this message]
2014-10-23 13:13     ` Peter Zijlstra
2014-10-23 10:51 ` [PATCH 2/4] perf,x86: HSW offcore prefetch events Peter Zijlstra
2014-10-23 10:51 ` [PATCH 3/4] perf,x86: Attempt to sanitize the HSW supplier info Peter Zijlstra
2014-10-23 10:51 ` [PATCH 4/4] perf,x86: Introduce HSW cache numa events Peter Zijlstra
2014-10-27 12:23 ` [PATCH 0/4] Attempt to cleanup the HSW offcore bits Andi Kleen
2014-10-27 13:07   ` Peter Zijlstra
2014-10-27 14:28     ` Andi Kleen
2014-10-27 14:48       ` Peter Zijlstra
2014-10-28 21:53       ` Thomas Gleixner
2014-10-29 11:00         ` Ingo Molnar

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=20141023121619.GB4643@pd.tnic \
    --to=bp@alien8.de \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=jmario@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®