From d45cb82eccaa5c5bd6d8c34c4f4a33409738fd92 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 20 May 2008 12:57:12 +0000 Subject: [PATCH] Fix two bugs in PLPA: 1. If we don't have the topology information, don't bother trying to create cross-referencing information 1. Ensure to only check for valid processor ID's This commit was SVN r18462. --- .../linux/plpa/src/libplpa/plpa_map.c | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_map.c b/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_map.c index 84b1d0ea6d..8328f374a8 100644 --- a/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_map.c +++ b/opal/mca/paffinity/linux/plpa/src/libplpa/plpa_map.c @@ -251,6 +251,13 @@ static void load_cache(const char *sysfs_mount) } } + /* If we didn't find any core_id/physical_package_id's, then we + don't have the topology info */ + if (!found) { + clear_cache(); + return; + } + /* Now that we know the max number of sockets, allocate some arrays */ max_core_id = malloc(sizeof(int) * (max_socket_id + 1)); @@ -270,6 +277,13 @@ static void load_cache(const char *sysfs_mount) /* Find the max core number on each socket */ for (i = 0; i <= max_processor_num; ++i) { + /* If we don't have the core/socket for a given processor ID, + then skip it */ + if (map_processor_id_to_tuple[i].core < 0 || + map_processor_id_to_tuple[i].socket < 0) { + continue; + } + if (map_processor_id_to_tuple[i].core > max_core_id[map_processor_id_to_tuple[i].socket]) { max_core_id[map_processor_id_to_tuple[i].socket] = @@ -282,13 +296,6 @@ static void load_cache(const char *sysfs_mount) } } - /* If we didn't find any core_id/physical_package_id's, then we - don't have the topology info */ - if (!found) { - clear_cache(); - return; - } - /* Go through and count the number of unique sockets found. It may not be the same as max_socket_id because there may be "holes" -- e.g., sockets 0 and 3 are used, but sockets 1 and 2