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

Merge tag 'x86-cleanups-2023-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull miscellaneous x86 cleanups from Thomas Gleixner:

- Correct the common copy and pasted mishandling of kstrtobool() in the
strict_sas_size() setup function

- Make recalibrate_cpu_khz() an GPL only export

- Check TSC feature before doing anything else which avoids pointless
code execution if TSC is not available

- Remove or fixup stale and misleading comments

- Remove unused or pointelessly duplicated variables

- Spelling and typo fixes

* tag 'x86-cleanups-2023-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/hotplug: Remove incorrect comment about mwait_play_dead()
x86/tsc: Do feature check as the very first thing
x86/tsc: Make recalibrate_cpu_khz() export GPL only
x86/cacheinfo: Remove unused trace variable
x86/Kconfig: Fix spellos & punctuation
x86/signal: Fix the value returned by strict_sas_size()
x86/cpu: Remove misleading comment
x86/setup: Move duplicate boot_cpu_data definition out of the ifdeffery
x86/boot/e820: Fix typo in e820.c comment

+18 -28
+3 -3
arch/x86/Kconfig
··· 1502 1502 depends on X86_64 1503 1503 help 1504 1504 5-level paging enables access to larger address space: 1505 - upto 128 PiB of virtual address space and 4 PiB of 1505 + up to 128 PiB of virtual address space and 4 PiB of 1506 1506 physical address space. 1507 1507 1508 1508 It will be supported by future Intel CPUs. ··· 2609 2609 a noisy dmesg about callthunks generation and call patching for 2610 2610 trouble shooting. The debug prints need to be enabled on the 2611 2611 kernel command line with 'debug-callthunks'. 2612 - Only enable this, when you are debugging call thunks as this 2613 - creates a noticable runtime overhead. If unsure say N. 2612 + Only enable this when you are debugging call thunks as this 2613 + creates a noticeable runtime overhead. If unsure say N. 2614 2614 2615 2615 config CPU_IBPB_ENTRY 2616 2616 bool "Enable IBPB on kernel entry"
+1 -4
arch/x86/kernel/cpu/cacheinfo.c
··· 734 734 void init_intel_cacheinfo(struct cpuinfo_x86 *c) 735 735 { 736 736 /* Cache sizes */ 737 - unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; 737 + unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0; 738 738 unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ 739 739 unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ 740 740 unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; ··· 834 834 break; 835 835 case LVL_3: 836 836 l3 += cache_table[k].size; 837 - break; 838 - case LVL_TRACE: 839 - trace += cache_table[k].size; 840 837 break; 841 838 } 842 839
+1 -1
arch/x86/kernel/cpu/common.c
··· 567 567 return 1; 568 568 } 569 569 __setup("nopku", setup_disable_pku); 570 - #endif /* CONFIG_X86_64 */ 570 + #endif 571 571 572 572 #ifdef CONFIG_X86_KERNEL_IBT 573 573
+3 -3
arch/x86/kernel/e820.c
··· 53 53 * 54 54 * Once the E820 map has been converted to the standard Linux memory layout 55 55 * information its role stops - modifying it has no effect and does not get 56 - * re-propagated. So itsmain role is a temporary bootstrap storage of firmware 56 + * re-propagated. So its main role is a temporary bootstrap storage of firmware 57 57 * specific memory layout data during early bootup. 58 58 */ 59 59 static struct e820_table e820_table_init __initdata; ··· 395 395 396 396 /* Continue building up new map based on this information: */ 397 397 if (current_type != last_type || e820_nomerge(current_type)) { 398 - if (last_type != 0) { 398 + if (last_type) { 399 399 new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr; 400 400 /* Move forward only if the new size was non-zero: */ 401 401 if (new_entries[new_nr_entries].size != 0) ··· 403 403 if (++new_nr_entries >= max_nr_entries) 404 404 break; 405 405 } 406 - if (current_type != 0) { 406 + if (current_type) { 407 407 new_entries[new_nr_entries].addr = change_point[chg_idx]->addr; 408 408 new_entries[new_nr_entries].type = current_type; 409 409 last_addr = change_point[chg_idx]->addr;
+2 -8
arch/x86/kernel/setup.c
··· 114 114 #ifdef CONFIG_X86_32 115 115 /* CPU data as detected by the assembly code in head_32.S */ 116 116 struct cpuinfo_x86 new_cpu_data; 117 - 118 - /* Common CPU data for all CPUs */ 119 - struct cpuinfo_x86 boot_cpu_data __read_mostly; 120 - EXPORT_SYMBOL(boot_cpu_data); 121 - 122 117 unsigned int def_to_bigsmp; 123 118 124 119 struct apm_info apm_info; ··· 127 132 struct ist_info ist_info; 128 133 #endif 129 134 130 - #else 131 - struct cpuinfo_x86 boot_cpu_data __read_mostly; 132 - EXPORT_SYMBOL(boot_cpu_data); 133 135 #endif 134 136 137 + struct cpuinfo_x86 boot_cpu_data __read_mostly; 138 + EXPORT_SYMBOL(boot_cpu_data); 135 139 136 140 #if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64) 137 141 __visible unsigned long mmu_cr4_features __ro_after_init;
+1 -1
arch/x86/kernel/signal.c
··· 360 360 361 361 static int __init strict_sas_size(char *arg) 362 362 { 363 - return kstrtobool(arg, &strict_sigaltstack_size); 363 + return kstrtobool(arg, &strict_sigaltstack_size) == 0; 364 364 } 365 365 __setup("strict_sas_size", strict_sas_size); 366 366
+1 -1
arch/x86/kernel/smpboot.c
··· 1833 1833 play_dead_common(); 1834 1834 tboot_shutdown(TB_SHUTDOWN_WFS); 1835 1835 1836 - mwait_play_dead(); /* Only returns on failure */ 1836 + mwait_play_dead(); 1837 1837 if (cpuidle_play_dead()) 1838 1838 hlt_play_dead(); 1839 1839 }
+6 -7
arch/x86/kernel/tsc.c
··· 911 911 cpu_khz_old, cpu_khz); 912 912 #endif 913 913 } 914 - 915 - EXPORT_SYMBOL(recalibrate_cpu_khz); 914 + EXPORT_SYMBOL_GPL(recalibrate_cpu_khz); 916 915 917 916 918 917 static unsigned long long cyc2ns_suspend; ··· 1508 1509 1509 1510 void __init tsc_init(void) 1510 1511 { 1512 + if (!cpu_feature_enabled(X86_FEATURE_TSC)) { 1513 + setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); 1514 + return; 1515 + } 1516 + 1511 1517 /* 1512 1518 * native_calibrate_cpu_early can only calibrate using methods that are 1513 1519 * available early in boot. 1514 1520 */ 1515 1521 if (x86_platform.calibrate_cpu == native_calibrate_cpu_early) 1516 1522 x86_platform.calibrate_cpu = native_calibrate_cpu; 1517 - 1518 - if (!boot_cpu_has(X86_FEATURE_TSC)) { 1519 - setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); 1520 - return; 1521 - } 1522 1523 1523 1524 if (!tsc_khz) { 1524 1525 /* We failed to determine frequencies earlier, try again */