From: Allen Pais Date: Wed, 7 Jan 2015 12:36:22 +0000 (+0530) Subject: sparc64: Setup sysfs to mark LDOM sockets, cores and threads correctly. X-Git-Tag: v4.1.12-92~283^2^2~21 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ec4c5a02e1f4f14a3855469296ebc761d2735223;p=users%2Fjedix%2Flinux-maple.git sparc64: Setup sysfs to mark LDOM sockets, cores and threads correctly. 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 Reviewed-by: Jerry Snitselaar Signed-off-by: Allen Pais (cherry picked from commit 83f5da7f075af677aa310a83e90f43a81cb0b5a5) (cherry picked from commit 761c43f0261e201c0148cdd807bf50b19aa0a297) --- diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index b9fe42450308c..eca49856ae49b 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c @@ -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; diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 19cd08d186728..0d5869c27097d 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c @@ -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]);