Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / arch / ia64 / kernel / topology.c
index 5629b45..4f3a16b 100644 (file)
@@ -13,6 +13,7 @@
  *     Populate cpu cache entries in sysfs for cpu cache info
  */
 
+#include <linux/config.h>
 #include <linux/cpu.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <asm/numa.h>
 #include <asm/cpu.h>
 
+#ifdef CONFIG_NUMA
+static struct node *sysfs_nodes;
+#endif
 static struct ia64_cpu *sysfs_cpus;
 
 int arch_register_cpu(int num)
 {
+       struct node *parent = NULL;
+       
+#ifdef CONFIG_NUMA
+       parent = &sysfs_nodes[cpu_to_node(num)];
+#endif /* CONFIG_NUMA */
+
 #if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU)
        /*
         * If CPEI cannot be re-targetted, and this is
@@ -36,18 +46,23 @@ int arch_register_cpu(int num)
         */
        if (!can_cpei_retarget() && is_cpu_cpei_target(num))
                sysfs_cpus[num].cpu.no_control = 1;
-       map_cpu_to_node(num, node_cpuid[num].nid);
 #endif
 
-       return register_cpu(&sysfs_cpus[num].cpu, num);
+       return register_cpu(&sysfs_cpus[num].cpu, num, parent);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
 
 void arch_unregister_cpu(int num)
 {
-       unregister_cpu(&sysfs_cpus[num].cpu);
-       unmap_cpu_from_node(num, cpu_to_node(num));
+       struct node *parent = NULL;
+
+#ifdef CONFIG_NUMA
+       int node = cpu_to_node(num);
+       parent = &sysfs_nodes[node];
+#endif /* CONFIG_NUMA */
+
+       return unregister_cpu(&sysfs_cpus[num].cpu, parent);
 }
 EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
@@ -59,18 +74,26 @@ static int __init topology_init(void)
        int i, err = 0;
 
 #ifdef CONFIG_NUMA
+       sysfs_nodes = kzalloc(sizeof(struct node) * MAX_NUMNODES, GFP_KERNEL);
+       if (!sysfs_nodes) {
+               err = -ENOMEM;
+               goto out;
+       }
+
        /*
         * MCD - Do we want to register all ONLINE nodes, or all POSSIBLE nodes?
         */
        for_each_online_node(i) {
-               if ((err = register_one_node(i)))
+               if ((err = register_node(&sysfs_nodes[i], i, 0)))
                        goto out;
        }
 #endif
 
        sysfs_cpus = kzalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL);
-       if (!sysfs_cpus)
-               panic("kzalloc in topology_init failed - NR_CPUS too big?");
+       if (!sysfs_cpus) {
+               err = -ENOMEM;
+               goto out;
+       }
 
        for_each_present_cpu(i) {
                if((err = arch_register_cpu(i)))
@@ -143,7 +166,7 @@ static void cache_shared_cpu_map_setup( unsigned int cpu,
 
        num_shared = (int) csi.num_shared;
        do {
-               for_each_possible_cpu(j)
+               for_each_cpu(j)
                        if (cpu_data(cpu)->socket_id == cpu_data(j)->socket_id
                                && cpu_data(j)->core_id == csi.log1_cid
                                && cpu_data(j)->thread_id == csi.log1_tid)
@@ -403,7 +426,7 @@ static int __cpuinit cache_remove_dev(struct sys_device * sys_dev)
  * When a cpu is hot-plugged, do a check and initiate
  * cache kobject if necessary
  */
-static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
+static int cache_cpu_callback(struct notifier_block *nfb,
                unsigned long action, void *hcpu)
 {
        unsigned int cpu = (unsigned long)hcpu;
@@ -421,7 +444,7 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
        return NOTIFY_OK;
 }
 
-static struct notifier_block __cpuinitdata cache_cpu_notifier =
+static struct notifier_block cache_cpu_notifier =
 {
        .notifier_call = cache_cpu_callback
 };
@@ -435,7 +458,7 @@ static int __cpuinit cache_sysfs_init(void)
                                (void *)(long)i);
        }
 
-       register_hotcpu_notifier(&cache_cpu_notifier);
+       register_cpu_notifier(&cache_cpu_notifier);
 
        return 0;
 }