89
89
hotplug_cfd(&hotplug_cfd_notifier, CPU_UP_PREPARE, cpu);
90
90
register_cpu_notifier(&hotplug_cfd_notifier);
94
early_initcall(init_call_single_data);
97
94
* csd_lock/csd_unlock used to serialize access to per-cpu csd resources
214
211
if (atomic_read(&data->refs) == 0)
217
func = data->csd.func; /* for later warn */
218
data->csd.func(data->csd.info);
214
func = data->csd.func; /* save for later warn */
215
func(data->csd.info);
221
* If the cpu mask is not still set then it enabled interrupts,
222
* we took another smp interrupt, and executed the function
223
* twice on this cpu. In theory that copy decremented refs.
218
* If the cpu mask is not still set then func enabled
219
* interrupts (BUG), and this cpu took another smp call
220
* function interrupt and executed func(info) twice
221
* on this cpu. That nested execution decremented refs.
225
223
if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) {
226
WARN(1, "%pS enabled interrupts and double executed\n",
224
WARN(1, "%pf enabled interrupts and double executed\n", func);
605
602
#endif /* USE_GENERIC_SMP_HELPERS */
604
/* Setup configured maximum number of CPUs to activate */
605
unsigned int setup_max_cpus = NR_CPUS;
606
EXPORT_SYMBOL(setup_max_cpus);
610
* Setup routine for controlling SMP activation
612
* Command-line option of "nosmp" or "maxcpus=0" will disable SMP
613
* activation entirely (the MPS table probe still happens, though).
615
* Command-line option of "maxcpus=<NUM>", where <NUM> is an integer
616
* greater than 0, limits the maximum number of CPUs activated in
620
void __weak arch_disable_smp_support(void) { }
622
static int __init nosmp(char *str)
625
arch_disable_smp_support();
630
early_param("nosmp", nosmp);
632
/* this is hard limit */
633
static int __init nrcpus(char *str)
637
get_option(&str, &nr_cpus);
638
if (nr_cpus > 0 && nr_cpus < nr_cpu_ids)
639
nr_cpu_ids = nr_cpus;
644
early_param("nr_cpus", nrcpus);
646
static int __init maxcpus(char *str)
648
get_option(&str, &setup_max_cpus);
649
if (setup_max_cpus == 0)
650
arch_disable_smp_support();
655
early_param("maxcpus", maxcpus);
657
/* Setup number of possible processor ids */
658
int nr_cpu_ids __read_mostly = NR_CPUS;
659
EXPORT_SYMBOL(nr_cpu_ids);
661
/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
662
void __init setup_nr_cpu_ids(void)
664
nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
667
/* Called by boot processor to activate the rest. */
668
void __init smp_init(void)
672
/* FIXME: This should be done in userspace --RR */
673
for_each_present_cpu(cpu) {
674
if (num_online_cpus() >= setup_max_cpus)
676
if (!cpu_online(cpu))
680
/* Any cleanup work */
681
printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus());
682
smp_cpus_done(setup_max_cpus);
608
686
* Call a function on all processors. May be used during early boot while
609
687
* early_boot_irqs_disabled is set. Use local_irq_save/restore() instead