]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
plugins: cleanup hwloc_setup_pu_level() and export it to plugins x86-common
authorBrice Goglin <Brice.Goglin@inria.fr>
Thu, 13 Feb 2014 11:34:51 +0000 (12:34 +0100)
committerBrice Goglin <Brice.Goglin@inria.fr>
Thu, 13 Feb 2014 12:06:04 +0000 (13:06 +0100)
Xen will need it.

NEWS
include/hwloc/plugins.h
include/hwloc/rename.h
include/private/private.h
src/topology.c

diff --git a/NEWS b/NEWS
index 6697a767468c7059c0eaeadb89a8c12e5991cb7a..2c04446adea911c6fd02428796dda66fa803ed1e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,7 +32,8 @@ Version 1.9.0
   + The synthetic backend now accepts extended types such as L2Cache, L1i or
     Group3. lstopo also exports synthetic strings using these extended types.
 * Plugins
-  + Add the new hwloc_alloc_root_sets() function for plugins that discover CPUs.
+  + Add hwloc_alloc_root_sets() and hwloc_setup_pu_level() functions for
+    plugins that discover CPUs.
 * Tools
   + Add -e or --get-last-cpu-location to hwloc-ps to report where
     processes/threads run instead of where they are bound.
index 9bdc3cb5b6d346ed8c1b44fa1feca6b29164733c..656a74c95cbbd34b8e3446ec68d5e2d6ca5a6cc7 100644 (file)
@@ -311,6 +311,12 @@ HWLOC_DECLSPEC int hwloc_fill_object_sets(hwloc_obj_t obj);
  */
 HWLOC_DECLSPEC int hwloc_alloc_root_sets(struct hwloc_topology *topology);
 
+/** \brief Create a level of \p nb PU objects starting from index 0.
+ *
+ * Used for creating PU objects when there are no holes in the index list.
+ */
+HWLOC_DECLSPEC int hwloc_setup_pu_level(struct hwloc_topology *topology, unsigned nb);
+
 /** \brief Make sure that plugins can lookup core symbols.
  *
  * This is a sanity check to avoid lazy-lookup failures when libhwloc
index 300c3693a4aa2d31ae855e99b8309a1408f23d85..f383a5574f23f24e79b51256c4e97ea9246265c8 100644 (file)
@@ -486,6 +486,7 @@ extern "C" {
 #define hwloc_alloc_setup_object HWLOC_NAME(alloc_setup_object)
 #define hwloc_fill_object_sets HWLOC_NAME(fill_object_sets)
 #define hwloc_alloc_root_sets HWLOC_NAME(alloc_root_sets)
+#define hwloc_setup_pu_level HWLOC_NAME(setup_pu_level)
 
 #define hwloc_insert_pci_device_list HWLOC_NAME(insert_pci_device_list)
 #define hwloc_pci_find_cap HWLOC_NAME(pci_find_cap)
@@ -565,7 +566,6 @@ extern "C" {
 
 #define hwloc_xml_imported_distances_s HWLOC_NAME(xml_imported_distances_s)
 
-#define hwloc_setup_pu_level HWLOC_NAME(setup_pu_level)
 #define hwloc_get_sysctlbyname HWLOC_NAME(get_sysctlbyname)
 #define hwloc_get_sysctl HWLOC_NAME(get_sysctl)
 #define hwloc_fallback_nbprocessors HWLOC_NAME(fallback_nbprocessors)
index f037c5a9ee1b6ce33adc72a2953c12de4b7fa72a..939b6e0c4cea3cd944b8e0cedeb641dc9fea82d2 100644 (file)
@@ -128,7 +128,6 @@ struct hwloc_topology {
   struct hwloc_backend * backends;
 };
 
-extern void hwloc_setup_pu_level(struct hwloc_topology *topology, unsigned nb_pus);
 extern int hwloc_get_sysctlbyname(const char *name, int64_t *n);
 extern int hwloc_get_sysctl(int name[], unsigned namelen, int *n);
 extern unsigned hwloc_fallback_nbprocessors(struct hwloc_topology *topology);
index 5f45e36a1e927416de78bd1d90042efecc563276..c505d93e7d335e3126ac67c5467efa86cd077efe 100644 (file)
@@ -174,29 +174,28 @@ hwloc_fallback_nbprocessors(struct hwloc_topology *topology) {
 }
 
 /*
- * Use the given number of processors and the optional online cpuset if given
- * to set a PU level.
+ * Use the given number of processors to set a PU level.
  */
-void
+int
 hwloc_setup_pu_level(struct hwloc_topology *topology,
                     unsigned nb_pus)
 {
   struct hwloc_obj *obj;
-  unsigned oscpu,cpu;
+  unsigned oscpu;
 
   hwloc_debug("%s", "\n\n * CPU cpusets *\n\n");
-  for (cpu=0,oscpu=0; cpu<nb_pus; oscpu++)
+  for (oscpu=0; oscpu<nb_pus; oscpu++)
     {
       obj = hwloc_alloc_setup_object(HWLOC_OBJ_PU, oscpu);
       obj->cpuset = hwloc_bitmap_alloc();
       hwloc_bitmap_only(obj->cpuset, oscpu);
 
-      hwloc_debug_2args_bitmap("cpu %u (os %u) has cpuset %s\n",
-                cpu, oscpu, obj->cpuset);
+      hwloc_debug_1arg_bitmap("OS cpu %u has cpuset %s\n",
+                             oscpu, obj->cpuset);
       hwloc_insert_object_by_cpuset(topology, obj);
-
-      cpu++;
     }
+
+  return 0;
 }
 
 static void