Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[sfrench/cifs-2.6.git] / init / main.c
index e8d080cab443750f7360d50bd32aa0c7644a6a4e..d3bcb3b11620784a37dd6d44561a874e9df1d982 100644 (file)
@@ -132,20 +132,9 @@ static char *static_command_line;
 static char *execute_command;
 static char *ramdisk_execute_command;
 
+#ifdef CONFIG_SMP
 /* Setup configured maximum number of CPUs to activate */
-static unsigned int max_cpus = NR_CPUS;
-
-/*
- * If set, this is an indication to the drivers that reset the underlying
- * device before going ahead with the initialization otherwise driver might
- * rely on the BIOS and skip the reset operation.
- *
- * This is useful if kernel is booting in an unreliable environment.
- * For ex. kdump situaiton where previous kernel has crashed, BIOS has been
- * skipped and devices will be in unknown state.
- */
-unsigned int reset_devices;
-EXPORT_SYMBOL(reset_devices);
+static unsigned int __initdata max_cpus = NR_CPUS;
 
 /*
  * Setup routine for controlling SMP activation
@@ -160,10 +149,10 @@ EXPORT_SYMBOL(reset_devices);
 static int __init nosmp(char *str)
 {
        max_cpus = 0;
-       return 1;
+       return 0;
 }
 
-__setup("nosmp", nosmp);
+early_param("nosmp", nosmp);
 
 static int __init maxcpus(char *str)
 {
@@ -172,6 +161,21 @@ static int __init maxcpus(char *str)
 }
 
 __setup("maxcpus=", maxcpus);
+#else
+#define max_cpus NR_CPUS
+#endif
+
+/*
+ * If set, this is an indication to the drivers that reset the underlying
+ * device before going ahead with the initialization otherwise driver might
+ * rely on the BIOS and skip the reset operation.
+ *
+ * This is useful if kernel is booting in an unreliable environment.
+ * For ex. kdump situaiton where previous kernel has crashed, BIOS has been
+ * skipped and devices will be in unknown state.
+ */
+unsigned int reset_devices;
+EXPORT_SYMBOL(reset_devices);
 
 static int __init set_reset_devices(char *str)
 {
@@ -385,6 +389,10 @@ static void __init smp_init(void)
 {
        unsigned int cpu;
 
+#ifndef CONFIG_HOTPLUG_CPU
+       cpu_possible_map = cpu_present_map;
+#endif
+
        /* FIXME: This should be done in userspace --RR */
        for_each_present_cpu(cpu) {
                if (num_online_cpus() >= max_cpus)
@@ -423,7 +431,7 @@ static void __init setup_command_line(char *command_line)
  * gcc-3.4 accidentally inlines this function, so use noinline.
  */
 
-static void noinline rest_init(void)
+static void noinline __init_refok rest_init(void)
        __releases(kernel_lock)
 {
        int pid;
@@ -436,15 +444,16 @@ static void noinline rest_init(void)
 
        /*
         * The boot idle thread must execute schedule()
-        * at least one to get things moving:
+        * at least once to get things moving:
         */
+       init_idle_bootup_task(current);
        preempt_enable_no_resched();
        schedule();
        preempt_disable();
 
        /* Call into cpu_idle with preempt disabled */
        cpu_idle();
-} 
+}
 
 /* Check for early params. */
 static int __init do_early_param(char *param, char *val)
@@ -452,7 +461,10 @@ static int __init do_early_param(char *param, char *val)
        struct obs_kernel_param *p;
 
        for (p = __setup_start; p < __setup_end; p++) {
-               if (p->early && strcmp(param, p->str) == 0) {
+               if ((p->early && strcmp(param, p->str) == 0) ||
+                   (strcmp(param, "console") == 0 &&
+                    strcmp(p->str, "earlycon") == 0)
+               ) {
                        if (p->setup_func(val) != 0)
                                printk(KERN_WARNING
                                       "Malformed early option '%s'\n", param);
@@ -525,6 +537,10 @@ asmlinkage void __init start_kernel(void)
        setup_arch(&command_line);
        setup_command_line(command_line);
        unwind_setup();
+#ifndef CONFIG_HOTPLUG_CPU
+       if (max_cpus < 2)
+               cpu_possible_map = cpu_online_map;
+#endif
        setup_per_cpu_areas();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
 
@@ -724,6 +740,15 @@ static void __init do_basic_setup(void)
        do_initcalls();
 }
 
+static int __initdata nosoftlockup;
+
+static int __init nosoftlockup_setup(char *str)
+{
+       nosoftlockup = 1;
+       return 1;
+}
+__setup("nosoftlockup", nosoftlockup_setup);
+
 static void __init do_pre_smp_initcalls(void)
 {
        extern int spawn_ksoftirqd(void);
@@ -733,7 +758,8 @@ static void __init do_pre_smp_initcalls(void)
        migration_init();
 #endif
        spawn_ksoftirqd();
-       spawn_softlockup_task();
+       if (!nosoftlockup)
+               spawn_softlockup_task();
 }
 
 static void run_init_process(char *init_filename)
@@ -801,6 +827,7 @@ static int __init kernel_init(void * unused)
         */
        init_pid_ns.child_reaper = current;
 
+       __set_special_pids(1, 1);
        cad_pid = task_pid(current);
 
        smp_prepare_cpus(max_cpus);