public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* cacheline size detection code in 2.5.66
@ 2003-03-25  7:15 Andi Kleen
  2003-03-25 11:33 ` Ivan Kokshaysky
  2003-03-25 11:52 ` Dave Jones
  0 siblings, 2 replies; 8+ messages in thread
From: Andi Kleen @ 2003-03-25  7:15 UTC (permalink / raw)
  To: ink; +Cc: linux-kernel


Hi,

You added this code in 2.5.66: 

+       /*
+        * Assume PCI cacheline size of 32 bytes for all x86s except K7/K8
+        * and P4. It's also good for 386/486s (which actually have 16)
+        * as quite a few PCI devices do not support smaller values.
+        */
+        pci_cache_line_size = 32 >> 2;
+       if (c->x86 >= 6 && c->x86_vendor == X86_VENDOR_AMD)
+               pci_cache_line_size = 64 >> 2;  /* K7 & K8 */
+       else if (c->x86 > 6)
+               pci_cache_line_size = 128 >> 2; /* P4 */

This will be wrong on Pentium M for example which has a 32byte cache
line but x86 model 9. But it's actually not needed, because all the 
new CPUs report their cacheline size as part of CPUID for CLFLUSH.

When the CPU supports CLFLUSH you can just extract it from 
the second byte in the second word reported by CPUID 1.
With that just use what the CPU tells you. This should also
work correctly on VIA etc which afaik support CLFLUSH 
in the newer CPUs.

The x86-64 port extract it like this in setup.c:
	if (c->x86_capability[0] & (1<<19)) 
       		c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
	}. 
I changed its pci code to use that directly now. i386 likely
should too. When no CLFLUSH is supported you can safely assume 32byte
cachelines.

-Andi

	




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

end of thread, other threads:[~2003-03-25 16:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-25  7:15 cacheline size detection code in 2.5.66 Andi Kleen
2003-03-25 11:33 ` Ivan Kokshaysky
2003-03-25 12:15   ` Andi Kleen
2003-03-25 12:43     ` Dave Jones
2003-03-25 13:35       ` Andi Kleen
2003-03-25 14:39         ` Ivan Kokshaysky
2003-03-25 16:43           ` Dave Jones
2003-03-25 11:52 ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox