Merge branch 'master' of /home/aia21/ntfs-2.6/
[pandora-kernel.git] / init / main.c
index 2ed3638..2714e0e 100644 (file)
 #include <asm/sections.h>
 #include <asm/cacheflush.h>
 
-/*
- * This is one of the first .c files built. Error out early
- * if we have compiler trouble..
- */
-#if __GNUC__ == 2 && __GNUC_MINOR__ == 96
-#ifdef CONFIG_FRAME_POINTER
-#error This compiler cannot compile correctly with frame pointers enabled
-#endif
-#endif
-
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/smp.h>
 #endif
 
 /*
- * Versions of gcc older than that listed below may actually compile
- * and link okay, but the end product can have subtle run time bugs.
- * To avoid associated bogus bug reports, we flatly refuse to compile
- * with a gcc that is known to be too old from the very beginning.
+ * This is one of the first .c files built. Error out early if we have compiler
+ * trouble.
+ *
+ * Versions of gcc older than that listed below may actually compile and link
+ * okay, but the end product can have subtle run time bugs.  To avoid associated
+ * bogus bug reports, we flatly refuse to compile with a gcc that is known to be
+ * too old from the very beginning.
  */
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
+#if (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 2)
 #error Sorry, your GCC is too old. It builds incorrect kernels.
 #endif
 
@@ -332,7 +325,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
 #else
 
 #ifdef __GENERIC_PER_CPU
-unsigned long __per_cpu_offset[NR_CPUS];
+unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
 
 EXPORT_SYMBOL(__per_cpu_offset);
 
@@ -340,6 +333,7 @@ static void __init setup_per_cpu_areas(void)
 {
        unsigned long size, i;
        char *ptr;
+       unsigned long nr_possible_cpus = num_possible_cpus();
 
        /* Copy section for each CPU (we discard the original) */
        size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
@@ -347,12 +341,12 @@ static void __init setup_per_cpu_areas(void)
        if (size < PERCPU_ENOUGH_ROOM)
                size = PERCPU_ENOUGH_ROOM;
 #endif
+       ptr = alloc_bootmem(size * nr_possible_cpus);
 
-       ptr = alloc_bootmem(size * NR_CPUS);
-
-       for (i = 0; i < NR_CPUS; i++, ptr += size) {
+       for_each_cpu(i) {
                __per_cpu_offset[i] = ptr - __per_cpu_start;
                memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
+               ptr += size;
        }
 }
 #endif /* !__GENERIC_PER_CPU */
@@ -445,6 +439,15 @@ void __init parse_early_param(void)
  *     Activate the first processor.
  */
 
+static void __init boot_cpu_init(void)
+{
+       int cpu = smp_processor_id();
+       /* Mark the boot cpu "present", "online" etc for SMP and UP case */
+       cpu_set(cpu, cpu_online_map);
+       cpu_set(cpu, cpu_present_map);
+       cpu_set(cpu, cpu_possible_map);
+}
+
 asmlinkage void __init start_kernel(void)
 {
        char * command_line;
@@ -454,17 +457,13 @@ asmlinkage void __init start_kernel(void)
  * enable them
  */
        lock_kernel();
+       boot_cpu_init();
        page_address_init();
        printk(KERN_NOTICE);
        printk(linux_banner);
        setup_arch(&command_line);
        setup_per_cpu_areas();
-
-       /*
-        * Mark the boot cpu "online" so that it can call console drivers in
-        * printk() and can access its per-cpu storage.
-        */
-       smp_prepare_boot_cpu();
+       smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
 
        /*
         * Set up the scheduler prior starting any interrupts (such as the
@@ -490,6 +489,7 @@ asmlinkage void __init start_kernel(void)
        init_IRQ();
        pidhash_init();
        init_timers();
+       hrtimers_init();
        softirq_init();
        time_init();
 
@@ -512,6 +512,7 @@ asmlinkage void __init start_kernel(void)
        }
 #endif
        vfs_caches_init_early();
+       cpuset_init_early();
        mem_init();
        kmem_cache_init();
        setup_per_cpu_pageset();
@@ -673,7 +674,6 @@ static int init(void * unused)
         */
        child_reaper = current;
 
-       /* Sets up cpus_possible() */
        smp_prepare_cpus(max_cpus);
 
        do_pre_smp_initcalls();