NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/53186: Portable run-time non-privileged determination of processor cache parameters
>Number: 53186
>Category: kern
>Synopsis: Portable run-time non-privileged determination of processor cache parameters
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Apr 16 03:25:00 +0000 2018
>Originator: Bruce Lilly
>Release: 6.1.5-7.1.2
>Organization:
none
>Environment:
N/A
>Description:
There appears to be no way for an unprivileged userland process to
determine CPU cache parameters (level, type, line size, associativity).
dmidecode attempts to provide that information, but 1) one cannot depend
on it being installed, 2) it requires superuser privilege to read
/dev/mem, and 3) it provides incorrect information in some cases.
sysctl apparently does not provide any relevant information; moreover
it is non-portable.
libcpuid can, with some effort, be built on NetBSD and can provide
the information for i386 and amd64 processors, providing limited
portability but requiring that external library.
Linux provides extensions to POSIX, X/OPEN sysconf() to return cache
information (see e.g. https://lists.onap.org/pipermail/lsb-bugs/2007-July/002268.html ). It sure would be nice if NetBSD used the same
mechanism to make cache information available (actual values for
_SC_LEVEL1_DCACHE_SIZE etc. are unimportant). I note that
/usr/include/sys/unistd.h has a section
/* Extensions found in Solaris and Linux. */
but unfortunately it doesn't have anything of interest.
>How-To-Repeat:
>Fix:
Home |
Main Index |
Thread Index |
Old Index