From: <aot...@us...> - 2004-06-16 17:30:57
|
Update of /cvsroot/gc-linux/linux/init In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31080/init Modified Files: main.c Log Message: Merged 2.6.7 Index: main.c =================================================================== RCS file: /cvsroot/gc-linux/linux/init/main.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- main.c 11 May 2004 17:48:36 -0000 1.7 +++ main.c 16 Jun 2004 17:30:46 -0000 1.8 @@ -42,6 +42,7 @@ #include <linux/cpu.h> #include <linux/efi.h> #include <linux/unistd.h> +#include <linux/rmap.h> #include <asm/io.h> #include <asm/bugs.h> @@ -84,7 +85,7 @@ extern void buffer_init(void); extern void pidhash_init(void); extern void pidmap_init(void); -extern void pte_chain_init(void); +extern void prio_tree_init(void); extern void radix_tree_init(void); extern void free_initmem(void); extern void populate_rootfs(void); @@ -95,7 +96,8 @@ extern void tc_init(void); #endif -int system_state; /* SYSTEM_BOOTING/RUNNING/SHUTDOWN */ +enum system_states system_state; +EXPORT_SYMBOL(system_state); /* * Boot command-line arguments @@ -169,16 +171,14 @@ still work even if initially too large, it will just take slightly longer */ unsigned long loops_per_jiffy = (1<<12); -#ifndef __ia64__ EXPORT_SYMBOL(loops_per_jiffy); -#endif /* This is the number of bits of precision for the loops_per_jiffy. Each bit takes on average 1.5/HZ seconds. This (like the original) is a little better than 1% */ #define LPS_PREC 8 -void __init calibrate_delay(void) +void __devinit calibrate_delay(void) { unsigned long ticks, loopbit; int lps_precision = LPS_PREC; @@ -186,7 +186,7 @@ loops_per_jiffy = (1<<12); printk("Calibrating delay loop... "); - while (loops_per_jiffy <<= 1) { + while ((loops_per_jiffy <<= 1) != 0) { /* wait for "start of" clock tick */ ticks = jiffies; while (ticks == jiffies) @@ -351,20 +351,17 @@ static void __init smp_init(void) { unsigned int i; - unsigned j = 1; /* FIXME: This should be done in userspace --RR */ - for (i = 0; i < NR_CPUS; i++) { + for_each_present_cpu(i) { if (num_online_cpus() >= max_cpus) break; - if (cpu_possible(i) && !cpu_online(i)) { + if (!cpu_online(i)) cpu_up(i); - j++; - } } /* Any cleanup work */ - printk("Brought up %u CPUs\n", j); + printk("Brought up %ld CPUs\n", (long)num_online_cpus()); smp_cpus_done(max_cpus); #if 0 /* Get other processors into their bootup holding patterns. */ @@ -420,6 +417,13 @@ */ smp_prepare_boot_cpu(); + /* + * Set up the scheduler prior starting any interrupts (such as the + * timer interrupt). Full topology setup happens at smp_init() + * time - but meanwhile we still have a functioning scheduler. + */ + sched_init(); + build_all_zonelists(); page_alloc_init(); printk("Kernel command line: %s\n", saved_command_line); @@ -431,7 +435,7 @@ rcu_init(); init_IRQ(); pidhash_init(); - sched_init(); + init_timers(); softirq_init(); time_init(); @@ -460,7 +464,8 @@ calibrate_delay(); pidmap_init(); pgtable_cache_init(); - pte_chain_init(); + prio_tree_init(); + anon_vma_init(); #ifdef CONFIG_X86 if (efi_enabled) efi_enter_virtual_mode(); @@ -479,7 +484,6 @@ proc_root_init(); #endif check_bugs(); - printk("POSIX conformance testing by UNIFIX\n"); /* * We count on the initial thread going ok @@ -570,7 +574,6 @@ migration_init(); #endif - node_nr_running_init(); spawn_ksoftirqd(); } @@ -580,6 +583,24 @@ execve(init_filename, argv_init, envp_init); } +static inline void fixup_cpu_present_map(void) +{ +#ifdef CONFIG_SMP + int i; + + /* + * If arch is not hotplug ready and did not populate + * cpu_present_map, just make cpu_present_map same as cpu_possible_map + * for other cpu bringup code to function as normal. e.g smp_init() etc. + */ + if (cpus_empty(cpu_present_map)) { + for_each_cpu(i) { + cpu_set(i, cpu_present_map); + } + } +#endif +} + static int init(void * unused) { lock_kernel(); @@ -598,7 +619,9 @@ do_pre_smp_initcalls(); + fixup_cpu_present_map(); smp_init(); + sched_init_smp(); /* * Do this before initcalls, because some drivers want to access @@ -612,7 +635,7 @@ * check if there is an early userspace init. If yes, let it do all * the work */ - if (sys_access("/init", 0) == 0) + if (sys_access((const char __user *) "/init", 0) == 0) execute_command = "/init"; else prepare_namespace(); @@ -626,7 +649,7 @@ unlock_kernel(); system_state = SYSTEM_RUNNING; - if (sys_open("/dev/console", O_RDWR, 0) < 0) + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk("Warning: unable to open an initial console.\n"); (void) sys_dup(0); |