Commit a5a74ac0 authored by Mark Goodwin's avatar Mark Goodwin Committed by Tony Luck

[IA64] sn_hwperf correctly handle bricks with multiple slabs

The procfs handler for /proc/sgi_sn/sn_topology did
not correctly handle multiple slabs in the same brick,
e.g. a brick containing a compute node and an ionode.
Signed-off-by: default avatarMark Goodwin <markgw@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 475041df
...@@ -99,7 +99,7 @@ static int sn_hwperf_geoid_to_cnode(char *location) ...@@ -99,7 +99,7 @@ static int sn_hwperf_geoid_to_cnode(char *location)
this_slot = MODULE_GET_BPOS(module_id); this_slot = MODULE_GET_BPOS(module_id);
this_slab = geo_slab(geoid); this_slab = geo_slab(geoid);
if (rack == this_rack && slot == this_slot && slab == this_slab) if (rack == this_rack && slot == this_slot && slab == this_slab)
break; break;
} }
return cnode < numionodes ? cnode : -1; return cnode < numionodes ? cnode : -1;
...@@ -121,41 +121,35 @@ static int sn_hwperf_generic_ordinal(struct sn_hwperf_object_info *obj, ...@@ -121,41 +121,35 @@ static int sn_hwperf_generic_ordinal(struct sn_hwperf_object_info *obj,
for (ordinal=0, p=objs; p != obj; p++) { for (ordinal=0, p=objs; p != obj; p++) {
if (SN_HWPERF_FOREIGN(p)) if (SN_HWPERF_FOREIGN(p))
continue; continue;
if (p->location[3] == obj->location[3]) if (SN_HWPERF_SAME_OBJTYPE(p, obj))
ordinal++; ordinal++;
} }
return ordinal; return ordinal;
} }
static struct { static const char *slabname_node = "node"; /* SHub asic */
char *brick_chars; static const char *slabname_ionode = "ionode"; /* TIO asic */
char *brick_name; static const char *slabname_router = "router"; /* NL3R or NL4R */
} brick_names[] = { static const char *slabname_other = "other"; /* unknown asic */
{"c^jbf", "node" },
{"r", "router" },
{NULL, "?-brick" }
};
static char *sn_hwperf_get_brickname(struct sn_hwperf_object_info *obj, static const char *sn_hwperf_get_slabname(struct sn_hwperf_object_info *obj,
struct sn_hwperf_object_info *objs, int *ordinal) struct sn_hwperf_object_info *objs, int *ordinal)
{ {
int i; int isnode;
const char *slabname = slabname_other;
for (i=0; brick_names[i].brick_chars; i++) { if ((isnode = SN_HWPERF_IS_NODE(obj)) || SN_HWPERF_IS_IONODE(obj)) {
if (strchr(brick_names[i].brick_chars, obj->location[3])) slabname = isnode ? slabname_node : slabname_ionode;
break;
}
if (strcmp(brick_names[i].brick_name, "node") == 0)
*ordinal = sn_hwperf_obj_to_cnode(obj); *ordinal = sn_hwperf_obj_to_cnode(obj);
}
else { else {
*ordinal = sn_hwperf_generic_ordinal(obj, objs); *ordinal = sn_hwperf_generic_ordinal(obj, objs);
if (!brick_names[i].brick_chars) if (SN_HWPERF_IS_ROUTER(obj))
brick_names[i].brick_name[0] = obj->location[3]; slabname = slabname_router;
} }
return brick_names[i].brick_name; return slabname;
} }
static int sn_topology_show(struct seq_file *s, void *d) static int sn_topology_show(struct seq_file *s, void *d)
...@@ -165,7 +159,7 @@ static int sn_topology_show(struct seq_file *s, void *d) ...@@ -165,7 +159,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
int e; int e;
int i; int i;
int j; int j;
const char *brickname; const char *slabname;
int ordinal; int ordinal;
cpumask_t cpumask; cpumask_t cpumask;
char slice; char slice;
...@@ -191,11 +185,11 @@ static int sn_topology_show(struct seq_file *s, void *d) ...@@ -191,11 +185,11 @@ static int sn_topology_show(struct seq_file *s, void *d)
obj->name[i] = '_'; obj->name[i] = '_';
} }
brickname = sn_hwperf_get_brickname(obj, objs, &ordinal); slabname = sn_hwperf_get_slabname(obj, objs, &ordinal);
seq_printf(s, "%s %d %s %s asic %s", brickname, ordinal, obj->location, seq_printf(s, "%s %d %s %s asic %s", slabname, ordinal, obj->location,
obj->sn_hwp_this_part ? "local" : "shared", obj->name); obj->sn_hwp_this_part ? "local" : "shared", obj->name);
if (strcmp(brickname, "node") != 0) if (!SN_HWPERF_IS_NODE(obj) && !SN_HWPERF_IS_IONODE(obj))
seq_putc(s, '\n'); seq_putc(s, '\n');
else { else {
seq_printf(s, ", nasid 0x%x", cnodeid_to_nasid(ordinal)); seq_printf(s, ", nasid 0x%x", cnodeid_to_nasid(ordinal));
...@@ -206,7 +200,7 @@ static int sn_topology_show(struct seq_file *s, void *d) ...@@ -206,7 +200,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
seq_putc(s, '\n'); seq_putc(s, '\n');
/* /*
* CPUs on this node * CPUs on this node, if any
*/ */
cpumask = node_to_cpumask(ordinal); cpumask = node_to_cpumask(ordinal);
for_each_online_cpu(i) { for_each_online_cpu(i) {
...@@ -278,9 +272,8 @@ static int sn_topology_show(struct seq_file *s, void *d) ...@@ -278,9 +272,8 @@ static int sn_topology_show(struct seq_file *s, void *d)
*/ */
seq_printf(s, " endpoint %s-%d, protocol %s\n", seq_printf(s, " endpoint %s-%d, protocol %s\n",
p->location, ptdata[pt].conn_port, p->location, ptdata[pt].conn_port,
strcmp(obj->name, "NL3Router") == 0 || (SN_HWPERF_IS_NL3ROUTER(obj) ||
strcmp(p->name, "NL3Router") == 0 ? SN_HWPERF_IS_NL3ROUTER(p)) ? "LLP3" : "LLP4");
"LLP3" : "LLP4");
} }
vfree(ptdata); vfree(ptdata);
} }
......
...@@ -41,7 +41,15 @@ struct sn_hwperf_object_info { ...@@ -41,7 +41,15 @@ struct sn_hwperf_object_info {
#define sn_hwp_is_shared f.fields.is_shared #define sn_hwp_is_shared f.fields.is_shared
#define sn_hwp_flags f.b.flags #define sn_hwp_flags f.b.flags
#define SN_HWPERF_FOREIGN(x) (!(x)->sn_hwp_this_part && !(x)->sn_hwp_is_shared) /* macros for object classification */
#define SN_HWPERF_IS_NODE(x) ((x) && strstr((x)->name, "SHub"))
#define SN_HWPERF_IS_IONODE(x) ((x) && strstr((x)->name, "TIO"))
#define SN_HWPERF_IS_ROUTER(x) ((x) && strstr((x)->name, "Router"))
#define SN_HWPERF_IS_NL3ROUTER(x) ((x) && strstr((x)->name, "NL3Router"))
#define SN_HWPERF_FOREIGN(x) ((x) && !(x)->sn_hwp_this_part && !(x)->sn_hwp_is_shared)
#define SN_HWPERF_SAME_OBJTYPE(x,y) ((SN_HWPERF_IS_NODE(x) && SN_HWPERF_IS_NODE(y)) ||\
(SN_HWPERF_IS_IONODE(x) && SN_HWPERF_IS_IONODE(y)) ||\
(SN_HWPERF_IS_ROUTER(x) && SN_HWPERF_IS_ROUTER(y)))
/* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */ /* numa port structure, SN_HWPERF_ENUM_PORTS returns an array of these */
struct sn_hwperf_port_info { struct sn_hwperf_port_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment