Determining CPU features / cache organization from userland

Peter Jeremy peterjeremy at optushome.com.au
Mon Oct 13 02:47:34 PDT 2003


On Sun, Oct 12, 2003 at 08:57:52PM +0100, Bruce M Simpson wrote:
>[ Andrew: Perhaps you can shed some light on how the necessary information
>can be gathered on Alpha? My search was incomplete and I could not find
>a reliable source for DEC's development manuals. ]

L1 cache information is in the CPU datasheets.  I don't know of a
summary across the whole Alpha family.  The datasheets can be
(nominally) found at:
http://h18000.www1.hp.com/products/software/alpha-tools/documentation/current/chip-docs.html

Last time I went digging, some of the links didn't work but if you
look at the links and rummage around the FTP site, the information was
all there (and other material that wasn't referenced in the HTML pages).

>sysctl is a good interface for retrieving this information as it doesn't
>change during the lifetime of the kernel, and it is small. sysctl is already
>invoked from within libc to retrieve information in this way.

I agree.  sysctl would appear to be the best interface.

>alpha
>-----
>Cache discovery? Static.

AFAIK, there's no PALcode interface, unfortunately.

>i386 pc98 amd64
>---------------
>Cache discovery? CPUID.
>Earlier chips which don't support it probably don't have a cache,
>or aren't worth supporting.

80386 has no on-chip cache.
Intel i486 has 8KB _unified_ 4-way, 16 bytes/line L1.  Cache alignment has
a significant effect and gcc defaults to 16-byte alignment on -m486.

ports/benchmarks/lmbench includes tools that can experimentally
determine the cache configuration - though not quickly/efficiently
enough to form part of the boot.

Peter


More information about the freebsd-hackers mailing list