RFC: Adding a hw.features sysctl
kostikbel at gmail.com
Sat Jan 12 22:44:57 PST 2008
On Sat, Jan 12, 2008 at 11:16:27PM -0500, Joe Marcus Clarke wrote:
> I find it would be useful to have the list of CPU features available via
> a sysctl. Currently, he only ways to get this information are to have
> linprocfs mounted, or parse dmesg.boot (if it exists). Attached are
Not quite true, since the raw CPU capabilities are accessible using
the cpuid instruction, both to the kernel- and user-mode.
> patches to add hw.features and hw.features2 sysctls for i386 and amd64
> (where a list of CPU features is applicable). The results are identical
> to the Features and Features2 strings from dmesg:
> hw.features2: 0x41d<SSE3,RSVD2,MON,DS_CPL,CNXT-ID>
The only part that I do not fully agree is to dedicate 1Kb of the kernel
memory to the strings that could be reconstructed in the usermode and
are relatively rare used.
I would suggest either export only bitmask of the cpu features and do
the formatting in the sysctl(8), or implement the user-mode utility that
would pretty-print results of the cpuid execution, like cpuid from ports.
The first option could be preferable, since kernel might disable some
features, that is not reflected in the output of cpuid instruction.
Example of this would be identcpu.c, line 860 (HTT on AMD).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20080113/37816244/attachment.pgp
More information about the freebsd-current