All of lore.kernel.org
 help / color / mirror / Atom feed
* L1_CACHE_SHIFT value for P4 ?
@ 2002-11-21 12:13 Margit Schubert-While
  0 siblings, 0 replies; 9+ messages in thread
From: Margit Schubert-While @ 2002-11-21 12:13 UTC (permalink / raw)
  To: linux-kernel

What should be the value of L1_CACHE_SHIFT for a P4 ?
L1_CACHE_BYTES is set to 1<<L1_CACHE_SHIFT

In the .config , I notice that L1_CACHE_SHIFT is being set to 7 for the P4.
Surely that can't be right or ?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: L1_CACHE_SHIFT value for P4 ?
       [not found] <4.3.2.7.2.20021121130236.00b15370@mail.dns-host.com.suse.lists.linux.kernel>
@ 2002-11-21 13:10 ` Andi Kleen
  2002-11-21 13:23   ` Dave Jones
  0 siblings, 1 reply; 9+ messages in thread
From: Andi Kleen @ 2002-11-21 13:10 UTC (permalink / raw)
  To: Margit Schubert-While; +Cc: linux-kernel

Margit Schubert-While <margit@margit.com> writes:

E> What should be the value of L1_CACHE_SHIFT for a P4 ?
> L1_CACHE_BYTES is set to 1<<L1_CACHE_SHIFT
> 
> In the .config , I notice that L1_CACHE_SHIFT is being set to 7 for the P4.
> Surely that can't be right or ?

The P4 has 128byte L2 cache lines (2^7). The L1 apparently has smaller lines.

For practical reasons the L1_CACHE_BYTES defines should not be smaller than
the L2 line size - otherwise slab's cache colouring would not be very 
effective. In fact the symbol is a bit misnamed, it refers to all CPU caches.
So it needs to be 7.


-Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: L1_CACHE_SHIFT value for P4 ?
  2002-11-21 13:10 ` Andi Kleen
@ 2002-11-21 13:23   ` Dave Jones
  2002-11-21 13:42     ` Andi Kleen
  2002-11-21 15:03     ` Mikael Pettersson
  0 siblings, 2 replies; 9+ messages in thread
From: Dave Jones @ 2002-11-21 13:23 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Margit Schubert-While, linux-kernel

On Thu, Nov 21, 2002 at 02:10:02PM +0100, Andi Kleen wrote:

 > The P4 has 128byte L2 cache lines (2^7). The L1 apparently has smaller lines.

Not mine:

L2 unified cache:
	Size: 512KB	Sectored, 8-way associative.
	line size=64 bytes.

Someone (Manfred?) pointed out a chapter in the P4 system programmer guide about
this last time I brought it up. I forget the reasoning, I'll see if I can dig it out..

		Dave

-- 
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* L1_CACHE_SHIFT value for P4 ?
@ 2002-11-21 13:25 Margit Schubert-While
  2002-11-21 13:30 ` Dave Jones
  0 siblings, 1 reply; 9+ messages in thread
From: Margit Schubert-While @ 2002-11-21 13:25 UTC (permalink / raw)
  To: linux-kernel

Andi,
L2 cache lines = L2 cache size ?
This P4 has got 512KB L2 cache.

processor         : 0
vendor_id          : GenuineIntel
cpu family          : 15
model                : 2
model name      : Intel(R) Pentium(R) 4 CPU 2.40GHz
stepping            : 4
cpu MHz            : 2400.143
cache size         : 512 KB
fdiv_bug            : no
hlt_bug              : no
f00f_bug           : no
coma_bug        : no
fpu                     : yes
fpu_exception   : yes
cpuid level         : 2
wp                      : yes
flags                  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr 
pge mca cmov pat pse36
                             clflush dts acpi mmx fxsr sse sse2 ss ht tm
bogomips         : 4784.12


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: L1_CACHE_SHIFT value for P4 ?
  2002-11-21 13:25 L1_CACHE_SHIFT value for P4 ? Margit Schubert-While
@ 2002-11-21 13:30 ` Dave Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Dave Jones @ 2002-11-21 13:30 UTC (permalink / raw)
  To: Margit Schubert-While; +Cc: linux-kernel

On Thu, Nov 21, 2002 at 02:25:54PM +0100, Margit Schubert-While wrote:
 > Andi,
 > L2 cache lines = L2 cache size ?

No.

 > This P4 has got 512KB L2 cache.

