Skip to content

Commit 98a79d6

Browse files
committed
cpumask: centralize cpu_online_map and cpu_possible_map
Impact: cleanup Each SMP arch defines these themselves. Move them to a central location. Twists: 1) Some archs (m32, parisc, s390) set possible_map to all 1, so we add a CONFIG_INIT_ALL_POSSIBLE for this rather than break them. 2) mips and sparc32 '#define cpu_possible_map phys_cpu_present_map'. Those archs simply have phys_cpu_present_map replaced everywhere. 3) Alpha defined cpu_possible_map to cpu_present_map; this is tricky so I just manipulate them both in sync. 4) IA64, cris and m32r have gratuitous 'extern cpumask_t cpu_possible_map' declarations. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Grant Grundler <grundler@parisc-linux.org> Tested-by: Tony Luck <tony.luck@intel.com> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Mike Travis <travis@sgi.com> Cc: ink@jurassic.park.msu.ru Cc: rmk@arm.linux.org.uk Cc: starvik@axis.com Cc: tony.luck@intel.com Cc: takata@linux-m32r.org Cc: ralf@linux-mips.org Cc: grundler@parisc-linux.org Cc: paulus@samba.org Cc: schwidefsky@de.ibm.com Cc: lethal@linux-sh.org Cc: wli@holomorphy.com Cc: davem@davemloft.net Cc: jdike@addtoit.com Cc: mingo@redhat.com
1 parent 6c34bc2 commit 98a79d6

35 files changed

Lines changed: 42 additions & 132 deletions

File tree

‎arch/alpha/include/asm/smp.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS];
4545
#define raw_smp_processor_id() (current_thread_info()->cpu)
4646

4747
extern int smp_num_cpus;
48-
#define cpu_possible_map cpu_present_map
4948

5049
extern void arch_send_call_function_single_ipi(int cpu);
5150
extern void arch_send_call_function_ipi(cpumask_t mask);

‎arch/alpha/kernel/process.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ common_shutdown_1(void *generic_ptr)
9494
flags |= 0x00040000UL; /* "remain halted" */
9595
*pflags = flags;
9696
cpu_clear(cpuid, cpu_present_map);
97+
cpu_clear(cpuid, cpu_possible_map);
9798
halt();
9899
}
99100
#endif
@@ -120,6 +121,7 @@ common_shutdown_1(void *generic_ptr)
120121
#ifdef CONFIG_SMP
121122
/* Wait for the secondaries to halt. */
122123
cpu_clear(boot_cpuid, cpu_present_map);
124+
cpu_clear(boot_cpuid, cpu_possible_map);
123125
while (cpus_weight(cpu_present_map))
124126
barrier();
125127
#endif

‎arch/alpha/kernel/smp.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ enum ipi_message_type {
7070
/* Set to a secondary's cpuid when it comes online. */
7171
static int smp_secondary_alive __devinitdata = 0;
7272

73-
/* Which cpus ids came online. */
74-
cpumask_t cpu_online_map;
75-
76-
EXPORT_SYMBOL(cpu_online_map);
77-
7873
int smp_num_probed; /* Internal processor count */
7974
int smp_num_cpus = 1; /* Number that came online. */
8075
EXPORT_SYMBOL(smp_num_cpus);
@@ -440,6 +435,7 @@ setup_smp(void)
440435
((char *)cpubase + i*hwrpb->processor_size);
441436
if ((cpu->flags & 0x1cc) == 0x1cc) {
442437
smp_num_probed++;
438+
cpu_set(i, cpu_possible_map);
443439
cpu_set(i, cpu_present_map);
444440
cpu->pal_revision = boot_cpu_palrev;
445441
}
@@ -473,6 +469,7 @@ smp_prepare_cpus(unsigned int max_cpus)
473469

474470
/* Nothing to do on a UP box, or when told not to. */
475471
if (smp_num_probed == 1 || max_cpus == 0) {
472+
cpu_possible_map = cpumask_of_cpu(boot_cpuid);
476473
cpu_present_map = cpumask_of_cpu(boot_cpuid);
477474
printk(KERN_INFO "SMP mode deactivated.\n");
478475
return;

‎arch/arm/kernel/smp.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@
3333
#include <asm/tlbflush.h>
3434
#include <asm/ptrace.h>
3535

36-
/*
37-
* bitmask of present and online CPUs.
38-
* The present bitmask indicates that the CPU is physically present.
39-
* The online bitmask indicates that the CPU is up and running.
40-
*/
41-
cpumask_t cpu_possible_map;
42-
EXPORT_SYMBOL(cpu_possible_map);
43-
cpumask_t cpu_online_map;
44-
EXPORT_SYMBOL(cpu_online_map);
45-
4636
/*
4737
* as from 2.5, kernels no longer have an init_tasks structure
4838
* so we need some other way of telling a new secondary core

‎arch/cris/arch-v32/kernel/smp.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@
2929
spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};
3030

3131
/* CPU masks */
32-
cpumask_t cpu_online_map = CPU_MASK_NONE;
33-
EXPORT_SYMBOL(cpu_online_map);
3432
cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
35-
cpumask_t cpu_possible_map;
36-
EXPORT_SYMBOL(cpu_possible_map);
3733
EXPORT_SYMBOL(phys_cpu_present_map);
3834

3935
/* Variables used during SMP boot */

‎arch/cris/include/asm/smp.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <linux/cpumask.h>
55

66
extern cpumask_t phys_cpu_present_map;
7-
extern cpumask_t cpu_possible_map;
87

98
#define raw_smp_processor_id() (current_thread_info()->cpu)
109

‎arch/ia64/include/asm/smp.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ extern struct smp_boot_data {
5757

5858
extern char no_int_routing __devinitdata;
5959

60-
extern cpumask_t cpu_online_map;
6160
extern cpumask_t cpu_core_map[NR_CPUS];
6261
DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
6362
extern int smp_num_siblings;

‎arch/ia64/kernel/smpboot.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ struct task_struct *task_for_booting_cpu;
131131
*/
132132
DEFINE_PER_CPU(int, cpu_state);
133133

134-
/* Bitmasks of currently online, and possible CPUs */
135-
cpumask_t cpu_online_map;
136-
EXPORT_SYMBOL(cpu_online_map);
137-
cpumask_t cpu_possible_map = CPU_MASK_NONE;
138-
EXPORT_SYMBOL(cpu_possible_map);
139-
140134
cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
141135
EXPORT_SYMBOL(cpu_core_map);
142136
DEFINE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);

‎arch/m32r/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config M32R
1010
default y
1111
select HAVE_IDE
1212
select HAVE_OPROFILE
13+
select INIT_ALL_POSSIBLE
1314

1415
config SBUS
1516
bool

‎arch/m32r/kernel/smpboot.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,11 @@ static unsigned int bsp_phys_id = -1;
7373
/* Bitmask of physically existing CPUs */
7474
physid_mask_t phys_cpu_present_map;
7575

76-
/* Bitmask of currently online CPUs */
77-
cpumask_t cpu_online_map;
78-
EXPORT_SYMBOL(cpu_online_map);
79-
8076
cpumask_t cpu_bootout_map;
8177
cpumask_t cpu_bootin_map;
8278
static cpumask_t cpu_callin_map;
8379
cpumask_t cpu_callout_map;
8480
EXPORT_SYMBOL(cpu_callout_map);
85-
cpumask_t cpu_possible_map = CPU_MASK_ALL;
86-
EXPORT_SYMBOL(cpu_possible_map);
8781

8882
/* Per CPU bogomips and other parameters */
8983
struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned;

0 commit comments

Comments
 (0)