aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-18 12:37:14 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-18 12:37:14 -0500
commitb2b062b8163391c42b3219d466ca1ac9742b9c7b (patch)
treef3f920c09b8de694b1bc1d4b878cfd2b0b98c913 /init/main.c
parenta9de18eb761f7c1c860964b2e5addc1a35c7e861 (diff)
parent99937d6455cea95405ac681c86a857d0fcd530bd (diff)
Merge branch 'core/percpu' into stackprotector
Conflicts: arch/x86/include/asm/pda.h arch/x86/include/asm/system.h Also, moved include/asm-x86/stackprotector.h to arch/x86/include/asm. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c48
1 files changed, 13 insertions, 35 deletions
diff --git a/init/main.c b/init/main.c
index 07da4dea50c3..bfe4fb0c9842 100644
--- a/init/main.c
+++ b/init/main.c
@@ -51,7 +51,6 @@
51#include <linux/rmap.h> 51#include <linux/rmap.h>
52#include <linux/mempolicy.h> 52#include <linux/mempolicy.h>
53#include <linux/key.h> 53#include <linux/key.h>
54#include <linux/unwind.h>
55#include <linux/buffer_head.h> 54#include <linux/buffer_head.h>
56#include <linux/page_cgroup.h> 55#include <linux/page_cgroup.h>
57#include <linux/debug_locks.h> 56#include <linux/debug_locks.h>
@@ -64,6 +63,7 @@
64#include <linux/signal.h> 63#include <linux/signal.h>
65#include <linux/idr.h> 64#include <linux/idr.h>
66#include <linux/ftrace.h> 65#include <linux/ftrace.h>
66#include <linux/async.h>
67#include <trace/boot.h> 67#include <trace/boot.h>
68 68
69#include <asm/io.h> 69#include <asm/io.h>
@@ -76,15 +76,6 @@
76#include <asm/smp.h> 76#include <asm/smp.h>
77#endif 77#endif
78 78
79/*
80 * This is one of the first .c files built. Error out early if we have compiler
81 * trouble.
82 */
83
84#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0
85#warning gcc-4.1.0 is known to miscompile the kernel. A different compiler version is recommended.
86#endif
87
88static int kernel_init(void *); 79static int kernel_init(void *);
89 80
90extern void init_IRQ(void); 81extern void init_IRQ(void);
@@ -118,7 +109,7 @@ EXPORT_SYMBOL(system_state);
118 109
119extern void time_init(void); 110extern void time_init(void);
120/* Default late time init is NULL. archs can override this later. */ 111/* Default late time init is NULL. archs can override this later. */
121void (*late_time_init)(void); 112void (*__initdata late_time_init)(void);
122extern void softirq_init(void); 113extern void softirq_init(void);
123 114
124/* Untouched command line saved by arch-specific code. */ 115/* Untouched command line saved by arch-specific code. */
@@ -381,12 +372,7 @@ EXPORT_SYMBOL(nr_cpu_ids);
381/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */ 372/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
382static void __init setup_nr_cpu_ids(void) 373static void __init setup_nr_cpu_ids(void)
383{ 374{
384 int cpu, highest_cpu = 0; 375 nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
385
386 for_each_possible_cpu(cpu)
387 highest_cpu = cpu;
388
389 nr_cpu_ids = highest_cpu + 1;
390} 376}
391 377
392#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 378#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
@@ -462,7 +448,7 @@ static void __init setup_command_line(char *command_line)
462 * gcc-3.4 accidentally inlines this function, so use noinline. 448 * gcc-3.4 accidentally inlines this function, so use noinline.
463 */ 449 */
464 450
465static void noinline __init_refok rest_init(void) 451static noinline void __init_refok rest_init(void)
466 __releases(kernel_lock) 452 __releases(kernel_lock)
467{ 453{
468 int pid; 454 int pid;
@@ -528,9 +514,9 @@ static void __init boot_cpu_init(void)
528{ 514{
529 int cpu = smp_processor_id(); 515 int cpu = smp_processor_id();
530 /* Mark the boot cpu "present", "online" etc for SMP and UP case */ 516 /* Mark the boot cpu "present", "online" etc for SMP and UP case */
531 cpu_set(cpu, cpu_online_map); 517 set_cpu_online(cpu, true);
532 cpu_set(cpu, cpu_present_map); 518 set_cpu_present(cpu, true);
533 cpu_set(cpu, cpu_possible_map); 519 set_cpu_possible(cpu, true);
534} 520}
535 521
536void __init __weak smp_setup_processor_id(void) 522void __init __weak smp_setup_processor_id(void)
@@ -541,15 +527,6 @@ void __init __weak thread_info_cache_init(void)
541{ 527{
542} 528}
543 529
544void __init __weak arch_early_irq_init(void)
545{
546}
547
548void __init __weak early_irq_init(void)
549{
550 arch_early_irq_init();
551}
552
553asmlinkage void __init start_kernel(void) 530asmlinkage void __init start_kernel(void)
554{ 531{
555 char * command_line; 532 char * command_line;
@@ -561,7 +538,6 @@ asmlinkage void __init start_kernel(void)
561 * Need to run as early as possible, to initialize the 538 * Need to run as early as possible, to initialize the
562 * lockdep hash: 539 * lockdep hash:
563 */ 540 */
564 unwind_init();
565 lockdep_init(); 541 lockdep_init();
566 debug_objects_early_init(); 542 debug_objects_early_init();
567 543
@@ -589,7 +565,6 @@ asmlinkage void __init start_kernel(void)
589 setup_arch(&command_line); 565 setup_arch(&command_line);
590 mm_init_owner(&init_mm, &init_task); 566 mm_init_owner(&init_mm, &init_task);
591 setup_command_line(command_line); 567 setup_command_line(command_line);
592 unwind_setup();
593 setup_per_cpu_areas(); 568 setup_per_cpu_areas();
594 setup_nr_cpu_ids(); 569 setup_nr_cpu_ids();
595 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ 570 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
@@ -632,7 +607,8 @@ asmlinkage void __init start_kernel(void)
632 sched_clock_init(); 607 sched_clock_init();
633 profile_init(); 608 profile_init();
634 if (!irqs_disabled()) 609 if (!irqs_disabled())
635 printk("start_kernel(): bug: interrupts were enabled early\n"); 610 printk(KERN_CRIT "start_kernel(): bug: interrupts were "
611 "enabled early\n");
636 early_boot_irqs_on(); 612 early_boot_irqs_on();
637 local_irq_enable(); 613 local_irq_enable();
638 614
@@ -717,7 +693,7 @@ asmlinkage void __init start_kernel(void)
717 rest_init(); 693 rest_init();
718} 694}
719 695
720static int initcall_debug; 696int initcall_debug;
721core_param(initcall_debug, initcall_debug, bool, 0644); 697core_param(initcall_debug, initcall_debug, bool, 0644);
722 698
723int do_one_initcall(initcall_t fn) 699int do_one_initcall(initcall_t fn)
@@ -816,8 +792,10 @@ static void run_init_process(char *init_filename)
816/* This is a non __init function. Force it to be noinline otherwise gcc 792/* This is a non __init function. Force it to be noinline otherwise gcc
817 * makes it inline to init() and it becomes part of init.text section 793 * makes it inline to init() and it becomes part of init.text section
818 */ 794 */
819static int noinline init_post(void) 795static noinline int init_post(void)
820{ 796{
797 /* need to finish all async __init code before freeing the memory */
798 async_synchronize_full();
821 free_initmem(); 799 free_initmem();
822 unlock_kernel(); 800 unlock_kernel();
823 mark_rodata_ro(); 801 mark_rodata_ro();