Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1437914 > unrolled thread

[PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

Started by"Fenghua Yu" <fenghua.yu@intel.com>
First post2016-07-06 21:10 +0200
Last post2016-07-08 20:10 +0200
Articles 11 — 5 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id "Fenghua Yu" <fenghua.yu@intel.com> - 2016-07-06 21:10 +0200
    Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id Ingo Molnar <mingo@kernel.org> - 2016-07-08 10:50 +0200
      RE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id "Yu, Fenghua" <fenghua.yu@intel.com> - 2016-07-08 19:10 +0200
        RE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id "Luck, Tony" <tony.luck@intel.com> - 2016-07-08 19:30 +0200
          Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id Ingo Molnar <mingo@kernel.org> - 2016-07-08 20:10 +0200
            Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id Borislav Petkov <bp@suse.de> - 2016-07-08 20:50 +0200
              RE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id "Luck, Tony" <tony.luck@intel.com> - 2016-07-08 20:50 +0200
                Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id Borislav Petkov <bp@suse.de> - 2016-07-08 21:00 +0200
                  Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id Ingo Molnar <mingo@kernel.org> - 2016-07-08 21:40 +0200
                    Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id Borislav Petkov <bp@suse.de> - 2016-07-09 10:20 +0200
        Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for  cache id Ingo Molnar <mingo@kernel.org> - 2016-07-08 20:10 +0200

#1437914 — [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

From"Fenghua Yu" <fenghua.yu@intel.com>
Date2016-07-06 21:10 +0200
Subject[PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rS0mR-4Im-9@gated-at.bofh.it>
From: Fenghua Yu <fenghua.yu@intel.com>

Add an ABI document entry for /sys/devices/system/cpu/cpu*/cache/index*/id.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
 Documentation/ABI/testing/sysfs-devices-system-cpu | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
index 1650133..cc62034 100644
--- a/Documentation/ABI/testing/sysfs-devices-system-cpu
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -272,6 +272,19 @@ Description:	Parameters for the CPU cache attributes
 				     the modified cache line is written to main
 				     memory only when it is replaced
 
+
+What:		/sys/devices/system/cpu/cpu*/cache/index*/id
+Date:		July 2016
+Contact:	Linux kernel mailing list <linux-kernel@vger.kernel.org>
+Description:	Cache id
+
+		The id identifies a cache in the platform. In same index, the id
+		is unique across the platform.
+
+		Currently id is implemented on x86. On other platforms, id is
+		not enabled yet.
+
+
 What:		/sys/devices/system/cpu/cpuX/cpufreq/throttle_stats
 		/sys/devices/system/cpu/cpuX/cpufreq/throttle_stats/turbo_stat
 		/sys/devices/system/cpu/cpuX/cpufreq/throttle_stats/sub_turbo_stat
-- 
2.5.0

[toc] | [next] | [standalone]


#1439177 — Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

FromIngo Molnar <mingo@kernel.org>
Date2016-07-08 10:50 +0200
SubjectRe: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSzDX-2k6-9@gated-at.bofh.it>
In reply to#1437914
* Fenghua Yu <fenghua.yu@intel.com> wrote:

> From: Fenghua Yu <fenghua.yu@intel.com>
> 
> Add an ABI document entry for /sys/devices/system/cpu/cpu*/cache/index*/id.
> 
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> ---
>  Documentation/ABI/testing/sysfs-devices-system-cpu | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
> index 1650133..cc62034 100644
> --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
> +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
> @@ -272,6 +272,19 @@ Description:	Parameters for the CPU cache attributes
>  				     the modified cache line is written to main
>  				     memory only when it is replaced
>  
> +
> +What:		/sys/devices/system/cpu/cpu*/cache/index*/id
> +Date:		July 2016
> +Contact:	Linux kernel mailing list <linux-kernel@vger.kernel.org>
> +Description:	Cache id
> +
> +		The id identifies a cache in the platform. In same index, the id
> +		is unique across the platform.

What does 'In same index' mean?

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1439687 — RE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

From"Yu, Fenghua" <fenghua.yu@intel.com>
Date2016-07-08 19:10 +0200
SubjectRE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSHrQ-7Gk-29@gated-at.bofh.it>
In reply to#1439177
> From: Ingo Molnar [mailto:mingo.kernel.org@gmail.com] On Behalf Of Ingo
> Molnar
> Sent: Friday, July 08, 2016 1:42 AM
> * Fenghua Yu <fenghua.yu@intel.com> wrote:
> 
> > From: Fenghua Yu <fenghua.yu@intel.com>
> >
> > Add an ABI document entry for
> /sys/devices/system/cpu/cpu*/cache/index*/id.
> >
> > Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> > ---
> >  Documentation/ABI/testing/sysfs-devices-system-cpu | 13
> +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu
> b/Documentation/ABI/testing/sysfs-devices-system-cpu
> > index 1650133..cc62034 100644
> > --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
> > +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
> > @@ -272,6 +272,19 @@ Description:	Parameters for the CPU cache
> attributes
> >  				     the modified cache line is written to main
> >  				     memory only when it is replaced
> >
> > +
> > +What:		/sys/devices/system/cpu/cpu*/cache/index*/id
> > +Date:		July 2016
> > +Contact:	Linux kernel mailing list <linux-kernel@vger.kernel.org>
> > +Description:	Cache id
> > +
> > +		The id identifies a cache in the platform. In same index, the id
> > +		is unique across the platform.
> 
> What does 'In same index' mean?

It means one cache's id is unique in all caches with same cache index number. For example, in all caches with index3 (i.e. level3), cache id 0 is unique to identify a L3 cache. But in caches with index 0 (i.e. Level0), there is also a cache id 0. So cache id is unique in one index. But not unique in two different index.

Does that make sense? I hope I express that correctly.

Thanks.

-Fenghua

[toc] | [prev] | [next] | [standalone]


#1439709 — RE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

From"Luck, Tony" <tony.luck@intel.com>
Date2016-07-08 19:30 +0200
SubjectRE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSHLc-7Oc-25@gated-at.bofh.it>
In reply to#1439687
> It means one cache's id is unique in all caches with same cache index number.
> For example, in all caches with index3 (i.e. level3), cache id 0 is unique to identify
> a L3 cache. But in caches with index 0 (i.e. Level0), there is also a cache id 0.
> So cache id is unique in one index. But not unique in two different index.

> Does that make sense? I hope I express that correctly.

We use "index" rather than "level" because that is the terminology used
in /sys/devices/system/cpu/cpu*/cache/index*

E.g. on most Intel cpus you'll typically find "index0" is the L1-data cache,
"index1" is the L1-instruction cache, "index3" is the L2-unified cache and
"index4" is the L3-unified cache.

-Tony

[toc] | [prev] | [next] | [standalone]


#1439727 — Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

FromIngo Molnar <mingo@kernel.org>
Date2016-07-08 20:10 +0200
SubjectRe: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSInU-8iq-5@gated-at.bofh.it>
In reply to#1439709
* Luck, Tony <tony.luck@intel.com> wrote:

> > It means one cache's id is unique in all caches with same cache index number.
> > For example, in all caches with index3 (i.e. level3), cache id 0 is unique to identify
> > a L3 cache. But in caches with index 0 (i.e. Level0), there is also a cache id 0.
> > So cache id is unique in one index. But not unique in two different index.
> 
> > Does that make sense? I hope I express that correctly.
> 
> We use "index" rather than "level" because that is the terminology used
> in /sys/devices/system/cpu/cpu*/cache/index*

Who can we ... thank for that nonsensical naming? :-/

> E.g. on most Intel cpus you'll typically find "index0" is the L1-data cache, 
> "index1" is the L1-instruction cache, "index3" is the L2-unified cache and 
> "index4" is the L3-unified cache.

Crazy. What was wrong with using 'level' or 'depth'?

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1439742 — Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

FromBorislav Petkov <bp@suse.de>
Date2016-07-08 20:50 +0200
SubjectRe: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSJ0B-5b-5@gated-at.bofh.it>
In reply to#1439727
On Fri, Jul 08, 2016 at 08:07:46PM +0200, Ingo Molnar wrote:
> Who can we ... thank for that nonsensical naming? :-/
> 
> > E.g. on most Intel cpus you'll typically find "index0" is the L1-data cache, 
> > "index1" is the L1-instruction cache, "index3" is the L2-unified cache and 
> > "index4" is the L3-unified cache.
> 
> Crazy. What was wrong with using 'level' or 'depth'?

It is all there:

$ grep . /sys/devices/system/cpu/cpu0/cache/index?/level
/sys/devices/system/cpu/cpu0/cache/index0/level:1
/sys/devices/system/cpu/cpu0/cache/index1/level:1
/sys/devices/system/cpu/cpu0/cache/index2/level:2
/sys/devices/system/cpu/cpu0/cache/index3/level:3
$ grep . /sys/devices/system/cpu/cpu0/cache/index?/type
/sys/devices/system/cpu/cpu0/cache/index0/type:Data
/sys/devices/system/cpu/cpu0/cache/index1/type:Instruction
/sys/devices/system/cpu/cpu0/cache/index2/type:Unified
/sys/devices/system/cpu/cpu0/cache/index3/type:Unified



for i in /sys/devices/system/cpu/cpu0/cache/index?;
do
	l=$(cat $i/level)
	t=$(cat $i/type)

	printf "L%d-%s\n" $l $t
done

->

L1-Data
L1-Instruction
L2-Unified
L3-Unified

I believe the index naming is simply enumerating the caches...

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1439745 — RE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

From"Luck, Tony" <tony.luck@intel.com>
Date2016-07-08 20:50 +0200
SubjectRE: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSJ0C-5b-19@gated-at.bofh.it>
In reply to#1439742
> > > "index4" is the L3-unified cache.
> > 
> > Crazy. What was wrong with using 'level' or 'depth'?
>
> It is all there:
>
> $ grep . /sys/devices/system/cpu/cpu0/cache/index?/level
> /sys/devices/system/cpu/cpu0/cache/index0/level:1

The term "index" came from the Intel Software developer manual, volume
2, description of CPUID instruction which talks about the index into leaf
and sub leaf.  I think Ingo might have been making a small dig at Intel
documentation :-)

-Tony
 

[toc] | [prev] | [next] | [standalone]


#1439751 — Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

FromBorislav Petkov <bp@suse.de>
Date2016-07-08 21:00 +0200
SubjectRe: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSJai-91-9@gated-at.bofh.it>
In reply to#1439745
On Fri, Jul 08, 2016 at 06:47:33PM +0000, Luck, Tony wrote:
> The term "index" came from the Intel Software developer manual, volume
> 2, description of CPUID instruction which talks about the index into leaf
> and sub leaf.

Ah, CPUID(4) - the caches description loop :-)

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1439759 — Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

