Skip to content

Commit d4f28f0

Browse files
KAGA-KOKOPeter Zijlstra
authored andcommitted
x86/smpboot: Move synchronization masks to SMP boot code
The usage is in smpboot.c and not in the CPU initialization code. The XEN_PV usage of cpu_callout_mask is obsolete as cpu_init() not longer waits and cacheinfo has its own CPU mask now, so cpu_callout_mask can be made static too. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Oleksandr Natalenko <[email protected]> Tested-by: Helge Deller <[email protected]> # parisc Tested-by: Guilherme G. Piccoli <[email protected]> # Steam Deck Link: https://lore.kernel.org/r/[email protected]
1 parent a32226f commit d4f28f0

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

arch/x86/include/asm/cpumask.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
#ifndef __ASSEMBLY__
55
#include <linux/cpumask.h>
66

7-
extern cpumask_var_t cpu_callin_mask;
8-
extern cpumask_var_t cpu_callout_mask;
9-
extern cpumask_var_t cpu_initialized_mask;
10-
extern cpumask_var_t cpu_sibling_setup_mask;
11-
127
extern void setup_cpu_local_masks(void);
138

149
/*

arch/x86/kernel/cpu/common.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,6 @@
6767

6868
u32 elf_hwcap2 __read_mostly;
6969

70-
/* all of these masks are initialized in setup_cpu_local_masks() */
71-
cpumask_var_t cpu_initialized_mask;
72-
cpumask_var_t cpu_callout_mask;
73-
cpumask_var_t cpu_callin_mask;
74-
75-
/* representing cpus for which sibling maps can be computed */
76-
cpumask_var_t cpu_sibling_setup_mask;
77-
7870
/* Number of siblings per CPU package */
7971
int smp_num_siblings = 1;
8072
EXPORT_SYMBOL(smp_num_siblings);
@@ -169,15 +161,6 @@ static void ppin_init(struct cpuinfo_x86 *c)
169161
clear_cpu_cap(c, info->feature);
170162
}
171163

172-
/* correctly size the local cpu masks */
173-
void __init setup_cpu_local_masks(void)
174-
{
175-
alloc_bootmem_cpumask_var(&cpu_initialized_mask);
176-
alloc_bootmem_cpumask_var(&cpu_callin_mask);
177-
alloc_bootmem_cpumask_var(&cpu_callout_mask);
178-
alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
179-
}
180-
181164
static void default_init(struct cpuinfo_x86 *c)
182165
{
183166
#ifdef CONFIG_X86_64

arch/x86/kernel/smpboot.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ EXPORT_PER_CPU_SYMBOL(cpu_die_map);
101101
DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
102102
EXPORT_PER_CPU_SYMBOL(cpu_info);
103103

104+
/* All of these masks are initialized in setup_cpu_local_masks() */
105+
static cpumask_var_t cpu_initialized_mask;
106+
static cpumask_var_t cpu_callout_mask;
107+
static cpumask_var_t cpu_callin_mask;
108+
/* Representing CPUs for which sibling maps can be computed */
109+
static cpumask_var_t cpu_sibling_setup_mask;
110+
104111
/* Logical package management. We might want to allocate that dynamically */
105112
unsigned int __max_logical_packages __read_mostly;
106113
EXPORT_SYMBOL(__max_logical_packages);
@@ -1545,6 +1552,15 @@ __init void prefill_possible_map(void)
15451552
set_cpu_possible(i, true);
15461553
}
15471554

1555+
/* correctly size the local cpu masks */
1556+
void __init setup_cpu_local_masks(void)
1557+
{
1558+
alloc_bootmem_cpumask_var(&cpu_initialized_mask);
1559+
alloc_bootmem_cpumask_var(&cpu_callin_mask);
1560+
alloc_bootmem_cpumask_var(&cpu_callout_mask);
1561+
alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
1562+
}
1563+
15481564
#ifdef CONFIG_HOTPLUG_CPU
15491565

15501566
/* Recompute SMT state for all CPUs on offline */

arch/x86/xen/smp_pv.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,12 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
254254
struct desc_struct *gdt;
255255
unsigned long gdt_mfn;
256256

257-
/* used to tell cpu_init() that it can proceed with initialization */
258-
cpumask_set_cpu(cpu, cpu_callout_mask);
259257
if (cpumask_test_and_set_cpu(cpu, xen_cpu_initialized_map))
260258
return 0;
261259

262260
ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
263261
if (ctxt == NULL) {
264262
cpumask_clear_cpu(cpu, xen_cpu_initialized_map);
265-
cpumask_clear_cpu(cpu, cpu_callout_mask);
266263
return -ENOMEM;
267264
}
268265

0 commit comments

Comments
 (0)