]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Setup sysfs to mark LDOM sockets, cores and threads correctly.
authorAllen Pais <allen.pais@oracle.com>
Wed, 7 Jan 2015 12:36:22 +0000 (18:06 +0530)
committerAllen Pais <allen.pais@oracle.com>
Wed, 9 Sep 2015 18:42:50 +0000 (00:12 +0530)
The current sparc kernel has no representation for sockets (i.e. a 3rd level
cache shared by cores) though tools like lscpu can pull this from sysfs. This
patch walks the LDOM MD (machine description) cache hierarchy structure and
marks sockets as well as cores and threads such that a representative sysfs is
created by drivers/base/topology.c.

Addresses LDOM part of Oracle Bug 17423360.

Orabug: 17423360

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Reviewed-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 83f5da7f075af677aa310a83e90f43a81cb0b5a5)
(cherry picked from commit 761c43f0261e201c0148cdd807bf50b19aa0a297)

arch/sparc/kernel/mdesc.c
arch/sparc/kernel/smp_64.c

index b9fe42450308cc45a4e47b2483225eebd1c46891..eca49856ae49b1a4ddab4d6e11b00059275df060 100644 (file)
@@ -757,6 +757,30 @@ static void set_sock_ids(struct mdesc_handle *hp)
                set_sock_ids_by_cache(hp, 2);
 }
 
+static void __cpuinit set_sock_ids(struct mdesc_handle *hp)
+{
+       int idx;
+       u64 mp;
+
+       idx = 1;
+
+       /*
+        * identify unique sockets by looking for cpus backpointed to by
+        * level 3 caches
+        */
+       mdesc_for_each_node_by_name(hp, mp, "cache") {
+               const u64 *level;
+
+               level = mdesc_get_property(hp, mp, "level", NULL);
+               if (*level != 3)
+                       continue;
+
+               mark_sock_ids(hp, mp, idx);
+
+               idx++;
+       }
+}
+
 static void mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id)
 {
        u64 a;
index 19cd08d1867285f059f768402e4df14c64d7871d..0d5869c27097dbf3c3fb358ff9e659dcdb7cdece 100644 (file)
@@ -1249,7 +1249,6 @@ void smp_fill_in_sib_core_maps(void)
 
        for_each_present_cpu(i)  {
                unsigned int j;
-
                for_each_present_cpu(j)  {
                        if (cpu_data(i).sock_id == cpu_data(j).sock_id)
                                cpumask_set_cpu(j, &cpu_core_sib_map[i]);