diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/init/main.c b/init/main.c index 63534a141b4e..9484f4ba88d0 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * Simplified starting of init: Michael A. Griffith <grif@acm.org> | 9 | * Simplified starting of init: Michael A. Griffith <grif@acm.org> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define DEBUG /* Enable initcall_debug */ | ||
13 | |||
12 | #include <linux/types.h> | 14 | #include <linux/types.h> |
13 | #include <linux/module.h> | 15 | #include <linux/module.h> |
14 | #include <linux/proc_fs.h> | 16 | #include <linux/proc_fs.h> |
@@ -174,8 +176,8 @@ static int __init obsolete_checksetup(char *line) | |||
174 | if (line[n] == '\0' || line[n] == '=') | 176 | if (line[n] == '\0' || line[n] == '=') |
175 | had_early_param = 1; | 177 | had_early_param = 1; |
176 | } else if (!p->setup_func) { | 178 | } else if (!p->setup_func) { |
177 | printk(KERN_WARNING "Parameter %s is obsolete," | 179 | pr_warn("Parameter %s is obsolete, ignored\n", |
178 | " ignored\n", p->str); | 180 | p->str); |
179 | return 1; | 181 | return 1; |
180 | } else if (p->setup_func(line + n)) | 182 | } else if (p->setup_func(line + n)) |
181 | return 1; | 183 | return 1; |
@@ -384,7 +386,7 @@ static noinline void __init_refok rest_init(void) | |||
384 | init_idle_bootup_task(current); | 386 | init_idle_bootup_task(current); |
385 | schedule_preempt_disabled(); | 387 | schedule_preempt_disabled(); |
386 | /* Call into cpu_idle with preempt disabled */ | 388 | /* Call into cpu_idle with preempt disabled */ |
387 | cpu_idle(); | 389 | cpu_startup_entry(CPUHP_ONLINE); |
388 | } | 390 | } |
389 | 391 | ||
390 | /* Check for early params. */ | 392 | /* Check for early params. */ |
@@ -398,8 +400,7 @@ static int __init do_early_param(char *param, char *val, const char *unused) | |||
398 | strcmp(p->str, "earlycon") == 0) | 400 | strcmp(p->str, "earlycon") == 0) |
399 | ) { | 401 | ) { |
400 | if (p->setup_func(val) != 0) | 402 | if (p->setup_func(val) != 0) |
401 | printk(KERN_WARNING | 403 | pr_warn("Malformed early option '%s'\n", param); |
402 | "Malformed early option '%s'\n", param); | ||
403 | } | 404 | } |
404 | } | 405 | } |
405 | /* We accept everything at this stage. */ | 406 | /* We accept everything at this stage. */ |
@@ -494,10 +495,9 @@ asmlinkage void __init start_kernel(void) | |||
494 | * Interrupts are still disabled. Do necessary setups, then | 495 | * Interrupts are still disabled. Do necessary setups, then |
495 | * enable them | 496 | * enable them |
496 | */ | 497 | */ |
497 | tick_init(); | ||
498 | boot_cpu_init(); | 498 | boot_cpu_init(); |
499 | page_address_init(); | 499 | page_address_init(); |
500 | printk(KERN_NOTICE "%s", linux_banner); | 500 | pr_notice("%s", linux_banner); |
501 | setup_arch(&command_line); | 501 | setup_arch(&command_line); |
502 | mm_init_owner(&init_mm, &init_task); | 502 | mm_init_owner(&init_mm, &init_task); |
503 | mm_init_cpumask(&init_mm); | 503 | mm_init_cpumask(&init_mm); |
@@ -509,7 +509,7 @@ asmlinkage void __init start_kernel(void) | |||
509 | build_all_zonelists(NULL, NULL); | 509 | build_all_zonelists(NULL, NULL); |
510 | page_alloc_init(); | 510 | page_alloc_init(); |
511 | 511 | ||
512 | printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); | 512 | pr_notice("Kernel command line: %s\n", boot_command_line); |
513 | parse_early_param(); | 513 | parse_early_param(); |
514 | parse_args("Booting kernel", static_command_line, __start___param, | 514 | parse_args("Booting kernel", static_command_line, __start___param, |
515 | __stop___param - __start___param, | 515 | __stop___param - __start___param, |
@@ -539,18 +539,17 @@ asmlinkage void __init start_kernel(void) | |||
539 | * fragile until we cpu_idle() for the first time. | 539 | * fragile until we cpu_idle() for the first time. |
540 | */ | 540 | */ |
541 | preempt_disable(); | 541 | preempt_disable(); |
542 | if (!irqs_disabled()) { | 542 | if (WARN(!irqs_disabled(), "Interrupts were enabled *very* early, fixing it\n")) |
543 | printk(KERN_WARNING "start_kernel(): bug: interrupts were " | ||
544 | "enabled *very* early, fixing it\n"); | ||
545 | local_irq_disable(); | 543 | local_irq_disable(); |
546 | } | ||
547 | idr_init_cache(); | 544 | idr_init_cache(); |
548 | perf_event_init(); | 545 | perf_event_init(); |
549 | rcu_init(); | 546 | rcu_init(); |
547 | tick_nohz_init(); | ||
550 | radix_tree_init(); | 548 | radix_tree_init(); |
551 | /* init some links before init_ISA_irqs() */ | 549 | /* init some links before init_ISA_irqs() */ |
552 | early_irq_init(); | 550 | early_irq_init(); |
553 | init_IRQ(); | 551 | init_IRQ(); |
552 | tick_init(); | ||
554 | init_timers(); | 553 | init_timers(); |
555 | hrtimers_init(); | 554 | hrtimers_init(); |
556 | softirq_init(); | 555 | softirq_init(); |
@@ -558,9 +557,7 @@ asmlinkage void __init start_kernel(void) | |||
558 | time_init(); | 557 | time_init(); |
559 | profile_init(); | 558 | profile_init(); |
560 | call_function_init(); | 559 | call_function_init(); |
561 | if (!irqs_disabled()) | 560 | WARN(!irqs_disabled(), "Interrupts were enabled early\n"); |
562 | printk(KERN_CRIT "start_kernel(): bug: interrupts were " | ||
563 | "enabled early\n"); | ||
564 | early_boot_irqs_disabled = false; | 561 | early_boot_irqs_disabled = false; |
565 | local_irq_enable(); | 562 | local_irq_enable(); |
566 | 563 | ||
@@ -587,8 +584,7 @@ asmlinkage void __init start_kernel(void) | |||
587 | #ifdef CONFIG_BLK_DEV_INITRD | 584 | #ifdef CONFIG_BLK_DEV_INITRD |
588 | if (initrd_start && !initrd_below_start_ok && | 585 | if (initrd_start && !initrd_below_start_ok && |
589 | page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) { | 586 | page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) { |
590 | printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " | 587 | pr_crit("initrd overwritten (0x%08lx < 0x%08lx) - disabling it.\n", |
591 | "disabling it.\n", | ||
592 | page_to_pfn(virt_to_page((void *)initrd_start)), | 588 | page_to_pfn(virt_to_page((void *)initrd_start)), |
593 | min_low_pfn); | 589 | min_low_pfn); |
594 | initrd_start = 0; | 590 | initrd_start = 0; |
@@ -667,14 +663,14 @@ static int __init_or_module do_one_initcall_debug(initcall_t fn) | |||
667 | unsigned long long duration; | 663 | unsigned long long duration; |
668 | int ret; | 664 | int ret; |
669 | 665 | ||
670 | printk(KERN_DEBUG "calling %pF @ %i\n", fn, task_pid_nr(current)); | 666 | pr_debug("calling %pF @ %i\n", fn, task_pid_nr(current)); |
671 | calltime = ktime_get(); | 667 | calltime = ktime_get(); |
672 | ret = fn(); | 668 | ret = fn(); |
673 | rettime = ktime_get(); | 669 | rettime = ktime_get(); |
674 | delta = ktime_sub(rettime, calltime); | 670 | delta = ktime_sub(rettime, calltime); |
675 | duration = (unsigned long long) ktime_to_ns(delta) >> 10; | 671 | duration = (unsigned long long) ktime_to_ns(delta) >> 10; |
676 | printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n", fn, | 672 | pr_debug("initcall %pF returned %d after %lld usecs\n", |
677 | ret, duration); | 673 | fn, ret, duration); |
678 | 674 | ||
679 | return ret; | 675 | return ret; |
680 | } | 676 | } |
@@ -691,20 +687,15 @@ int __init_or_module do_one_initcall(initcall_t fn) | |||
691 | 687 | ||
692 | msgbuf[0] = 0; | 688 | msgbuf[0] = 0; |
693 | 689 | ||
694 | if (ret && ret != -ENODEV && initcall_debug) | ||
695 | sprintf(msgbuf, "error code %d ", ret); | ||
696 | |||
697 | if (preempt_count() != count) { | 690 | if (preempt_count() != count) { |
698 | strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); | 691 | sprintf(msgbuf, "preemption imbalance "); |
699 | preempt_count() = count; | 692 | preempt_count() = count; |
700 | } | 693 | } |
701 | if (irqs_disabled()) { | 694 | if (irqs_disabled()) { |
702 | strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); | 695 | strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); |
703 | local_irq_enable(); | 696 | local_irq_enable(); |
704 | } | 697 | } |
705 | if (msgbuf[0]) { | 698 | WARN(msgbuf[0], "initcall %pF returned with %s\n", fn, msgbuf); |
706 | printk("initcall %pF returned with %s\n", fn, msgbuf); | ||
707 | } | ||
708 | 699 | ||
709 | return ret; | 700 | return ret; |
710 | } | 701 | } |
@@ -832,8 +823,7 @@ static int __ref kernel_init(void *unused) | |||
832 | if (ramdisk_execute_command) { | 823 | if (ramdisk_execute_command) { |
833 | if (!run_init_process(ramdisk_execute_command)) | 824 | if (!run_init_process(ramdisk_execute_command)) |
834 | return 0; | 825 | return 0; |
835 | printk(KERN_WARNING "Failed to execute %s\n", | 826 | pr_err("Failed to execute %s\n", ramdisk_execute_command); |
836 | ramdisk_execute_command); | ||
837 | } | 827 | } |
838 | 828 | ||
839 | /* | 829 | /* |
@@ -845,8 +835,8 @@ static int __ref kernel_init(void *unused) | |||
845 | if (execute_command) { | 835 | if (execute_command) { |
846 | if (!run_init_process(execute_command)) | 836 | if (!run_init_process(execute_command)) |
847 | return 0; | 837 | return 0; |
848 | printk(KERN_WARNING "Failed to execute %s. Attempting " | 838 | pr_err("Failed to execute %s. Attempting defaults...\n", |
849 | "defaults...\n", execute_command); | 839 | execute_command); |
850 | } | 840 | } |
851 | if (!run_init_process("/sbin/init") || | 841 | if (!run_init_process("/sbin/init") || |
852 | !run_init_process("/etc/init") || | 842 | !run_init_process("/etc/init") || |
@@ -891,7 +881,7 @@ static noinline void __init kernel_init_freeable(void) | |||
891 | 881 | ||
892 | /* Open the /dev/console on the rootfs, this should never fail */ | 882 | /* Open the /dev/console on the rootfs, this should never fail */ |
893 | if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) | 883 | if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) |
894 | printk(KERN_WARNING "Warning: unable to open an initial console.\n"); | 884 | pr_err("Warning: unable to open an initial console.\n"); |
895 | 885 | ||
896 | (void) sys_dup(0); | 886 | (void) sys_dup(0); |
897 | (void) sys_dup(0); | 887 | (void) sys_dup(0); |