Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/cpu: Remove X86_FEATURE_NAMES

While discussing to change the visibility of X86_FEATURE_NAMES (see Link)
in order to remove CONFIG_EMBEDDED, Boris suggested to simply make the
X86_FEATURE_NAMES functionality unconditional.

As the need for really tiny kernel images has gone away and kernel images
with !X86_FEATURE_NAMES are hardly tested, remove this config and the whole
ifdeffery in the source code.

Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/all/20230509084007.24373-1-lukas.bulwahn@gmail.com/
Link: https://lore.kernel.org/r/20230510065713.10996-3-lukas.bulwahn@gmail.com

authored by

Lukas Bulwahn and committed by
Borislav Petkov (AMD)
7583e8fb 424e23fd

+2 -40
-12
arch/x86/Kconfig
··· 291 291 select TRACE_IRQFLAGS_NMI_SUPPORT 292 292 select USER_STACKTRACE_SUPPORT 293 293 select HAVE_ARCH_KCSAN if X86_64 294 - select X86_FEATURE_NAMES if PROC_FS 295 294 select PROC_PID_ARCH_STATUS if PROC_FS 296 295 select HAVE_ARCH_NODE_DEV_GROUP if X86_SGX 297 296 select FUNCTION_ALIGNMENT_16B if X86_64 || X86_ALIGNMENT_16 ··· 439 440 <http://www.tldp.org/docs.html#howto>. 440 441 441 442 If you don't know what to do here, say N. 442 - 443 - config X86_FEATURE_NAMES 444 - bool 445 - default y 446 - help 447 - This option compiles in a table of x86 feature bits and corresponding 448 - names. This is required to support /proc/cpuinfo and a few kernel 449 - messages. You can disable this to save space, at the expense of 450 - making those few kernel messages show numeric feature bits instead. 451 - 452 - If in doubt, say Y. 453 443 454 444 config X86_X2APIC 455 445 bool "Support x2apic"
+1 -1
arch/x86/Kconfig.cpu
··· 389 389 390 390 config X86_VMX_FEATURE_NAMES 391 391 def_bool y 392 - depends on IA32_FEAT_CTL && X86_FEATURE_NAMES 392 + depends on IA32_FEAT_CTL 393 393 394 394 menuconfig PROCESSOR_SELECT 395 395 bool "Supported processor vendors" if EXPERT
-2
arch/x86/boot/Makefile
··· 55 55 -include include/generated/autoconf.h \ 56 56 -D__EXPORTED_HEADERS__ 57 57 58 - ifdef CONFIG_X86_FEATURE_NAMES 59 58 $(obj)/cpu.o: $(obj)/cpustr.h 60 59 61 60 quiet_cmd_cpustr = CPUSTR $@ 62 61 cmd_cpustr = $(obj)/mkcpustr > $@ 63 62 $(obj)/cpustr.h: $(obj)/mkcpustr FORCE 64 63 $(call if_changed,cpustr) 65 - endif 66 64 targets += cpustr.h 67 65 68 66 # ---------------------------------------------------------------------------
-13
arch/x86/boot/cpu.c
··· 14 14 */ 15 15 16 16 #include "boot.h" 17 - #ifdef CONFIG_X86_FEATURE_NAMES 18 17 #include "cpustr.h" 19 - #endif 20 18 21 19 static char *cpu_name(int level) 22 20 { ··· 33 35 static void show_cap_strs(u32 *err_flags) 34 36 { 35 37 int i, j; 36 - #ifdef CONFIG_X86_FEATURE_NAMES 37 38 const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs; 38 39 for (i = 0; i < NCAPINTS; i++) { 39 40 u32 e = err_flags[i]; ··· 55 58 e >>= 1; 56 59 } 57 60 } 58 - #else 59 - for (i = 0; i < NCAPINTS; i++) { 60 - u32 e = err_flags[i]; 61 - for (j = 0; j < 32; j++) { 62 - if (e & 1) 63 - printf("%d:%d ", i, j); 64 - e >>= 1; 65 - } 66 - } 67 - #endif 68 61 } 69 62 70 63 int validate_cpu(void)
-5
arch/x86/include/asm/cpufeature.h
··· 38 38 #define X86_CAP_FMT_NUM "%d:%d" 39 39 #define x86_cap_flag_num(flag) ((flag) >> 5), ((flag) & 31) 40 40 41 - #ifdef CONFIG_X86_FEATURE_NAMES 42 41 extern const char * const x86_cap_flags[NCAPINTS*32]; 43 42 extern const char * const x86_power_flags[32]; 44 43 #define X86_CAP_FMT "%s" 45 44 #define x86_cap_flag(flag) x86_cap_flags[flag] 46 - #else 47 - #define X86_CAP_FMT X86_CAP_FMT_NUM 48 - #define x86_cap_flag x86_cap_flag_num 49 - #endif 50 45 51 46 /* 52 47 * In order to save room, we index into this array by doing
+1 -3
arch/x86/kernel/cpu/Makefile
··· 27 27 obj-y += umwait.o 28 28 29 29 obj-$(CONFIG_PROC_FS) += proc.o 30 - obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o 30 + obj-y += capflags.o powerflags.o 31 31 32 32 obj-$(CONFIG_IA32_FEAT_CTL) += feat_ctl.o 33 33 ifdef CONFIG_CPU_SUP_INTEL ··· 54 54 obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o 55 55 obj-$(CONFIG_ACRN_GUEST) += acrn.o 56 56 57 - ifdef CONFIG_X86_FEATURE_NAMES 58 57 quiet_cmd_mkcapflags = MKCAP $@ 59 58 cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $@ $^ 60 59 ··· 62 63 63 64 $(obj)/capflags.c: $(cpufeature) $(vmxfeature) $(src)/mkcapflags.sh FORCE 64 65 $(call if_changed,mkcapflags) 65 - endif 66 66 targets += capflags.c
-4
arch/x86/kernel/cpu/common.c
··· 1502 1502 if (!kstrtouint(opt, 10, &bit)) { 1503 1503 if (bit < NCAPINTS * 32) { 1504 1504 1505 - #ifdef CONFIG_X86_FEATURE_NAMES 1506 1505 /* empty-string, i.e., ""-defined feature flags */ 1507 1506 if (!x86_cap_flags[bit]) 1508 1507 pr_cont(" " X86_CAP_FMT_NUM, x86_cap_flag_num(bit)); 1509 1508 else 1510 - #endif 1511 1509 pr_cont(" " X86_CAP_FMT, x86_cap_flag(bit)); 1512 1510 1513 1511 setup_clear_cpu_cap(bit); ··· 1518 1520 continue; 1519 1521 } 1520 1522 1521 - #ifdef CONFIG_X86_FEATURE_NAMES 1522 1523 for (bit = 0; bit < 32 * NCAPINTS; bit++) { 1523 1524 if (!x86_cap_flag(bit)) 1524 1525 continue; ··· 1534 1537 1535 1538 if (!found) 1536 1539 pr_cont(" (unknown: %s)", opt); 1537 - #endif 1538 1540 } 1539 1541 pr_cont("\n"); 1540 1542