FromIngo Molnar <mingo@kernel.org>
Date2016-07-08 21:40 +0200
SubjectRe: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSJMZ-CK-3@gated-at.bofh.it>
In reply to#1439751
Yeah, so if the 'cache index' naming has already been settled, then I suspect 
we'll have to live with it - but at least let's name it 'cache-index' when we 
refer to it, not just 'index' which is super confusing (to me!).

I.e. instead:

  The id identifies a cache in the platform. In same index, the id
  is unique across the platform.

Something like this is more readable I think:

  The cache-id identifies a hardware cache of the system within a given
  cache-index category of caches. The (cache-index,cache-id) pair is
  unique for the whole system.

agreed?

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1439911 — Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

FromBorislav Petkov <bp@suse.de>
Date2016-07-09 10:20 +0200
SubjectRe: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSVEt-mL-1@gated-at.bofh.it>
In reply to#1439759
On Fri, Jul 08, 2016 at 09:34:57PM +0200, Ingo Molnar wrote:
>   The cache-id identifies a hardware cache of the system within a given
>   cache-index category of caches. The (cache-index,cache-id) pair is

I'd say something like:

   "... within a given cache index in a set of cache indices. The
   "index" name is simply a nomenclature from CPUID's leaf 4 which
   enumerates all caches on the system by referring to each one as a
   cache index. ... "

