Bring in PLPA v1.2b4
This commit was SVN r19299.
Этот коммит содержится в:
родитель
a81dfa0aea
Коммит
80d11dba8f
@ -16,7 +16,7 @@ release=0
|
|||||||
# requirement is that it must be entirely printable ASCII characters
|
# requirement is that it must be entirely printable ASCII characters
|
||||||
# and have no white space.
|
# and have no white space.
|
||||||
|
|
||||||
greek=b3
|
greek=b4
|
||||||
|
|
||||||
# If want_svn=1, then the SVN r number will be included in the overall
|
# If want_svn=1, then the SVN r number will be included in the overall
|
||||||
# PLPA version number in some form.
|
# PLPA version number in some form.
|
||||||
@ -33,4 +33,4 @@ want_svn=0
|
|||||||
# distribution tarball is being made from an SVN checkout, the value
|
# distribution tarball is being made from an SVN checkout, the value
|
||||||
# of svn_r in this file is replaced with the output of "svnversion".
|
# of svn_r in this file is replaced with the output of "svnversion".
|
||||||
|
|
||||||
svn_r=r197
|
svn_r=r208
|
||||||
|
@ -199,14 +199,14 @@ int PLPA_NAME(map_to_processor_id)(int socket_id, int core_id,
|
|||||||
int PLPA_NAME(map_to_socket_core)(int processor_id,
|
int PLPA_NAME(map_to_socket_core)(int processor_id,
|
||||||
int *socket_id, int *core_id);
|
int *socket_id, int *core_id);
|
||||||
|
|
||||||
/* Returns both the total number of processors in a system and the
|
/* This function is deprecated and will disappear in a future release.
|
||||||
maximum Linux virtual processor ID (because it may be higher than
|
It is exactly equivalent to calling
|
||||||
the number of processors if there are "holes" in the available
|
plpa_get_processor_data(PLPA_COUNT_ALL, num_processors,
|
||||||
Linux virtual processor IDs). Returns 0 upon success. */
|
max_processor_id). */
|
||||||
int PLPA_NAME(get_processor_info)(int *num_processors, int *max_processor_id);
|
int PLPA_NAME(get_processor_info)(int *num_processors, int *max_processor_id);
|
||||||
|
|
||||||
/* Typedefs for specifying which processors / sockets / cores to count
|
/* Typedefs for specifying which processors / sockets / cores to count
|
||||||
in get_processor_id() */
|
in get_processor_data() and get_processor_id() */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* Only count online processors */
|
/* Only count online processors */
|
||||||
PLPA_NAME_CAPS(COUNT_ONLINE),
|
PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
@ -216,14 +216,24 @@ typedef enum {
|
|||||||
PLPA_NAME_CAPS(COUNT_ALL)
|
PLPA_NAME_CAPS(COUNT_ALL)
|
||||||
} PLPA_NAME(count_specification_t);
|
} PLPA_NAME(count_specification_t);
|
||||||
|
|
||||||
|
/* Returns both the number of processors in a system and the maximum
|
||||||
|
Linux virtual processor ID (because it may be higher than the
|
||||||
|
number of processors if there are "holes" in the available Linux
|
||||||
|
virtual processor IDs). The count_spec argument specifies whether
|
||||||
|
to count all processors, only online processors, or only offline
|
||||||
|
processors. Returns 0 upon success. */
|
||||||
|
int PLPA_NAME(get_processor_data)(PLPA_NAME(count_specification_t) count_spec,
|
||||||
|
int *num_processors, int *max_processor_id);
|
||||||
|
|
||||||
/* Returns the Linux processor ID for the Nth processor. For example,
|
/* Returns the Linux processor ID for the Nth processor. For example,
|
||||||
if the Linux processor IDs have "holes", use this function to say
|
if the Linux processor IDs have "holes", use this function to say
|
||||||
"give me the Linux processor ID of the 4th processor." count_spec
|
"give me the Linux processor ID of the 4th processor." count_spec
|
||||||
specifies whether to count online, offline, or all processors when
|
specifies whether to count online, offline, or all processors when
|
||||||
looking for the processor_num'th processor. Returns 0 upon
|
looking for the processor_num'th processor. Returns 0 upon
|
||||||
success. */
|
success. */
|
||||||
int PLPA_NAME(get_processor_id)(int processor_num, int *processor_id,
|
int PLPA_NAME(get_processor_id)(int processor_num,
|
||||||
PLPA_NAME(count_specification_t) count_spec);
|
PLPA_NAME(count_specification_t) count_spec,
|
||||||
|
int *processor_id);
|
||||||
|
|
||||||
/* Check to see if a given Linux processor ID exists / is online.
|
/* Check to see if a given Linux processor ID exists / is online.
|
||||||
Returns 0 on success. */
|
Returns 0 on success. */
|
||||||
|
@ -454,7 +454,7 @@ static void load_cache(void)
|
|||||||
if (map_processor_id_to_tuple[k].socket_id == i &&
|
if (map_processor_id_to_tuple[k].socket_id == i &&
|
||||||
map_processor_id_to_tuple[k].core_id == j) {
|
map_processor_id_to_tuple[k].core_id == j) {
|
||||||
*tuple_ptr = &map_processor_id_to_tuple[k];
|
*tuple_ptr = &map_processor_id_to_tuple[k];
|
||||||
#if defined(PLPA_DEBUG) && PLPA_DEBUG
|
#if defined(PLPA_DEBUG) && PLPA_DEBUG && 0
|
||||||
printf("Creating map [%d]: (socket %d, core %d) -> ID %d\n",
|
printf("Creating map [%d]: (socket %d, core %d) -> ID %d\n",
|
||||||
i * (max_core_id_overall + 1) + j,
|
i * (max_core_id_overall + 1) + j,
|
||||||
i, j, k);
|
i, j, k);
|
||||||
@ -599,10 +599,21 @@ int PLPA_NAME(map_to_socket_core)(int processor_id,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Deprecated function */
|
||||||
int PLPA_NAME(get_processor_info)(int *num_processors_arg,
|
int PLPA_NAME(get_processor_info)(int *num_processors_arg,
|
||||||
int *max_processor_id_arg)
|
int *max_processor_id_arg)
|
||||||
{
|
{
|
||||||
int ret;
|
return PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ALL),
|
||||||
|
num_processors_arg,
|
||||||
|
max_processor_id_arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PLPA_NAME(get_processor_data)(PLPA_NAME(count_specification_t) count_spec,
|
||||||
|
int *num_processors_arg,
|
||||||
|
int *max_processor_id_arg)
|
||||||
|
{
|
||||||
|
int i, ret;
|
||||||
|
bool match;
|
||||||
|
|
||||||
/* Initialize if not already done so */
|
/* Initialize if not already done so */
|
||||||
if (!PLPA_NAME(initialized)) {
|
if (!PLPA_NAME(initialized)) {
|
||||||
@ -626,16 +637,52 @@ int PLPA_NAME(get_processor_info)(int *num_processors_arg,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All done */
|
/* If we wanted all processors, we're done */
|
||||||
*num_processors_arg = num_processors;
|
if (PLPA_NAME_CAPS(COUNT_ALL) == count_spec) {
|
||||||
*max_processor_id_arg = max_processor_id;
|
*num_processors_arg = num_processors;
|
||||||
|
*max_processor_id_arg = max_processor_id;
|
||||||
|
} else {
|
||||||
|
/* Otherwise, count the appropriate type */
|
||||||
|
*num_processors_arg = 0;
|
||||||
|
*max_processor_id_arg = 0;
|
||||||
|
for (i = 0; i <= max_processor_id; ++i) {
|
||||||
|
if (map_processor_id_to_tuple[i].processor_id >= 0) {
|
||||||
|
match = false;
|
||||||
|
switch (count_spec) {
|
||||||
|
case PLPA_NAME_CAPS(COUNT_ONLINE):
|
||||||
|
if (map_processor_id_to_tuple[i].online) {
|
||||||
|
match = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PLPA_NAME_CAPS(COUNT_OFFLINE):
|
||||||
|
if (!map_processor_id_to_tuple[i].online) {
|
||||||
|
match = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* Just so that compilers don't complain */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (match) {
|
||||||
|
++(*num_processors_arg);
|
||||||
|
if (*max_processor_id_arg <
|
||||||
|
map_processor_id_to_tuple[i].processor_id) {
|
||||||
|
*max_processor_id_arg =
|
||||||
|
map_processor_id_to_tuple[i].processor_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the Linux processor ID for the Nth processor (starting with
|
/* Returns the Linux processor ID for the Nth processor (starting with
|
||||||
0). */
|
0). */
|
||||||
int PLPA_NAME(get_processor_id)(int processor_num, int *processor_id,
|
int PLPA_NAME(get_processor_id)(int processor_num,
|
||||||
PLPA_NAME(count_specification_t) count_spec)
|
PLPA_NAME(count_specification_t) count_spec,
|
||||||
|
int *processor_id)
|
||||||
{
|
{
|
||||||
int ret, i, count;
|
int ret, i, count;
|
||||||
bool match;
|
bool match;
|
||||||
|
@ -27,7 +27,10 @@ int main(int argc, char *argv[])
|
|||||||
int need_help = 0;
|
int need_help = 0;
|
||||||
int show_topo = 0;
|
int show_topo = 0;
|
||||||
int have_topo, num_sockets, max_socket_num, num_cores, max_core_id;
|
int have_topo, num_sockets, max_socket_num, num_cores, max_core_id;
|
||||||
int num_processors, max_processor_id, processor_id;
|
int num_processors_online, max_processor_id_online;
|
||||||
|
int num_processors_offline, max_processor_id_offline;
|
||||||
|
int num_processors_total, max_processor_id_total;
|
||||||
|
int processor_id;
|
||||||
int socket_id, exists, online, num_offline;
|
int socket_id, exists, online, num_offline;
|
||||||
PLPA_NAME(api_type_t) api_probe;
|
PLPA_NAME(api_type_t) api_probe;
|
||||||
|
|
||||||
@ -92,6 +95,61 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (show_topo) {
|
if (show_topo) {
|
||||||
if (have_topo) {
|
if (have_topo) {
|
||||||
|
/* Go through all the processors and count how many are
|
||||||
|
offline; we have no topology information for offline
|
||||||
|
processors */
|
||||||
|
if (0 != PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ALL),
|
||||||
|
&num_processors_total,
|
||||||
|
&max_processor_id_total) ||
|
||||||
|
0 != PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
|
&num_processors_online,
|
||||||
|
&max_processor_id_online) ||
|
||||||
|
0 != PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_OFFLINE),
|
||||||
|
&num_processors_offline,
|
||||||
|
&max_processor_id_offline)) {
|
||||||
|
fprintf(stderr, "plpa_get_processor_info failed\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
/* This is a little overkill; this information should
|
||||||
|
never mismatch. But what the heck. */
|
||||||
|
if (num_processors_online + num_processors_offline !=
|
||||||
|
num_processors_total) {
|
||||||
|
fprintf(stderr, "Number of online and offline processors do not seem to add up (online: %d, offline: %d, total: %d)\n",
|
||||||
|
num_processors_online,
|
||||||
|
num_processors_offline,
|
||||||
|
num_processors_total);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Number of processors online: %d\n", num_processors_online);
|
||||||
|
printf("Number of processors offline: %d (no topology information available)\n",
|
||||||
|
num_processors_offline);
|
||||||
|
|
||||||
|
/* Another "over the top" check -- these should never
|
||||||
|
disagree. But what the heck; it's a good test of
|
||||||
|
PLPA. */
|
||||||
|
for (num_offline = i = 0; i < num_processors_total; ++i) {
|
||||||
|
if (0 != PLPA_NAME(get_processor_id)(i,
|
||||||
|
PLPA_NAME_CAPS(COUNT_ALL),
|
||||||
|
&processor_id)) {
|
||||||
|
fprintf(stderr, "pla_get_processor_id failed\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (0 != PLPA_NAME(get_processor_flags)(processor_id,
|
||||||
|
&exists,
|
||||||
|
&online)) {
|
||||||
|
fprintf(stderr, "plpa_get_processor_flags failed\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (exists && !online) {
|
||||||
|
++num_offline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num_offline != num_processors_offline) {
|
||||||
|
fprintf(stderr, "Number of online and offline processors do not seem to add up (1)\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Go through all the sockets */
|
/* Go through all the sockets */
|
||||||
for (i = 0; i < num_sockets; ++i) {
|
for (i = 0; i < num_sockets; ++i) {
|
||||||
/* Turn the socket number into a Linux socket ID */
|
/* Turn the socket number into a Linux socket ID */
|
||||||
@ -110,34 +168,6 @@ int main(int argc, char *argv[])
|
|||||||
i, socket_id, num_cores, (1 == num_cores) ? "" : "s",
|
i, socket_id, num_cores, (1 == num_cores) ? "" : "s",
|
||||||
max_core_id);
|
max_core_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go through all the processors and count how many are
|
|
||||||
offline; we have no topology information for offline
|
|
||||||
processors */
|
|
||||||
if (0 != PLPA_NAME(get_processor_info)(&num_processors,
|
|
||||||
&max_processor_id)) {
|
|
||||||
fprintf(stderr, "plpa_get_processor_info failed\n");
|
|
||||||
} else {
|
|
||||||
for (num_offline = i = 0; i < num_processors; ++i) {
|
|
||||||
if (0 != PLPA_NAME(get_processor_id)(i, &processor_id,
|
|
||||||
PLPA_NAME_CAPS(COUNT_ALL))) {
|
|
||||||
fprintf(stderr, "pla_get_processor_id failed\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (0 != PLPA_NAME(get_processor_flags)(processor_id,
|
|
||||||
&exists,
|
|
||||||
&online)) {
|
|
||||||
fprintf(stderr, "plpa_get_processor_flags failed\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (exists && !online) {
|
|
||||||
++num_offline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (num_offline > 0) {
|
|
||||||
printf("%d processor%s offline (no topology information available)\n", num_offline, (1 == num_offline ? "" : "s"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
printf("Kernel topology not supported -- cannot show topology information\n");
|
printf("Kernel topology not supported -- cannot show topology information\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -22,9 +22,6 @@ if PLPA_BUILD_EXECUTABLES
|
|||||||
bin_PROGRAMS += plpa-taskset
|
bin_PROGRAMS += plpa-taskset
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Force parser.c to be re-compiled when tokens.h is re-generated
|
|
||||||
parser.c: tokens.h
|
|
||||||
|
|
||||||
plpa_taskset_SOURCES = \
|
plpa_taskset_SOURCES = \
|
||||||
plpa-taskset.c \
|
plpa-taskset.c \
|
||||||
plpa-taskset.h \
|
plpa-taskset.h \
|
||||||
|
@ -1489,19 +1489,20 @@ static void cpu_set(PLPA_NAME(cpu_set_t) *out, int pos)
|
|||||||
|
|
||||||
static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||||
{
|
{
|
||||||
int i, max_id, max_id_num, s, c;
|
int i, max_num, max_id, exists, online;
|
||||||
PLPA_CPU_ZERO(out);
|
PLPA_CPU_ZERO(out);
|
||||||
|
|
||||||
/* Only set processor ID's that exist */
|
/* Only set processor ID's that exist and are online */
|
||||||
if (ALL == type) {
|
if (ALL == type) {
|
||||||
max_id_num = PLPA_BITMASK_CPU_MAX;
|
max_id = PLPA_BITMASK_CPU_MAX;
|
||||||
} else if (PROCESSOR == type) {
|
} else if (PROCESSOR == type) {
|
||||||
plpa_get_processor_info(&max_id, &max_id_num);
|
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
|
&max_num, &max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= max_id_num; ++i) {
|
for (i = 0; i <= max_id; ++i) {
|
||||||
if (ALL == type ||
|
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||||
(PROCESSOR == type && 0 == plpa_map_to_socket_core(i, &s, &c))) {
|
exists && online) {
|
||||||
PLPA_CPU_SET(i, out);
|
PLPA_CPU_SET(i, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1509,19 +1510,20 @@ static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
|||||||
|
|
||||||
static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||||
{
|
{
|
||||||
int i, max_id, max_id_num, s, c;
|
int i, max_num, max_id, exists, online;
|
||||||
PLPA_CPU_ZERO(out);
|
PLPA_CPU_ZERO(out);
|
||||||
|
|
||||||
/* Only set processor ID's that exist */
|
/* Only set processor ID's that exist and are online */
|
||||||
if (ALL == type) {
|
if (ALL == type) {
|
||||||
max_id_num = PLPA_BITMASK_CPU_MAX;
|
max_id = PLPA_BITMASK_CPU_MAX;
|
||||||
} else if (PROCESSOR == type) {
|
} else if (PROCESSOR == type) {
|
||||||
plpa_get_processor_info(&max_id, &max_id_num);
|
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
|
&max_num, &max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= max_id_num; i += 2) {
|
for (i = 0; i <= max_id; i += 2) {
|
||||||
if (ALL == type ||
|
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||||
(PROCESSOR == type && 0 == plpa_map_to_socket_core(i, &s, &c))) {
|
exists && online) {
|
||||||
PLPA_CPU_SET(i, out);
|
PLPA_CPU_SET(i, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1529,19 +1531,20 @@ static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
|||||||
|
|
||||||
static void cpu_set_odd(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
static void cpu_set_odd(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||||
{
|
{
|
||||||
int i, max_id, max_id_num, s, c;
|
int i, max_num, max_id, exists, online;
|
||||||
PLPA_CPU_ZERO(out);
|
PLPA_CPU_ZERO(out);
|
||||||
|
|
||||||
/* Only set processor ID's that exist */
|
/* Only set processor ID's that exist */
|
||||||
if (ALL == type) {
|
if (ALL == type) {
|
||||||
max_id_num = PLPA_BITMASK_CPU_MAX;
|
max_id = PLPA_BITMASK_CPU_MAX;
|
||||||
} else if (PROCESSOR == type) {
|
} else if (PROCESSOR == type) {
|
||||||
plpa_get_processor_info(&max_id, &max_id_num);
|
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
|
&max_num, &max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i <= max_id_num; i += 2) {
|
for (i = 1; i <= max_id; i += 2) {
|
||||||
if (ALL == type ||
|
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||||
(PROCESSOR == type && 0 == plpa_map_to_socket_core(i, &s, &c))) {
|
exists && online) {
|
||||||
PLPA_CPU_SET(i, out);
|
PLPA_CPU_SET(i, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1590,7 +1593,7 @@ static void sc_merge(PLPA_NAME(cpu_set_t) *out,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != plpa_get_socket_info(&num_sockets, &max_socket_id)) {
|
if (0 != PLPA_NAME(get_socket_info)(&num_sockets, &max_socket_id)) {
|
||||||
fprintf(stderr, "ERROR: Unable to retrieve socket information\n");
|
fprintf(stderr, "ERROR: Unable to retrieve socket information\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -1608,8 +1611,8 @@ static void sc_merge(PLPA_NAME(cpu_set_t) *out,
|
|||||||
socket, max_socket_id);
|
socket, max_socket_id);
|
||||||
exit(1);
|
exit(1);
|
||||||
} else if (sockets_are_valid &&
|
} else if (sockets_are_valid &&
|
||||||
ENOENT == plpa_get_core_info(socket, &num_cores,
|
ENOENT == PLPA_NAME(get_core_info)(socket, &num_cores,
|
||||||
&max_core_id) &&
|
&max_core_id) &&
|
||||||
PLPA_CPU_ISSET(socket, sockets)) {
|
PLPA_CPU_ISSET(socket, sockets)) {
|
||||||
fprintf(stderr, "ERROR: Invalid socket ID specified (%d does not exist)\n",
|
fprintf(stderr, "ERROR: Invalid socket ID specified (%d does not exist)\n",
|
||||||
socket);
|
socket);
|
||||||
|
@ -196,19 +196,20 @@ static void cpu_set(PLPA_NAME(cpu_set_t) *out, int pos)
|
|||||||
|
|
||||||
static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||||
{
|
{
|
||||||
int i, max_id, max_id_num, s, c;
|
int i, max_num, max_id, exists, online;
|
||||||
PLPA_CPU_ZERO(out);
|
PLPA_CPU_ZERO(out);
|
||||||
|
|
||||||
/* Only set processor ID's that exist */
|
/* Only set processor ID's that exist and are online */
|
||||||
if (ALL == type) {
|
if (ALL == type) {
|
||||||
max_id_num = PLPA_BITMASK_CPU_MAX;
|
max_id = PLPA_BITMASK_CPU_MAX;
|
||||||
} else if (PROCESSOR == type) {
|
} else if (PROCESSOR == type) {
|
||||||
plpa_get_processor_info(&max_id, &max_id_num);
|
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
|
&max_num, &max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= max_id_num; ++i) {
|
for (i = 0; i <= max_id; ++i) {
|
||||||
if (ALL == type ||
|
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||||
(PROCESSOR == type && 0 == plpa_map_to_socket_core(i, &s, &c))) {
|
exists && online) {
|
||||||
PLPA_CPU_SET(i, out);
|
PLPA_CPU_SET(i, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,19 +217,20 @@ static void cpu_set_all(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
|||||||
|
|
||||||
static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||||
{
|
{
|
||||||
int i, max_id, max_id_num, s, c;
|
int i, max_num, max_id, exists, online;
|
||||||
PLPA_CPU_ZERO(out);
|
PLPA_CPU_ZERO(out);
|
||||||
|
|
||||||
/* Only set processor ID's that exist */
|
/* Only set processor ID's that exist and are online */
|
||||||
if (ALL == type) {
|
if (ALL == type) {
|
||||||
max_id_num = PLPA_BITMASK_CPU_MAX;
|
max_id = PLPA_BITMASK_CPU_MAX;
|
||||||
} else if (PROCESSOR == type) {
|
} else if (PROCESSOR == type) {
|
||||||
plpa_get_processor_info(&max_id, &max_id_num);
|
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
|
&max_num, &max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= max_id_num; i += 2) {
|
for (i = 0; i <= max_id; i += 2) {
|
||||||
if (ALL == type ||
|
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||||
(PROCESSOR == type && 0 == plpa_map_to_socket_core(i, &s, &c))) {
|
exists && online) {
|
||||||
PLPA_CPU_SET(i, out);
|
PLPA_CPU_SET(i, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,19 +238,20 @@ static void cpu_set_even(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
|||||||
|
|
||||||
static void cpu_set_odd(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
static void cpu_set_odd(PLPA_NAME(cpu_set_t) *out, id_type_t type)
|
||||||
{
|
{
|
||||||
int i, max_id, max_id_num, s, c;
|
int i, max_num, max_id, exists, online;
|
||||||
PLPA_CPU_ZERO(out);
|
PLPA_CPU_ZERO(out);
|
||||||
|
|
||||||
/* Only set processor ID's that exist */
|
/* Only set processor ID's that exist */
|
||||||
if (ALL == type) {
|
if (ALL == type) {
|
||||||
max_id_num = PLPA_BITMASK_CPU_MAX;
|
max_id = PLPA_BITMASK_CPU_MAX;
|
||||||
} else if (PROCESSOR == type) {
|
} else if (PROCESSOR == type) {
|
||||||
plpa_get_processor_info(&max_id, &max_id_num);
|
PLPA_NAME(get_processor_data)(PLPA_NAME_CAPS(COUNT_ONLINE),
|
||||||
|
&max_num, &max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i <= max_id_num; i += 2) {
|
for (i = 1; i <= max_id; i += 2) {
|
||||||
if (ALL == type ||
|
if (0 == PLPA_NAME(get_processor_flags)(i, &exists, &online) &&
|
||||||
(PROCESSOR == type && 0 == plpa_map_to_socket_core(i, &s, &c))) {
|
exists && online) {
|
||||||
PLPA_CPU_SET(i, out);
|
PLPA_CPU_SET(i, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,7 +300,7 @@ static void sc_merge(PLPA_NAME(cpu_set_t) *out,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 != plpa_get_socket_info(&num_sockets, &max_socket_id)) {
|
if (0 != PLPA_NAME(get_socket_info)(&num_sockets, &max_socket_id)) {
|
||||||
fprintf(stderr, "ERROR: Unable to retrieve socket information\n");
|
fprintf(stderr, "ERROR: Unable to retrieve socket information\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -315,8 +318,8 @@ static void sc_merge(PLPA_NAME(cpu_set_t) *out,
|
|||||||
socket, max_socket_id);
|
socket, max_socket_id);
|
||||||
exit(1);
|
exit(1);
|
||||||
} else if (sockets_are_valid &&
|
} else if (sockets_are_valid &&
|
||||||
ENOENT == plpa_get_core_info(socket, &num_cores,
|
ENOENT == PLPA_NAME(get_core_info)(socket, &num_cores,
|
||||||
&max_core_id) &&
|
&max_core_id) &&
|
||||||
PLPA_CPU_ISSET(socket, sockets)) {
|
PLPA_CPU_ISSET(socket, sockets)) {
|
||||||
fprintf(stderr, "ERROR: Invalid socket ID specified (%d does not exist)\n",
|
fprintf(stderr, "ERROR: Invalid socket ID specified (%d does not exist)\n",
|
||||||
socket);
|
socket);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user