Skip to content

Commit 056612f

Browse files
committed
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
2 parents 3f0b090 + fcb3a81 commit 056612f

File tree

8 files changed

+18
-28
lines changed

8 files changed

+18
-28
lines changed

arch/x86/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ config X86_5LEVEL
15021502
depends on X86_64
15031503
help
15041504
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
15061506
physical address space.
15071507

15081508
It will be supported by future Intel CPUs.
@@ -2609,8 +2609,8 @@ config CALL_THUNKS_DEBUG
26092609
a noisy dmesg about callthunks generation and call patching for
26102610
trouble shooting. The debug prints need to be enabled on the
26112611
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.
26142614

26152615
config CPU_IBPB_ENTRY
26162616
bool "Enable IBPB on kernel entry"

arch/x86/kernel/cpu/cacheinfo.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ void init_hygon_cacheinfo(struct cpuinfo_x86 *c)
734734
void init_intel_cacheinfo(struct cpuinfo_x86 *c)
735735
{
736736
/* 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;
738738
unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
739739
unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
740740
unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
@@ -835,9 +835,6 @@ void init_intel_cacheinfo(struct cpuinfo_x86 *c)
835835
case LVL_3:
836836
l3 += cache_table[k].size;
837837
break;
838-
case LVL_TRACE:
839-
trace += cache_table[k].size;
840-
break;
841838
}
842839

843840
break;

arch/x86/kernel/cpu/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ static __init int setup_disable_pku(char *arg)
567567
return 1;
568568
}
569569
__setup("nopku", setup_disable_pku);
570-
#endif /* CONFIG_X86_64 */
570+
#endif
571571

572572
#ifdef CONFIG_X86_KERNEL_IBT
573573

arch/x86/kernel/e820.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
*
5454
* Once the E820 map has been converted to the standard Linux memory layout
5555
* 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
5757
* specific memory layout data during early bootup.
5858
*/
5959
static struct e820_table e820_table_init __initdata;
@@ -395,15 +395,15 @@ int __init e820__update_table(struct e820_table *table)
395395

396396
/* Continue building up new map based on this information: */
397397
if (current_type != last_type || e820_nomerge(current_type)) {
398-
if (last_type != 0) {
398+
if (last_type) {
399399
new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr;
400400
/* Move forward only if the new size was non-zero: */
401401
if (new_entries[new_nr_entries].size != 0)
402402
/* No more space left for new entries? */
403403
if (++new_nr_entries >= max_nr_entries)
404404
break;
405405
}
406-
if (current_type != 0) {
406+
if (current_type) {
407407
new_entries[new_nr_entries].addr = change_point[chg_idx]->addr;
408408
new_entries[new_nr_entries].type = current_type;
409409
last_addr = change_point[chg_idx]->addr;

arch/x86/kernel/setup.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,6 @@ static struct resource bss_resource = {
114114
#ifdef CONFIG_X86_32
115115
/* CPU data as detected by the assembly code in head_32.S */
116116
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-
122117
unsigned int def_to_bigsmp;
123118

124119
struct apm_info apm_info;
@@ -132,11 +127,10 @@ EXPORT_SYMBOL(ist_info);
132127
struct ist_info ist_info;
133128
#endif
134129

135-
#else
136-
struct cpuinfo_x86 boot_cpu_data __read_mostly;
137-
EXPORT_SYMBOL(boot_cpu_data);
138130
#endif
139131

132+
struct cpuinfo_x86 boot_cpu_data __read_mostly;
133+
EXPORT_SYMBOL(boot_cpu_data);
140134

141135
#if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
142136
__visible unsigned long mmu_cr4_features __ro_after_init;

arch/x86/kernel/signal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static bool strict_sigaltstack_size __ro_after_init = false;
360360

361361
static int __init strict_sas_size(char *arg)
362362
{
363-
return kstrtobool(arg, &strict_sigaltstack_size);
363+
return kstrtobool(arg, &strict_sigaltstack_size) == 0;
364364
}
365365
__setup("strict_sas_size", strict_sas_size);
366366

arch/x86/kernel/smpboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,7 @@ void native_play_dead(void)
18331833
play_dead_common();
18341834
tboot_shutdown(TB_SHUTDOWN_WFS);
18351835

1836-
mwait_play_dead(); /* Only returns on failure */
1836+
mwait_play_dead();
18371837
if (cpuidle_play_dead())
18381838
hlt_play_dead();
18391839
}

arch/x86/kernel/tsc.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,7 @@ void recalibrate_cpu_khz(void)
911911
cpu_khz_old, cpu_khz);
912912
#endif
913913
}
914-
915-
EXPORT_SYMBOL(recalibrate_cpu_khz);
914+
EXPORT_SYMBOL_GPL(recalibrate_cpu_khz);
916915

917916

918917
static unsigned long long cyc2ns_suspend;
@@ -1509,18 +1508,18 @@ void __init tsc_early_init(void)
15091508

15101509
void __init tsc_init(void)
15111510
{
1511+
if (!cpu_feature_enabled(X86_FEATURE_TSC)) {
1512+
setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
1513+
return;
1514+
}
1515+
15121516
/*
15131517
* native_calibrate_cpu_early can only calibrate using methods that are
15141518
* available early in boot.
15151519
*/
15161520
if (x86_platform.calibrate_cpu == native_calibrate_cpu_early)
15171521
x86_platform.calibrate_cpu = native_calibrate_cpu;
15181522

1519-
if (!boot_cpu_has(X86_FEATURE_TSC)) {
1520-
setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
1521-
return;
1522-
}
1523-
15241523
if (!tsc_khz) {
15251524
/* We failed to determine frequencies earlier, try again */
15261525
if (!determine_cpu_tsc_frequencies(false)) {

0 commit comments

Comments
 (0)