X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=init%2Fmain.c;h=cb81ed116f62b3cadbde986e508081295c0446d9;hb=9706501e43a80ce48b319214a0a9e562deded35b;hp=0eb1c7463fe4d08c3012ee66cb486c72122a26d5;hpb=0806ca2ab3ef7d7a1bd41a980f661a13ba11acb5;p=linux-2.6-omap-h63xx.git diff --git a/init/main.c b/init/main.c index 0eb1c7463fe..cb81ed116f6 100644 --- a/init/main.c +++ b/init/main.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -55,6 +56,7 @@ #include #include #include +#include #include #include @@ -69,15 +71,7 @@ /* * This is one of the first .c files built. Error out early if we have compiler * trouble. - * - * Versions of gcc older than that listed below may actually compile and link - * okay, but the end product can have subtle run time bugs. To avoid associated - * bogus bug reports, we flatly refuse to compile with a gcc that is known to be - * too old from the very beginning. */ -#if (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 2) -#error Sorry, your GCC is too old. It builds incorrect kernels. -#endif #if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0 #warning gcc-4.1.0 is known to miscompile the kernel. A different compiler version is recommended. @@ -132,20 +126,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); +unsigned int __initdata setup_max_cpus = NR_CPUS; /* * Setup routine for controlling SMP activation @@ -157,21 +140,44 @@ EXPORT_SYMBOL(reset_devices); * greater than 0, limits the maximum number of CPUs activated in * SMP mode to . */ +#ifndef CONFIG_X86_IO_APIC +static inline void disable_ioapic_setup(void) {}; +#endif + static int __init nosmp(char *str) { - max_cpus = 0; - return 1; + setup_max_cpus = 0; + disable_ioapic_setup(); + return 0; } -__setup("nosmp", nosmp); +early_param("nosmp", nosmp); static int __init maxcpus(char *str) { - get_option(&str, &max_cpus); - return 1; + get_option(&str, &setup_max_cpus); + if (setup_max_cpus == 0) + disable_ioapic_setup(); + + return 0; } -__setup("maxcpus=", maxcpus); +early_param("maxcpus", maxcpus); +#else +#define setup_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) { @@ -275,7 +281,7 @@ static int __init unknown_bootoption(char *param, char *val) return 0; /* - * Preemptive maintenance for "why didn't my mispelled command + * Preemptive maintenance for "why didn't my misspelled command * line work?" */ if (strchr(param, '.') && (!val || strchr(param, '.') < val)) { @@ -312,6 +318,10 @@ static int __init unknown_bootoption(char *param, char *val) return 0; } +#ifdef CONFIG_DEBUG_PAGEALLOC +int __read_mostly debug_pagealloc_enabled = 0; +#endif + static int __init init_setup(char *str) { unsigned int i; @@ -357,7 +367,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { } #else -#ifdef __GENERIC_PER_CPU +#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA unsigned long __per_cpu_offset[NR_CPUS] __read_mostly; EXPORT_SYMBOL(__per_cpu_offset); @@ -378,7 +388,7 @@ static void __init setup_per_cpu_areas(void) ptr += size; } } -#endif /* !__GENERIC_PER_CPU */ +#endif /* CONFIG_HAVE_SETUP_PER_CPU_AREA */ /* Called by boot processor to activate the rest. */ static void __init smp_init(void) @@ -387,7 +397,7 @@ static void __init smp_init(void) /* FIXME: This should be done in userspace --RR */ for_each_present_cpu(cpu) { - if (num_online_cpus() >= max_cpus) + if (num_online_cpus() >= setup_max_cpus) break; if (!cpu_online(cpu)) cpu_up(cpu); @@ -395,7 +405,7 @@ static void __init smp_init(void) /* Any cleanup work */ printk(KERN_INFO "Brought up %ld CPUs\n", (long)num_online_cpus()); - smp_cpus_done(max_cpus); + smp_cpus_done(setup_max_cpus); } #endif @@ -453,7 +463,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); @@ -508,6 +521,7 @@ asmlinkage void __init start_kernel(void) */ unwind_init(); lockdep_init(); + cgroup_init_early(); local_irq_disable(); early_boot_irqs_off(); @@ -542,6 +556,7 @@ asmlinkage void __init start_kernel(void) preempt_disable(); build_all_zonelists(); page_alloc_init(); + enable_debug_pagealloc(); printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); parse_early_param(); parse_args("Booting kernel", static_command_line, __start___param, @@ -597,6 +612,7 @@ asmlinkage void __init start_kernel(void) vfs_caches_init_early(); cpuset_init_early(); mem_init(); + cpu_hotplug_init(); kmem_cache_init(); setup_per_cpu_pageset(); numa_policy_init(); @@ -625,6 +641,7 @@ asmlinkage void __init start_kernel(void) #ifdef CONFIG_PROC_FS proc_root_init(); #endif + cgroup_init(); cpuset_init(); taskstats_init_early(); delayacct_init(); @@ -725,16 +742,23 @@ 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); -#ifdef CONFIG_SMP - extern int migration_init(void); migration_init(); -#endif spawn_ksoftirqd(); - spawn_softlockup_task(); + if (!nosoftlockup) + spawn_softlockup_task(); } static void run_init_process(char *init_filename) @@ -805,7 +829,7 @@ static int __init kernel_init(void * unused) __set_special_pids(1, 1); cad_pid = task_pid(current); - smp_prepare_cpus(max_cpus); + smp_prepare_cpus(setup_max_cpus); do_pre_smp_initcalls();