Skip to content

Commit c2bd58e

Browse files
committed
Add logs to query_attribute_value()
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 8e696c8 commit c2bd58e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/memory_targets/memory_target_numa.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,32 @@ static umf_result_t query_attribute_value(void *srcMemoryTarget,
201201
memattr_type_t type) {
202202
hwloc_topology_t topology = umfGetTopology();
203203
if (!topology) {
204+
LOG_PERR("Retrieving cached topology failed");
204205
return UMF_RESULT_ERROR_NOT_SUPPORTED;
205206
}
206207

207208
hwloc_obj_t srcNumaNode = hwloc_get_obj_by_type(
208209
topology, HWLOC_OBJ_NUMANODE,
209210
((struct numa_memory_target_t *)srcMemoryTarget)->physical_id);
210211
if (!srcNumaNode) {
212+
LOG_PERR("Getting HWLOC object by type failed");
211213
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
212214
}
213215

214216
hwloc_obj_t dstNumaNode = hwloc_get_obj_by_type(
215217
topology, HWLOC_OBJ_NUMANODE,
216218
((struct numa_memory_target_t *)dstMemoryTarget)->physical_id);
217219
if (!dstNumaNode) {
220+
LOG_PERR("Getting HWLOC object by type failed");
218221
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
219222
}
220223

221224
// Given NUMA nodes aren't local, HWLOC returns an error in such case.
222225
if (!hwloc_bitmap_intersects(srcNumaNode->cpuset, dstNumaNode->cpuset)) {
223226
// Since we want to skip such query, we return the worst possible
224227
// value for given memory attribute.
228+
LOG_PDEBUG("Testing whether two bitmaps intersect failed, using the "
229+
"worst value");
225230
*value = memattr_get_worst_value(type);
226231
return UMF_RESULT_SUCCESS;
227232
}
@@ -246,6 +251,8 @@ static umf_result_t query_attribute_value(void *srcMemoryTarget,
246251
int ret = hwloc_memattr_get_value(topology, hwlocMemAttrType, dstNumaNode,
247252
&initiator, 0, &memAttrValue);
248253
if (ret) {
254+
LOG_PERR("Getting an attribute value for a specific target NUMA node "
255+
"failed");
249256
return (errno == EINVAL) ? UMF_RESULT_ERROR_NOT_SUPPORTED
250257
: UMF_RESULT_ERROR_UNKNOWN;
251258
}

0 commit comments

Comments
 (0)