diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/init/main.c b/init/main.c index 844209453c02..3585f073d636 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/proc_fs.h> | 14 | #include <linux/proc_fs.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
17 | #include <linux/stackprotector.h> | ||
17 | #include <linux/string.h> | 18 | #include <linux/string.h> |
18 | #include <linux/ctype.h> | 19 | #include <linux/ctype.h> |
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
@@ -70,6 +71,7 @@ | |||
70 | #include <asm/setup.h> | 71 | #include <asm/setup.h> |
71 | #include <asm/sections.h> | 72 | #include <asm/sections.h> |
72 | #include <asm/cacheflush.h> | 73 | #include <asm/cacheflush.h> |
74 | #include <trace/kmemtrace.h> | ||
73 | 75 | ||
74 | #ifdef CONFIG_X86_LOCAL_APIC | 76 | #ifdef CONFIG_X86_LOCAL_APIC |
75 | #include <asm/smp.h> | 77 | #include <asm/smp.h> |
@@ -97,7 +99,7 @@ static inline void mark_rodata_ro(void) { } | |||
97 | extern void tc_init(void); | 99 | extern void tc_init(void); |
98 | #endif | 100 | #endif |
99 | 101 | ||
100 | enum system_states system_state; | 102 | enum system_states system_state __read_mostly; |
101 | EXPORT_SYMBOL(system_state); | 103 | EXPORT_SYMBOL(system_state); |
102 | 104 | ||
103 | /* | 105 | /* |
@@ -135,14 +137,14 @@ unsigned int __initdata setup_max_cpus = NR_CPUS; | |||
135 | * greater than 0, limits the maximum number of CPUs activated in | 137 | * greater than 0, limits the maximum number of CPUs activated in |
136 | * SMP mode to <NUM>. | 138 | * SMP mode to <NUM>. |
137 | */ | 139 | */ |
138 | #ifndef CONFIG_X86_IO_APIC | 140 | |
139 | static inline void disable_ioapic_setup(void) {}; | 141 | void __weak arch_disable_smp_support(void) { } |
140 | #endif | ||
141 | 142 | ||
142 | static int __init nosmp(char *str) | 143 | static int __init nosmp(char *str) |
143 | { | 144 | { |
144 | setup_max_cpus = 0; | 145 | setup_max_cpus = 0; |
145 | disable_ioapic_setup(); | 146 | arch_disable_smp_support(); |
147 | |||
146 | return 0; | 148 | return 0; |
147 | } | 149 | } |
148 | 150 | ||
@@ -152,14 +154,14 @@ static int __init maxcpus(char *str) | |||
152 | { | 154 | { |
153 | get_option(&str, &setup_max_cpus); | 155 | get_option(&str, &setup_max_cpus); |
154 | if (setup_max_cpus == 0) | 156 | if (setup_max_cpus == 0) |
155 | disable_ioapic_setup(); | 157 | arch_disable_smp_support(); |
156 | 158 | ||
157 | return 0; | 159 | return 0; |
158 | } | 160 | } |
159 | 161 | ||
160 | early_param("maxcpus", maxcpus); | 162 | early_param("maxcpus", maxcpus); |
161 | #else | 163 | #else |
162 | #define setup_max_cpus NR_CPUS | 164 | const unsigned int setup_max_cpus = NR_CPUS; |
163 | #endif | 165 | #endif |
164 | 166 | ||
165 | /* | 167 | /* |
@@ -406,8 +408,7 @@ static void __init smp_init(void) | |||
406 | * Set up the current CPU as possible to migrate to. | 408 | * Set up the current CPU as possible to migrate to. |
407 | * The other ones will be done by cpu_up/cpu_down() | 409 | * The other ones will be done by cpu_up/cpu_down() |
408 | */ | 410 | */ |
409 | cpu = smp_processor_id(); | 411 | set_cpu_active(smp_processor_id(), true); |
410 | cpu_set(cpu, cpu_active_map); | ||
411 | 412 | ||
412 | /* FIXME: This should be done in userspace --RR */ | 413 | /* FIXME: This should be done in userspace --RR */ |
413 | for_each_present_cpu(cpu) { | 414 | for_each_present_cpu(cpu) { |
@@ -463,6 +464,7 @@ static noinline void __init_refok rest_init(void) | |||
463 | * at least once to get things moving: | 464 | * at least once to get things moving: |
464 | */ | 465 | */ |
465 | init_idle_bootup_task(current); | 466 | init_idle_bootup_task(current); |
467 | rcu_scheduler_starting(); | ||
466 | preempt_enable_no_resched(); | 468 | preempt_enable_no_resched(); |
467 | schedule(); | 469 | schedule(); |
468 | preempt_disable(); | 470 | preempt_disable(); |
@@ -539,6 +541,12 @@ asmlinkage void __init start_kernel(void) | |||
539 | */ | 541 | */ |
540 | lockdep_init(); | 542 | lockdep_init(); |
541 | debug_objects_early_init(); | 543 | debug_objects_early_init(); |
544 | |||
545 | /* | ||
546 | * Set up the the initial canary ASAP: | ||
547 | */ | ||
548 | boot_init_stack_canary(); | ||
549 | |||
542 | cgroup_init_early(); | 550 | cgroup_init_early(); |
543 | 551 | ||
544 | local_irq_disable(); | 552 | local_irq_disable(); |
@@ -641,6 +649,7 @@ asmlinkage void __init start_kernel(void) | |||
641 | enable_debug_pagealloc(); | 649 | enable_debug_pagealloc(); |
642 | cpu_hotplug_init(); | 650 | cpu_hotplug_init(); |
643 | kmem_cache_init(); | 651 | kmem_cache_init(); |
652 | kmemtrace_init(); | ||
644 | debug_objects_mem_init(); | 653 | debug_objects_mem_init(); |
645 | idr_init_cache(); | 654 | idr_init_cache(); |
646 | setup_per_cpu_pageset(); | 655 | setup_per_cpu_pageset(); |
@@ -762,6 +771,7 @@ static void __init do_basic_setup(void) | |||
762 | { | 771 | { |
763 | rcu_init_sched(); /* needed by module_init stage. */ | 772 | rcu_init_sched(); /* needed by module_init stage. */ |
764 | init_workqueues(); | 773 | init_workqueues(); |
774 | cpuset_init_smp(); | ||
765 | usermodehelper_init(); | 775 | usermodehelper_init(); |
766 | driver_init(); | 776 | driver_init(); |
767 | init_irq_proc(); | 777 | init_irq_proc(); |
@@ -786,6 +796,7 @@ static void run_init_process(char *init_filename) | |||
786 | * makes it inline to init() and it becomes part of init.text section | 796 | * makes it inline to init() and it becomes part of init.text section |
787 | */ | 797 | */ |
788 | static noinline int init_post(void) | 798 | static noinline int init_post(void) |
799 | __releases(kernel_lock) | ||
789 | { | 800 | { |
790 | /* need to finish all async __init code before freeing the memory */ | 801 | /* need to finish all async __init code before freeing the memory */ |
791 | async_synchronize_full(); | 802 | async_synchronize_full(); |
@@ -834,7 +845,7 @@ static int __init kernel_init(void * unused) | |||
834 | /* | 845 | /* |
835 | * init can run on any cpu. | 846 | * init can run on any cpu. |
836 | */ | 847 | */ |
837 | set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR); | 848 | set_cpus_allowed_ptr(current, cpu_all_mask); |
838 | /* | 849 | /* |
839 | * Tell the world that we're going to be the grim | 850 | * Tell the world that we're going to be the grim |
840 | * reaper of innocent orphaned children. | 851 | * reaper of innocent orphaned children. |
@@ -855,8 +866,6 @@ static int __init kernel_init(void * unused) | |||
855 | smp_init(); | 866 | smp_init(); |
856 | sched_init_smp(); | 867 | sched_init_smp(); |
857 | 868 | ||
858 | cpuset_init_smp(); | ||
859 | |||
860 | do_basic_setup(); | 869 | do_basic_setup(); |
861 | 870 | ||
862 | /* | 871 | /* |