Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Jan 1980 21:30:19 +0100
From:      "Josep M. Blanquer" <blanquer@cs.ucsb.edu>
To:        Matt Dillon <dillon@earth.backplane.com>
Cc:        smp@FreeBSD.ORG
Subject:   Re: getting processor's cacheline size?
Message-ID:  <12D3BADB.3E1BB0BA@cs.ucsb.edu>
References:  <200012290623.eBT6NaJ03589@mass.osd.bsdi.com> <200012290636.eBT6a2m29328@earth.backplane.com> <20001229015117.F8848@cs.rice.edu> <200012291806.eBTI6jL32222@earth.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Matt Dillon escribió:
> 
> :
> :On Thu, Dec 28, 2000 at 10:36:02PM -0800, Matt Dillon wrote:
> :>
> :>     16 bytes (128 bits) is typical.  I think 95% of all current processors
> :>     are either 16 bytes or 32 bytes.  ...
> :
> :You're on the low side:  Pentium II's and III's are 32 bytes.  Pentium 4's
> :(L1), Athlons, EV6's, and EV67's are 64 bytes.  The Pentium 4's L2 line size
> :is actually 128 bytes, but broken down into two 64 byte sectors.
> :(See page 1-18 of the manual at
> :http://developer.intel.com/design/pentium4/manuals/248966.htm.)
> :
> :Alan
> 
>   What can I say, I'm only a quarter micron engineer :-).
> 
> It occurs to me that we can probably detect the L1 and L2 cache line
> sizes on SMP systems dynamically by running a timing loop with two
> CPU's banging on a small segment of memory using locked instructions.
> By accessing memory N bytes apart on two cpu's (8, 16, 32, 64, 128, ...)
> and timing it we could determine the cache line size in a few milliseconds.

 I have a tool that detects (or tries to) several characteristics of 
the memory subsystem (including the line size) by just accessing memory 
in determined patterns and timing it...the tool runs on freebsd, 
solaris, linux...and Intel,Sparc and Alpha.
It´s not 100% but gets pretty good results. The actual implementation 
automatically detects cache sizes/levels, line sizes, associativity, 
"replacement policy" and write policy for both data and instruction 
caches as well as some TLB parameters. It has no multiprocessor design 
features, but it works well on them too.
It is probably something you can not use to detect parameters at
runtime,
(as someone pointed out) but it could be helpful at kernel config/make 
time...
I´m putting something toghether at http://steamboat.cs.ucsb.edu/mob 
but not all links are up yet. Not much information is available by now 
(a paper is submitted) but if anybody wants to give it a try feel free 
to contact me.

  Oh, BTW this is nothing commercial! 

 Josep M.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?12D3BADB.3E1BB0BA>