]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
Fix/cleanup misc object depth
authorBrice Goglin <brice.goglin@inria.fr>
Tue, 2 Jul 2013 13:22:51 +0000 (13:22 +0000)
committerBrice Goglin <brice.goglin@inria.fr>
Tue, 2 Jul 2013 13:22:51 +0000 (13:22 +0000)
Misc can be added though insert_by_parent (load from XML) or explicit
insert_misc_by_parent/cpuset(). So move the actual setting of their
depth or these, instead of trying to do it during level build
since Misc objects are kind of ignored there anyway.

This fixes tests/hwloc_insert_misc when debug is enabled
(depth was 0 instead of -1 when reloading from XML).

This commit was SVN r5724.

src/topology.c

index 5931683ba2d8148d2705335f06578773ee69fce5..3a083c084413f923c0b663e66af41d805fcbe397 100644 (file)
@@ -904,6 +904,11 @@ hwloc_insert_object_by_parent(struct hwloc_topology *topology, hwloc_obj_t paren
     next_child = child->next_sibling;
     hwloc_insert_object_by_parent(topology, parent, child);
   }
+
+  if (obj->type == HWLOC_OBJ_MISC) {
+    /* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */
+    obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN;
+  }
 }
 
 /* Adds a misc object _after_ detection, and thus has to reconnect all the pointers */
@@ -926,7 +931,7 @@ hwloc_topology_insert_misc_object_by_cpuset(struct hwloc_topology *topology, hwl
   if (name)
     obj->name = strdup(name);
 
-  /* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */
+  /* misc objects go in no level */
   obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN;
 
   obj->cpuset = hwloc_bitmap_dup(cpuset);
@@ -984,9 +989,6 @@ hwloc_topology_insert_misc_object_by_parent(struct hwloc_topology *topology, hwl
     return NULL;
   }
 
-  /* misc objects go in no level (needed here because level building doesn't see Misc objects inside I/O trees) */
-  obj->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN;
-
   hwloc_insert_object_by_parent(topology, parent, obj);
 
   hwloc_connect_children(topology->levels[0][0]);
@@ -1943,8 +1945,6 @@ hwloc_level_filter_object(hwloc_topology_t topology,
     int nb = hwloc_level_filter_object(topology, new_obj, old->children[i]);
     if (new_obj) {
       new_obj += nb;
-      /* misc objects go in no level (needed here because insert_misc() not always involved e.g. during XML import) */
-      old->depth = (unsigned) HWLOC_TYPE_DEPTH_UNKNOWN;
     }
     total += nb;
   }