]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/s390/kernel/topology.c
Merge branch 'pm-opp'
[karo-tx-linux.git] / arch / s390 / kernel / topology.c
index 5728c5bd44a8241b0d2fd3c79c770154194501ba..bf05e7fc3e70807c3f17eca0907c64e304f63328 100644 (file)
 #include <linux/cpu.h>
 #include <linux/smp.h>
 #include <linux/mm.h>
+#include <linux/nodemask.h>
+#include <linux/node.h>
 #include <asm/sysinfo.h>
+#include <asm/numa.h>
 
 #define PTF_HORIZONTAL (0UL)
 #define PTF_VERTICAL   (1UL)
@@ -37,8 +40,10 @@ static struct sysinfo_15_1_x *tl_info;
 static int topology_enabled = 1;
 static DECLARE_WORK(topology_work, topology_work_fn);
 
-/* topology_lock protects the socket and book linked lists */
-static DEFINE_SPINLOCK(topology_lock);
+/*
+ * Socket/Book linked lists and per_cpu(cpu_topology) updates are
+ * protected by "sched_domains_mutex".
+ */
 static struct mask_info socket_info;
 static struct mask_info book_info;
 
@@ -188,7 +193,6 @@ static void tl_to_masks(struct sysinfo_15_1_x *info)
 {
        struct cpuid cpu_id;
 
-       spin_lock_irq(&topology_lock);
        get_cpu_id(&cpu_id);
        clear_masks();
        switch (cpu_id.machine) {
@@ -199,7 +203,6 @@ static void tl_to_masks(struct sysinfo_15_1_x *info)
        default:
                __tl_to_masks_generic(info);
        }
-       spin_unlock_irq(&topology_lock);
 }
 
 static void topology_update_polarization_simple(void)
@@ -244,10 +247,8 @@ int topology_set_cpu_management(int fc)
 
 static void update_cpu_masks(void)
 {
-       unsigned long flags;
        int cpu;
 
-       spin_lock_irqsave(&topology_lock, flags);
        for_each_possible_cpu(cpu) {
                per_cpu(cpu_topology, cpu).thread_mask = cpu_thread_map(cpu);
                per_cpu(cpu_topology, cpu).core_mask = cpu_group_map(&socket_info, cpu);
@@ -259,7 +260,7 @@ static void update_cpu_masks(void)
                        per_cpu(cpu_topology, cpu).book_id = cpu;
                }
        }
-       spin_unlock_irqrestore(&topology_lock, flags);
+       numa_update_cpu_topology();
 }
 
 void store_topology(struct sysinfo_15_1_x *info)
@@ -274,21 +275,21 @@ int arch_update_cpu_topology(void)
 {
        struct sysinfo_15_1_x *info = tl_info;
        struct device *dev;
-       int cpu;
+       int cpu, rc = 0;
 
-       if (!MACHINE_HAS_TOPOLOGY) {
-               update_cpu_masks();
-               topology_update_polarization_simple();
-               return 0;
+       if (MACHINE_HAS_TOPOLOGY) {
+               rc = 1;
+               store_topology(info);
+               tl_to_masks(info);
        }
-       store_topology(info);
-       tl_to_masks(info);
        update_cpu_masks();
+       if (!MACHINE_HAS_TOPOLOGY)
+               topology_update_polarization_simple();
        for_each_online_cpu(cpu) {
                dev = get_cpu_device(cpu);
                kobject_uevent(&dev->kobj, KOBJ_CHANGE);
        }
-       return 1;
+       return rc;
 }
 
 static void topology_work_fn(struct work_struct *work)