X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=init%2Fmain.c;h=ee123243fb530b4d4e589f731c5bfa4652148dc8;hb=12cbbd95e12e911b43afae7f6f4850f616223642;hp=ae04eb78a93a6f4db0017ee0e4cbdec0d764e7d7;hpb=3e8d6ad9bf1f02fdb9fd119c3c266d4b73b7175d;p=linux-2.6 diff --git a/init/main.c b/init/main.c index ae04eb78a9..ee123243fb 100644 --- a/init/main.c +++ b/init/main.c @@ -9,9 +9,6 @@ * Simplified starting of init: Michael A. Griffith */ -#define __KERNEL_SYSCALLS__ - -#include #include #include #include @@ -42,12 +39,16 @@ #include #include #include +#include +#include #include #include #include #include #include #include +#include +#include #include #include @@ -124,6 +125,18 @@ static char *ramdisk_execute_command; /* 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); + /* * Setup routine for controlling SMP activation * @@ -150,6 +163,14 @@ static int __init maxcpus(char *str) __setup("maxcpus=", maxcpus); +static int __init set_reset_devices(char *str) +{ + reset_devices = 1; + return 1; +} + +__setup("reset_devices", set_reset_devices); + static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; static const char *panic_later, *panic_param; @@ -159,16 +180,19 @@ extern struct obs_kernel_param __setup_start[], __setup_end[]; static int __init obsolete_checksetup(char *line) { struct obs_kernel_param *p; + int had_early_param = 0; p = __setup_start; do { int n = strlen(p->str); if (!strncmp(line, p->str, n)) { if (p->early) { - /* Already done in parse_early_param? (Needs - * exact match on param part) */ + /* Already done in parse_early_param? + * (Needs exact match on param part). + * Keep iterating, as we can have early + * params and __setups of same names 8( */ if (line[n] == '\0' || line[n] == '=') - return 1; + had_early_param = 1; } else if (!p->setup_func) { printk(KERN_WARNING "Parameter %s is obsolete," " ignored\n", p->str); @@ -178,7 +202,8 @@ static int __init obsolete_checksetup(char *line) } p++; } while (p < __setup_end); - return 0; + + return had_early_param; } /* @@ -457,6 +482,17 @@ asmlinkage void __init start_kernel(void) smp_setup_processor_id(); + /* + * Need to run as early as possible, to initialize the + * lockdep hash: + */ + unwind_init(); + lockdep_init(); + + local_irq_disable(); + early_boot_irqs_off(); + early_init_irq_lock_class(); + /* * Interrupts are still disabled. Do necessary setups, then * enable them @@ -489,7 +525,6 @@ asmlinkage void __init start_kernel(void) __stop___param - __start___param, &unknown_bootoption); sort_main_extable(); - unwind_init(); trap_init(); rcu_init(); init_IRQ(); @@ -497,8 +532,13 @@ asmlinkage void __init start_kernel(void) init_timers(); hrtimers_init(); softirq_init(); - time_init(); timekeeping_init(); + time_init(); + profile_init(); + if (!irqs_disabled()) + printk("start_kernel(): bug: interrupts were enabled early\n"); + early_boot_irqs_on(); + local_irq_enable(); /* * HACK ALERT! This is early. We're enabling the console before @@ -508,8 +548,16 @@ asmlinkage void __init start_kernel(void) console_init(); if (panic_later) panic(panic_later, panic_param); - profile_init(); - local_irq_enable(); + + lockdep_info(); + + /* + * Need to run this when irqs are enabled, because it wants + * to self-test [hard/soft]-irqs on/off lock inversion bugs + * too: + */ + locking_selftest(); + #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && initrd_start < min_low_pfn << PAGE_SHIFT) { @@ -550,6 +598,8 @@ asmlinkage void __init start_kernel(void) proc_root_init(); #endif cpuset_init(); + taskstats_init_early(); + delayacct_init(); check_bugs(); @@ -651,7 +701,7 @@ static void do_pre_smp_initcalls(void) static void run_init_process(char *init_filename) { argv_init[0] = init_filename; - execve(init_filename, argv_init, envp_init); + kernel_execve(init_filename, argv_init, envp_init); } static int init(void * unused) @@ -671,6 +721,8 @@ static int init(void * unused) */ child_reaper = current; + cad_pid = task_pid(current); + smp_prepare_cpus(max_cpus); do_pre_smp_initcalls();