From a69492dc4d805bbd40ce9a60c7b64acc63ba44c6 Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Mon, 5 May 2025 11:03:19 +0100 Subject: [PATCH 1/3] Check global state destruction in destructors In some cases the global state may have been destroyed when we reach `umfDestroyPool` or `umfDestroyProvider`, in which case actually going through with the destruction will cause segmentation faults. The way the global state is managed should maybe be re-worked, but this should be an okay workaround to avoid segmentation faults until then. --- src/memory_pool.c | 4 ++++ src/memory_provider.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/memory_pool.c b/src/memory_pool.c index eb0054522..f4ecdc7f6 100644 --- a/src/memory_pool.c +++ b/src/memory_pool.c @@ -85,6 +85,10 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops, } void umfPoolDestroy(umf_memory_pool_handle_t hPool) { + if (umf_ba_global_is_destroyed()) { + return; + } + hPool->ops.finalize(hPool->pool_priv); umf_memory_provider_handle_t hUpstreamProvider = NULL; diff --git a/src/memory_provider.c b/src/memory_provider.c index ce6a10a20..10decc8b2 100644 --- a/src/memory_provider.c +++ b/src/memory_provider.c @@ -194,7 +194,7 @@ umf_result_t umfMemoryProviderCreate(const umf_memory_provider_ops_t *ops, } void umfMemoryProviderDestroy(umf_memory_provider_handle_t hProvider) { - if (hProvider) { + if (hProvider && !umf_ba_global_is_destroyed()) { hProvider->ops.finalize(hProvider->provider_priv); umf_ba_global_free(hProvider); } From b5fdb212a41b1a1cd1fc7dbeca8aa87469b8be8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stolarczuk?= Date: Thu, 24 Apr 2025 14:36:12 +0200 Subject: [PATCH 2/3] Downgrade error logs to debug in memspaces and memtargets They are misleadingly read as errors, while they are simply debug information that these targets aren't accessible on a machine. --- src/memspaces/memspace_highest_bandwidth.c | 4 ++-- src/memspaces/memspace_lowest_latency.c | 4 ++-- src/memtargets/memtarget_numa.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/memspaces/memspace_highest_bandwidth.c b/src/memspaces/memspace_highest_bandwidth.c index 93fede2cd..618da164b 100644 --- a/src/memspaces/memspace_highest_bandwidth.c +++ b/src/memspaces/memspace_highest_bandwidth.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -102,7 +102,7 @@ static void umfMemspaceHighestBandwidthInit(void) { umf_result_t ret = umfMemspaceHighestBandwidthCreate(&UMF_MEMSPACE_HIGHEST_BANDWIDTH); if (ret != UMF_RESULT_SUCCESS) { - LOG_ERR( + LOG_DEBUG( "Creating the highest bandwidth memspace failed with the error: %u", ret); assert(ret == UMF_RESULT_ERROR_NOT_SUPPORTED); diff --git a/src/memspaces/memspace_lowest_latency.c b/src/memspaces/memspace_lowest_latency.c index 5ca369fee..8c37372d6 100644 --- a/src/memspaces/memspace_lowest_latency.c +++ b/src/memspaces/memspace_lowest_latency.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -98,7 +98,7 @@ static void umfMemspaceLowestLatencyInit(void) { umf_result_t ret = umfMemspaceLowestLatencyCreate(&UMF_MEMSPACE_LOWEST_LATENCY); if (ret != UMF_RESULT_SUCCESS) { - LOG_ERR( + LOG_DEBUG( "Creating the lowest latency memspace failed with the error: %u", ret); assert(ret == UMF_RESULT_ERROR_NOT_SUPPORTED); diff --git a/src/memtargets/memtarget_numa.c b/src/memtargets/memtarget_numa.c index 88d8ac2a4..51a6fbf08 100644 --- a/src/memtargets/memtarget_numa.c +++ b/src/memtargets/memtarget_numa.c @@ -309,8 +309,8 @@ static umf_result_t query_attribute_value(void *srcMemoryTarget, int ret = hwloc_memattr_get_value(topology, hwlocMemAttrType, dstNumaNode, &initiator, 0, &memAttrValue); if (ret) { - LOG_PERR("Getting an attribute value for a specific target NUMA node " - "failed"); + LOG_PDEBUG("Getting an attribute value for a specific target NUMA node " + "failed"); return (errno == EINVAL) ? UMF_RESULT_ERROR_NOT_SUPPORTED : UMF_RESULT_ERROR_UNKNOWN; } @@ -330,9 +330,10 @@ static umf_result_t numa_get_bandwidth(void *srcMemoryTarget, umf_result_t ret = query_attribute_value(srcMemoryTarget, dstMemoryTarget, bandwidth, MEMATTR_TYPE_BANDWIDTH); if (ret) { - LOG_ERR("Retrieving bandwidth for initiator node %u to node %u failed.", - ((struct numa_memtarget_t *)srcMemoryTarget)->physical_id, - ((struct numa_memtarget_t *)dstMemoryTarget)->physical_id); + LOG_DEBUG( + "Retrieving bandwidth for initiator node %u to node %u failed.", + ((struct numa_memtarget_t *)srcMemoryTarget)->physical_id, + ((struct numa_memtarget_t *)dstMemoryTarget)->physical_id); return ret; } @@ -348,9 +349,9 @@ static umf_result_t numa_get_latency(void *srcMemoryTarget, umf_result_t ret = query_attribute_value(srcMemoryTarget, dstMemoryTarget, latency, MEMATTR_TYPE_LATENCY); if (ret) { - LOG_ERR("Retrieving latency for initiator node %u to node %u failed.", - ((struct numa_memtarget_t *)srcMemoryTarget)->physical_id, - ((struct numa_memtarget_t *)dstMemoryTarget)->physical_id); + LOG_DEBUG("Retrieving latency for initiator node %u to node %u failed.", + ((struct numa_memtarget_t *)srcMemoryTarget)->physical_id, + ((struct numa_memtarget_t *)dstMemoryTarget)->physical_id); return ret; } From 4d3f55b16ff5b52048e649bc880a38e28b917157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stolarczuk?= Date: Thu, 8 May 2025 13:24:32 +0200 Subject: [PATCH 3/3] 0.11.1 release --- ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index a7b613774..6a7c63faa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu May 08 2025 Łukasz Stolarczuk + + * Version 0.11.1 + + This patch release contains following changes: + - check global state destruction in destructors (#1297) + - a minor change in UMF logs (#1299) + Thu Apr 17 2025 Łukasz Stolarczuk * Version 0.11.0