public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "Ingo Molnar" <mingo@elte.hu>, "Andi Kleen" <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Mike Galbraith" <efault@gmx.de>,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Steven Rostedt" <rostedt@goodmis.org>
Subject: Re: [PATCH] perf events, x86: Implement Sandybridge last-level cache events
Date: Tue, 10 May 2011 22:17:58 +0800	[thread overview]
Message-ID: <1305037078.2226.18.camel@localhost> (raw)
In-Reply-To: <1305022112.2914.40.camel@laptop>

On Tue, 2011-05-10 at 18:08 +0800, Peter Zijlstra wrote:
> On Mon, 2011-05-09 at 16:39 +0800, Lin Ming wrote:
> 
> >  
> > +/*
> > + * Sandy Bridge MSR_OFFCORE_RESPONSE bits;
> > + * See IA32 SDM Vol 3B 30.8.5
> > + */
> > +
> > +#define SNB_DMND_DATA_RD	(1ULL << 0)
> > +#define SNB_DMND_RFO		(1ULL << 1)
> > +#define SNB_DMND_IFETCH		(1ULL << 2)
> > +#define SNB_DMND_WB		(1ULL << 3)
> > +#define SNB_PF_DATA_RD		(1ULL << 4)
> > +#define SNB_PF_DATA_RFO		(1ULL << 5)
> > +#define SNB_PF_IFETCH		(1ULL << 6)
> > +#define SNB_PF_LLC_DATA_RD	(1ULL << 7)
> > +#define SNB_PF_LLC_RFO		(1ULL << 8)
> > +#define SNB_PF_LLC_IFETCH	(1ULL << 9)
> > +#define SNB_BUS_LOCKS		(1ULL << 10)
> > +#define SNB_STRM_ST		(1ULL << 11)
> > +				/* hole */
> > +#define SNB_OFFCORE_OTHER	(1ULL << 15)
> > +#define SNB_COMMON		(1ULL << 16)
> > +#define SNB_NO_SUPP		(1ULL << 17)
> > +#define SNB_LLC_HITM		(1ULL << 18)
> > +#define SNB_LLC_HITE		(1ULL << 19)
> > +#define SNB_LLC_HITS		(1ULL << 20)
> > +#define SNB_LLC_HITF		(1ULL << 21)
> > +				/* hole */
> > +#define SNB_SNP_NONE		(1ULL << 31)
> > +#define SNB_SNP_NOT_NEEDED	(1ULL << 32)
> > +#define SNB_SNP_MISS		(1ULL << 33)
> > +#define SNB_SNP_NO_FWD		(1ULL << 34)
> > +#define SNB_SNP_FWD		(1ULL << 35)
> > +#define SNB_HITM		(1ULL << 36)
> > +#define SNB_NON_DRAM		(1ULL << 37)
> > +
> > +#define SNB_DMND_READ		(SNB_DMND_DATA_RD)
> > +#define SNB_DMND_WRITE		(SNB_DMND_RFO | SNB_DMND_WB|SNB_STRM_ST)
> > +#define SNB_DMND_PREFETCH	(SNB_PF_DATA_RD | SNB_PF_DATA_RFO)
> > +
> > +#define SNB_SUPPLIER_INFO	(SNB_NO_SUPP | SNB_LLC_HITM | SNB_LLC_HITE | \
> > +				 SNB_LLC_HITS | SNB_LLC_HITF)
> > +
> > +#define SNB_L3_HIT		(SNB_SUPPLIER_INFO | SNB_SNP_NOT_NEEDED | SNB_SNP_NO_FWD | SNB_HITM)
> > +#define SNB_L3_MISS		(SNB_SUPPLIER_INFO | SNB_SNP_MISS | SNB_SNP_FWD | SNB_NON_DRAM)
> > +#define SNB_L3_ACCESS		(SNB_L3_HIT | SNB_L3_MISS)
> 
> I would very much like to know how these bits work.. Since the SDM
> doesn't explain anything could you please add a big comment explaining
> things?

I'm also not sure if the bits combination do count exactly L3_HIT/_MISS.

The manual has below statements,

"To specify a complete offcore response filter, software must properly
program bits in the request and response type fields. A valid request
type must have at least one bit set in the non-reserved bits of 15:0. A
valid response type must be a non-zero value of the following
expression:

ANY | [(‘OR’ of Supplier Info Bits) & (‘OR’ of Snoop Info Bits)]
If “ANY“ bit is set, the supplier and snoop info bits are ignored."

So I defined SNB_L3_HIT and SNB_L3_MISS with ANY bit cleared, and
Supplier Info Bits and Snoop Info Bits set.

But again, I'm not sure if the combination is correct.
May need some micro-benchmarks to verify it.

Thanks,
Lin Ming
> 
> Otherwise the patch looks good, but unverifiable so for me.
> 
> > +static __initconst const u64 snb_hw_cache_extra_regs
> > +				[PERF_COUNT_HW_CACHE_MAX]
> > +				[PERF_COUNT_HW_CACHE_OP_MAX]
> > +				[PERF_COUNT_HW_CACHE_RESULT_MAX] =
> > +{
> > + [ C(LL  ) ] = {
> > +	[ C(OP_READ) ] = {
> > +		[ C(RESULT_ACCESS) ] = SNB_DMND_READ | SNB_L3_ACCESS,
> > +		[ C(RESULT_MISS)   ] = SNB_DMND_READ | SNB_L3_MISS,
> > +	},
> > +	[ C(OP_WRITE) ] = {
> > +		[ C(RESULT_ACCESS) ] = SNB_DMND_WRITE | SNB_L3_ACCESS,
> > +		[ C(RESULT_MISS)   ] = SNB_DMND_WRITE | SNB_L3_MISS,
> > +	},
> > +	[ C(OP_PREFETCH) ] = {
> > +		[ C(RESULT_ACCESS) ] = SNB_DMND_PREFETCH | SNB_L3_ACCESS,
> > +		[ C(RESULT_MISS)   ] = SNB_DMND_PREFETCH | SNB_L3_MISS,
> > +	},
> > + }
> > +};
> 



  reply	other threads:[~2011-05-10 14:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-09  8:39 [PATCH] perf events, x86: Implement Sandybridge last-level cache events Lin Ming
2011-05-10 10:08 ` Peter Zijlstra
2011-05-10 14:17   ` Lin Ming [this message]
2011-05-10 14:29     ` Peter Zijlstra
2011-05-10 15:29       ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2011-05-06  7:14 [PATCH] perf events, x86: Add SandyBridge stalled-cycles-frontend/backend events Lin Ming
2011-05-06  7:38 ` Ingo Molnar
2011-05-06  9:19   ` [PATCH] perf events, x86: Implement Sandybridge last-level cache events Ingo Molnar
2011-05-06 13:47     ` Lin Ming
2011-05-09  8:45       ` Lin Ming

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=1305037078.2226.18.camel@localhost \
    --to=ming.m.lin@intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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