Intel Contributes New "KCPUID" Utility For Linux To Reliably Report CPU Features
Intel engineers have been working on a tool called kcpuid for showing the raw CPU features/capabilities of a processor under Linux. This utility will be part of the kernel source tree and is queued up now in tip's x86/misc branch, thereby making it material for Linux 5.13 barring any issues coming up.
Users/administrators can generally rely on /proc/cpuinfo for quickly finding out CPU features of a given system. But the reported CPU information can be a bit misleading as some information can get left out due to kernel boot-time / command-line options that may disable some feature flags. Meanwhile other user-space utilities exist for reading CPU features but they are not necessarily up-to-date for the latest CPUs, among other potential issues.
So with the KCPUID utility contributed by Intel this is an in-kernel-tree utility, similar to the perf user-space components also residing in the tree, among other non-kernel code. KCPUID will report CPU features based on the CPUID instruction presence, regardless of whether the kernel is making use of a feature or not. This utility can also provide /proc/cpuinfo-like output for easy parsing/comparison.
Also convenient with this utility is CPUID leaf definitions are kept in a CSV file for easy parsing and to nicely make new additions. The kcpuid command-line utility supports a number of different options for dumping the supported CPU features in a variety of manners.
On Monday, KCPUID was merged into tip's x86/misc branch, which means it should be part of the Linux 5.13 merge window in two months time.
Users/administrators can generally rely on /proc/cpuinfo for quickly finding out CPU features of a given system. But the reported CPU information can be a bit misleading as some information can get left out due to kernel boot-time / command-line options that may disable some feature flags. Meanwhile other user-space utilities exist for reading CPU features but they are not necessarily up-to-date for the latest CPUs, among other potential issues.
So with the KCPUID utility contributed by Intel this is an in-kernel-tree utility, similar to the perf user-space components also residing in the tree, among other non-kernel code. KCPUID will report CPU features based on the CPUID instruction presence, regardless of whether the kernel is making use of a feature or not. This utility can also provide /proc/cpuinfo-like output for easy parsing/comparison.
Also convenient with this utility is CPUID leaf definitions are kept in a CSV file for easy parsing and to nicely make new additions. The kcpuid command-line utility supports a number of different options for dumping the supported CPU features in a variety of manners.
On Monday, KCPUID was merged into tip's x86/misc branch, which means it should be part of the Linux 5.13 merge window in two months time.
7 Comments