That 512KB is divided into 'lines' of n bytes.
Where n is the L1_CACHE_SHIFT value. (Or should be).
x86info will tell you the line size. (Its also printk'd at boot up iirc)

		Dave

-- 
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: L1_CACHE_SHIFT value for P4 ?
  2002-11-21 13:23   ` Dave Jones
@ 2002-11-21 13:42     ` Andi Kleen
  2002-11-21 13:47       ` Dave Jones
  2002-11-21 15:03     ` Mikael Pettersson
  1 sibling, 1 reply; 9+ messages in thread
From: Andi Kleen @ 2002-11-21 13:42 UTC (permalink / raw)
  To: Dave Jones, Andi Kleen, Margit Schubert-While, linux-kernel

On Thu, Nov 21, 2002 at 01:23:02PM +0000, Dave Jones wrote:
> On Thu, Nov 21, 2002 at 02:10:02PM +0100, Andi Kleen wrote:
> 
>  > The P4 has 128byte L2 cache lines (2^7). The L1 apparently has smaller lines.
> 
> Not mine:
> 
> L2 unified cache:
> 	Size: 512KB	Sectored, 8-way associative.
> 	line size=64 bytes.
> 
> Someone (Manfred?) pointed out a chapter in the P4 system programmer guide about
> this last time I brought it up. I forget the reasoning, I'll see if I can dig it out..

The only reference I was able to find was in the Intel Technology Journal,
which says the L2 cache has a 128 byte cache line.

http://developer.intel.com/technology/itj/q12001/articles/art_2.htm
-> "Netburst microarchitecture" -> Level 2 Instruction and Data Cache
"The L2 cache is organized as an 8-way set-associative cache with 128 bytes 
per cache line. These 128-byte cache lines consist of two 64-byte sectors. 
A miss in the L2 cache typically initiates two 64-byte access requests to the 
system bus to fill both halves of the cache line. The L2 cache is a write-back 
cache that allocates new cache lines on load or store misses. "

It is refering to the older 256K cached P4, but I doubt they changed it.
Your cache reporting may refer to the 64byte sectors or is just wrong
(would not be the first time that has happened - some P4 versions also
misreported their TLB size) 

For cache colouring purposes you need to use the 128 byte unit.

-Andi

-Andi
> 
> 		Dave
> 
> -- 
> | Dave Jones.        http://www.codemonkey.org.uk
> | SuSE Labs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: L1_CACHE_SHIFT value for P4 ?
  2002-11-21 13:42     ` Andi Kleen
@ 2002-11-21 13:47       ` Dave Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Dave Jones @ 2002-11-21 13:47 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Margit Schubert-While, linux-kernel

On Thu, Nov 21, 2002 at 02:42:50PM +0100, Andi Kleen wrote:

 > http://developer.intel.com/technology/itj/q12001/articles/art_2.htm
 > -> "Netburst microarchitecture" -> Level 2 Instruction and Data Cache
 > "The L2 cache is organized as an 8-way set-associative cache with 128 bytes 
 > per cache line. These 128-byte cache lines consist of two 64-byte sectors. 
 > A miss in the L2 cache typically initiates two 64-byte access requests to the 
 > system bus to fill both halves of the cache line.

Ok, this makes more sense. (and sounds familiar -- probably the same
thing I was pointed to last time this came up)
 
 > It is refering to the older 256K cached P4, but I doubt they changed it.
 > Your cache reporting may refer to the 64byte sectors or is just wrong

I think its counting just the sector. It certainly makes sense.

 > (would not be the first time that has happened - some P4 versions also
 > misreported their TLB size) 

Interesting. I should go read the errata so x86info handles that correctly..

 > For cache colouring purposes you need to use the 128 byte unit.

Agreed.

		Dave

-- 
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* L1_CACHE_SHIFT value for P4 ?
@ 2002-11-21 14:39 Margit Schubert-While
  0 siblings, 0 replies; 9+ messages in thread
From: Margit Schubert-While @ 2002-11-21 14:39 UTC (permalink / raw)
  To: linux-kernel

Just for the record - my x86info

Instruction TLB: 4K, 2MB or 4MB pages, fully associative, 64 entries.
Data TLB: 4KB or 4MB pages, fully associative, 64 entries.
L1 Data cache:
         Size: 8KB       Sectored, 4-way associative.
         line size=64 bytes.
No L3 cache
Instruction trace cache:
         Size: 12K uOps  8-way associative.
L2 unified cache:
         Size: 512KB     Sectored, 8-way associative.
         line size=64 bytes.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: L1_CACHE_SHIFT value for P4 ?
  2002-11-21 13:23   ` Dave Jones
  2002-11-21 13:42     ` Andi Kleen
@ 2002-11-21 15:03     ` Mikael Pettersson
  1 sibling, 0 replies; 9+ messages in thread
From: Mikael Pettersson @ 2002-11-21 15:03 UTC (permalink / raw)
  To: Dave Jones; +Cc: Andi Kleen, Margit Schubert-While, linux-kernel

Dave Jones writes:
 > On Thu, Nov 21, 2002 at 02:10:02PM +0100, Andi Kleen wrote:
 > 
 >  > The P4 has 128byte L2 cache lines (2^7). The L1 apparently has smaller lines.
 > 
 > Not mine:
 > 
 > L2 unified cache:
 > 	Size: 512KB	Sectored, 8-way associative.
 > 	line size=64 bytes.
 > 
 > Someone (Manfred?) pointed out a chapter in the P4 system programmer guide about
 > this last time I brought it up. I forget the reasoning, I'll see if I can dig it out..

The info is in the P4 Code Optimization manual. I don't have it handy,
but as I recall, the P4s have 64 byte sectors and read two sectors on
a read miss. I don't know what happens on writes.

/Mikael

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-11-21 14:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-21 13:25 L1_CACHE_SHIFT value for P4 ? Margit Schubert-While
2002-11-21 13:30 ` Dave Jones
  -- strict thread matches above, loose matches on Subject: below --
2002-11-21 14:39 Margit Schubert-While
     [not found] <4.3.2.7.2.20021121130236.00b15370@mail.dns-host.com.suse.lists.linux.kernel>
2002-11-21 13:10 ` Andi Kleen
2002-11-21 13:23   ` Dave Jones
2002-11-21 13:42     ` Andi Kleen
2002-11-21 13:47       ` Dave Jones
2002-11-21 15:03     ` Mikael Pettersson
2002-11-21 12:13 Margit Schubert-While

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.