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)
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;
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]);