Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98a79d6a authored by Rusty Russell's avatar Rusty Russell
Browse files

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: default avatarRusty Russell <rusty@rustcorp.com.au>
Reviewed-by: default avatarGrant Grundler <grundler@parisc-linux.org>
Tested-by: default avatarTony Luck <tony.luck@intel.com>
Acked-by: default avatarIngo 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
parent 6c34bc29
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -45,7 +45,6 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS];
#define raw_smp_processor_id()	(current_thread_info()->cpu)

extern int smp_num_cpus;
#define cpu_possible_map	cpu_present_map

extern void arch_send_call_function_single_ipi(int cpu);
extern void arch_send_call_function_ipi(cpumask_t mask);
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ common_shutdown_1(void *generic_ptr)
		flags |= 0x00040000UL; /* "remain halted" */
		*pflags = flags;
		cpu_clear(cpuid, cpu_present_map);
		cpu_clear(cpuid, cpu_possible_map);
		halt();
	}
#endif
@@ -120,6 +121,7 @@ common_shutdown_1(void *generic_ptr)
#ifdef CONFIG_SMP
	/* Wait for the secondaries to halt. */
	cpu_clear(boot_cpuid, cpu_present_map);
	cpu_clear(boot_cpuid, cpu_possible_map);
	while (cpus_weight(cpu_present_map))
		barrier();
#endif
+2 −5
Original line number Diff line number Diff line
@@ -70,11 +70,6 @@ enum ipi_message_type {
/* Set to a secondary's cpuid when it comes online.  */
static int smp_secondary_alive __devinitdata = 0;

/* Which cpus ids came online.  */
cpumask_t cpu_online_map;

EXPORT_SYMBOL(cpu_online_map);

int smp_num_probed;		/* Internal processor count */
int smp_num_cpus = 1;		/* Number that came online.  */
EXPORT_SYMBOL(smp_num_cpus);
@@ -440,6 +435,7 @@ setup_smp(void)
				((char *)cpubase + i*hwrpb->processor_size);
			if ((cpu->flags & 0x1cc) == 0x1cc) {
				smp_num_probed++;
				cpu_set(i, cpu_possible_map);
				cpu_set(i, cpu_present_map);
				cpu->pal_revision = boot_cpu_palrev;
			}
@@ -473,6 +469,7 @@ smp_prepare_cpus(unsigned int max_cpus)

	/* Nothing to do on a UP box, or when told not to.  */
	if (smp_num_probed == 1 || max_cpus == 0) {
		cpu_possible_map = cpumask_of_cpu(boot_cpuid);
		cpu_present_map = cpumask_of_cpu(boot_cpuid);
		printk(KERN_INFO "SMP mode deactivated.\n");
		return;
+0 −10
Original line number Diff line number Diff line
@@ -33,16 +33,6 @@
#include <asm/tlbflush.h>
#include <asm/ptrace.h>

/*
 * bitmask of present and online CPUs.
 * The present bitmask indicates that the CPU is physically present.
 * The online bitmask indicates that the CPU is up and running.
 */
cpumask_t cpu_possible_map;
EXPORT_SYMBOL(cpu_possible_map);
cpumask_t cpu_online_map;
EXPORT_SYMBOL(cpu_online_map);

/*
 * as from 2.5, kernels no longer have an init_tasks structure
 * so we need some other way of telling a new secondary core
+0 −4
Original line number Diff line number Diff line
@@ -29,11 +29,7 @@
spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};

/* CPU masks */
cpumask_t cpu_online_map = CPU_MASK_NONE;
EXPORT_SYMBOL(cpu_online_map);
cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
cpumask_t cpu_possible_map;
EXPORT_SYMBOL(cpu_possible_map);
EXPORT_SYMBOL(phys_cpu_present_map);

/* Variables used during SMP boot */
Loading