aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2013-05-02 11:37:49 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2013-05-02 11:54:19 -0400
commitc032862fba51a3ca504752d3a25186b324c5ce83 (patch)
tree955dc2ba4ab3df76ecc2bb780ee84aca04967e8d /init/main.c
parentfda76e074c7737fc57855dd17c762e50ed526052 (diff)
parent8700c95adb033843fc163d112b9d21d4fda78018 (diff)
Merge commit '8700c95adb03' into timers/nohz
The full dynticks tree needs the latest RCU and sched upstream updates in order to fix some dependencies. Merge a common upstream merge point that has these updates. Conflicts: include/linux/perf_event.h kernel/rcutree.h kernel/rcutree_plugin.h Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/init/main.c b/init/main.c
index 2acb5bbde99b..1952bf2f6875 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. */
@@ -497,7 +498,7 @@ asmlinkage void __init start_kernel(void)
497 tick_init(); 498 tick_init();
498 boot_cpu_init(); 499 boot_cpu_init();
499 page_address_init(); 500 page_address_init();
500 printk(KERN_NOTICE "%s", linux_banner); 501 pr_notice("%s", linux_banner);
501 setup_arch(&command_line); 502 setup_arch(&command_line);
502 mm_init_owner(&init_mm, &init_task); 503 mm_init_owner(&init_mm, &init_task);
503 mm_init_cpumask(&init_mm); 504 mm_init_cpumask(&init_mm);
@@ -509,7 +510,7 @@ asmlinkage void __init start_kernel(void)
509 build_all_zonelists(NULL, NULL); 510 build_all_zonelists(NULL, NULL);
510 page_alloc_init(); 511 page_alloc_init();
511 512
512 printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); 513 pr_notice("Kernel command line: %s\n", boot_command_line);
513 parse_early_param(); 514 parse_early_param();
514 parse_args("Booting kernel", static_command_line, __start___param, 515 parse_args("Booting kernel", static_command_line, __start___param,
515 __stop___param - __start___param, 516 __stop___param - __start___param,
@@ -539,11 +540,8 @@ asmlinkage void __init start_kernel(void)
539 * fragile until we cpu_idle() for the first time. 540 * fragile until we cpu_idle() for the first time.
540 */ 541 */
541 preempt_disable(); 542 preempt_disable();
542 if (!irqs_disabled()) { 543 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(); 544 local_irq_disable();
546 }
547 idr_init_cache(); 545 idr_init_cache();
548 perf_event_init(); 546 perf_event_init();
549 rcu_init(); 547 rcu_init();
@@ -559,9 +557,7 @@ asmlinkage void __init start_kernel(void)
559 time_init(); 557 time_init();
560 profile_init(); 558 profile_init();
561 call_function_init(); 559 call_function_init();
562 if (!irqs_disabled()) 560 WARN(!irqs_disabled(), "Interrupts were enabled early\n");
563 printk(KERN_CRIT "start_kernel(): bug: interrupts were "
564 "enabled early\n");
565 early_boot_irqs_disabled = false; 561 early_boot_irqs_disabled = false;
566 local_irq_enable(); 562 local_irq_enable();
567 563
@@ -588,8 +584,7 @@ asmlinkage void __init start_kernel(void)
588#ifdef CONFIG_BLK_DEV_INITRD 584#ifdef CONFIG_BLK_DEV_INITRD
589 if (initrd_start && !initrd_below_start_ok && 585 if (initrd_start && !initrd_below_start_ok &&
590 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) {
591 printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " 587 pr_crit("initrd overwritten (0x%08lx < 0x%08lx) - disabling it.\n",
592 "disabling it.\n",
593 page_to_pfn(virt_to_page((void *)initrd_start)), 588 page_to_pfn(virt_to_page((void *)initrd_start)),
594 min_low_pfn); 589 min_low_pfn);
595 initrd_start = 0; 590 initrd_start = 0;
@@ -668,14 +663,14 @@ static int __init_or_module do_one_initcall_debug(initcall_t fn)
668 unsigned long long duration; 663 unsigned long long duration;
669 int ret; 664 int ret;
670 665
671 printk(KERN_DEBUG "calling %pF @ %i\n", fn, task_pid_nr(current)); 666 pr_debug("calling %pF @ %i\n", fn, task_pid_nr(current));
672 calltime = ktime_get(); 667 calltime = ktime_get();
673 ret = fn(); 668 ret = fn();
674 rettime = ktime_get(); 669 rettime = ktime_get();
675 delta = ktime_sub(rettime, calltime); 670 delta = ktime_sub(rettime, calltime);
676 duration = (unsigned long long) ktime_to_ns(delta) >> 10; 671 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
677 printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n", fn, 672 pr_debug("initcall %pF returned %d after %lld usecs\n",
678 ret, duration); 673 fn, ret, duration);
679 674
680 return ret; 675 return ret;
681} 676}
@@ -703,9 +698,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
703 strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); 698 strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf));
704 local_irq_enable(); 699 local_irq_enable();
705 } 700 }
706 if (msgbuf[0]) { 701 WARN(msgbuf[0], "initcall %pF returned with %s\n", fn, msgbuf);
707 printk("initcall %pF returned with %s\n", fn, msgbuf);
708 }
709 702
710 return ret; 703 return ret;
711} 704}
@@ -833,8 +826,7 @@ static int __ref kernel_init(void *unused)
833 if (ramdisk_execute_command) { 826 if (ramdisk_execute_command) {
834 if (!run_init_process(ramdisk_execute_command)) 827 if (!run_init_process(ramdisk_execute_command))
835 return 0; 828 return 0;
836 printk(KERN_WARNING "Failed to execute %s\n", 829 pr_err("Failed to execute %s\n", ramdisk_execute_command);
837 ramdisk_execute_command);
838 } 830 }
839 831
840 /* 832 /*
@@ -846,8 +838,8 @@ static int __ref kernel_init(void *unused)
846 if (execute_command) { 838 if (execute_command) {
847 if (!run_init_process(execute_command)) 839 if (!run_init_process(execute_command))
848 return 0; 840 return 0;
849 printk(KERN_WARNING "Failed to execute %s. Attempting " 841 pr_err("Failed to execute %s. Attempting defaults...\n",
850 "defaults...\n", execute_command); 842 execute_command);
851 } 843 }
852 if (!run_init_process("/sbin/init") || 844 if (!run_init_process("/sbin/init") ||
853 !run_init_process("/etc/init") || 845 !run_init_process("/etc/init") ||
@@ -892,7 +884,7 @@ static noinline void __init kernel_init_freeable(void)
892 884
893 /* Open the /dev/console on the rootfs, this should never fail */ 885 /* Open the /dev/console on the rootfs, this should never fail */
894 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) 886 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
895 printk(KERN_WARNING "Warning: unable to open an initial console.\n"); 887 pr_err("Warning: unable to open an initial console.\n");
896 888
897 (void) sys_dup(0); 889 (void) sys_dup(0);
898 (void) sys_dup(0); 890 (void) sys_dup(0);