Because this way we hint at from where the "index" thing comes and
people can go and read the SDM for more info.

And also we're explaining what it is because, IMHO, whatever formulation
or spelling we do with "cache index", there's simply not a good way of
explaining what it means without *actually* explaining it and where it
comes from.

:-)

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

[toc] | [prev] | [next] | [standalone]


#1439729 — Re: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id

FromIngo Molnar <mingo@kernel.org>
Date2016-07-08 20:10 +0200
SubjectRe: [PATCH v2 2/3] Documentation, ABI: Add a document entry for cache id
Message-ID<rSInU-8iq-11@gated-at.bofh.it>
In reply to#1439687
* Yu, Fenghua <fenghua.yu@intel.com> wrote:

> > From: Ingo Molnar [mailto:mingo.kernel.org@gmail.com] On Behalf Of Ingo
> > Molnar
> > Sent: Friday, July 08, 2016 1:42 AM
> > * Fenghua Yu <fenghua.yu@intel.com> wrote:
> > 
> > > From: Fenghua Yu <fenghua.yu@intel.com>
> > >
> > > Add an ABI document entry for
> > /sys/devices/system/cpu/cpu*/cache/index*/id.
> > >
> > > Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> > > ---
> > >  Documentation/ABI/testing/sysfs-devices-system-cpu | 13
> > +++++++++++++
> > >  1 file changed, 13 insertions(+)
> > >
> > > diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu
> > b/Documentation/ABI/testing/sysfs-devices-system-cpu
> > > index 1650133..cc62034 100644
> > > --- a/Documentation/ABI/testing/sysfs-devices-system-cpu
> > > +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
> > > @@ -272,6 +272,19 @@ Description:	Parameters for the CPU cache
> > attributes
> > >  				     the modified cache line is written to main
> > >  				     memory only when it is replaced
> > >
> > > +
> > > +What:		/sys/devices/system/cpu/cpu*/cache/index*/id
> > > +Date:		July 2016
> > > +Contact:	Linux kernel mailing list <linux-kernel@vger.kernel.org>
> > > +Description:	Cache id
> > > +
> > > +		The id identifies a cache in the platform. In same index, the id
> > > +		is unique across the platform.
> > 
> > What does 'In same index' mean?
> 
> It means one cache's id is unique in all caches with same cache index number. 
> For example, in all caches with index3 (i.e. level3), cache id 0 is unique to 
> identify a L3 cache. But in caches with index 0 (i.e. Level0), there is also a 
> cache id 0. So cache id is unique in one index. But not unique in two different 
> index.
> 
> Does that make sense? I hope I express that correctly.

Yeah, makes sense!

I'd express it like that:

	The ID identifies a specific hardware cache of the machine
	the kernel is running on. The (depth_index, ID) pair uniquely
	identifies a cache.

And wherever you mention 'index' I'd change it over to 'depth index' - because 
'index' alone is way too opaque - the 'id' is an index too.

Also note how I avoided the 'platform' word - that is really ambigious as well: it 
might mean something generic like 'x86', not just the actual system we are on.

BTW., are there any ID enumeration continuity guarantees, or can there be holes in 
the depth index or the ID? (In the normal case, not considering CPU hotplug 
creating holes.) Is it the kernel that does the enumeration or do we trust what 
the hardware (CPUID) is telling us?

Thanks,

	Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web