Skip to content

Use LOG_FATAL() in case of critical errors #1095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/pool/pool_scalable.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2023-2024 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down Expand Up @@ -143,7 +143,7 @@ static int init_tbb_callbacks(tbb_callbacks_t *tbb_callbacks) {
!tbb_callbacks->pool_aligned_malloc || !tbb_callbacks->pool_free ||
!tbb_callbacks->pool_create_v1 || !tbb_callbacks->pool_destroy ||
!tbb_callbacks->pool_identify) {
LOG_ERR("Could not find symbols in %s", lib_name);
LOG_FATAL("Could not find all TBB symbols in %s", lib_name);
utils_close_library(tbb_callbacks->lib_handle);
return -1;
}
Expand Down Expand Up @@ -266,7 +266,7 @@ static umf_result_t tbb_pool_initialize(umf_memory_provider_handle_t provider,

int ret = init_tbb_callbacks(&pool_data->tbb_callbacks);
if (ret != 0) {
LOG_ERR("loading TBB symbols failed");
LOG_FATAL("loading TBB symbols failed");
return UMF_RESULT_ERROR_UNKNOWN;
}

Expand Down
4 changes: 2 additions & 2 deletions src/provider/provider_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static void init_cu_global_state(void) {
!g_cu_ops.cuCtxGetCurrent || !g_cu_ops.cuCtxSetCurrent ||
!g_cu_ops.cuIpcGetMemHandle || !g_cu_ops.cuIpcOpenMemHandle ||
!g_cu_ops.cuIpcCloseMemHandle) {
LOG_ERR("Required CUDA symbols not found.");
LOG_FATAL("Required CUDA symbols not found.");
Init_cu_global_state_failed = true;
}
}
Expand Down Expand Up @@ -296,7 +296,7 @@ static umf_result_t cu_memory_provider_initialize(void *params,

utils_init_once(&cu_is_initialized, init_cu_global_state);
if (Init_cu_global_state_failed) {
LOG_ERR("Loading CUDA symbols failed");
LOG_FATAL("Loading CUDA symbols failed");
return UMF_RESULT_ERROR_UNKNOWN;
}

Expand Down
4 changes: 2 additions & 2 deletions src/provider/provider_level_zero.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ static void init_ze_global_state(void) {
!g_ze_ops.zeDeviceGetProperties || !g_ze_ops.zeMemGetAllocProperties) {
// g_ze_ops.zeMemPutIpcHandle can be NULL because it was introduced
// starting from Level Zero 1.6
LOG_ERR("Required Level Zero symbols not found.");
LOG_FATAL("Required Level Zero symbols not found.");
Init_ze_global_state_failed = true;
}
}
Expand Down Expand Up @@ -550,7 +550,7 @@ static umf_result_t ze_memory_provider_initialize(void *params,

utils_init_once(&ze_is_initialized, init_ze_global_state);
if (Init_ze_global_state_failed) {
LOG_ERR("Loading Level Zero symbols failed");
LOG_FATAL("Loading Level Zero symbols failed");
return UMF_RESULT_ERROR_UNKNOWN;
}

Expand Down
22 changes: 12 additions & 10 deletions src/proxy_lib/proxy_lib.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -138,7 +138,7 @@ static size_t get_size_threshold(void) {
LOG_DEBUG("UMF_PROXY[size.threshold] = %s", str_threshold);
long threshold = utils_get_size_threshold(str_threshold);
if (threshold < 0) {
LOG_ERR("incorrect size threshold: %s", str_threshold);
LOG_FATAL("incorrect size threshold: %s", str_threshold);
exit(-1);
}

Expand All @@ -163,6 +163,8 @@ static int get_system_allocator_symbols(void) {
return 0;
}

LOG_FATAL("Required system allocator's symbols not found.");

return -1;
}
#endif /* _WIN32 */
Expand All @@ -174,15 +176,15 @@ void proxy_lib_create_common(void) {

umf_result = umfOsMemoryProviderParamsCreate(&os_params);
if (umf_result != UMF_RESULT_SUCCESS) {
LOG_ERR("creating OS memory provider params failed");
LOG_FATAL("creating OS memory provider params failed");
exit(-1);
}

#ifndef _WIN32
size_t _threshold = get_size_threshold();
if (_threshold > 0) {
if (get_system_allocator_symbols()) {
LOG_ERR("initialization of the system allocator failed!");
LOG_FATAL("initialization of the system allocator failed!");
exit(-1);
}

Expand All @@ -197,20 +199,20 @@ void proxy_lib_create_common(void) {
umf_result = umfOsMemoryProviderParamsSetVisibility(os_params,
UMF_MEM_MAP_SHARED);
if (umf_result != UMF_RESULT_SUCCESS) {
LOG_ERR("setting visibility mode failed");
LOG_FATAL("setting visibility mode failed");
exit(-1);
}
umf_result = umfOsMemoryProviderParamsSetShmName(os_params, NULL);
if (umf_result != UMF_RESULT_SUCCESS) {
LOG_ERR("setting shared memory name failed");
LOG_FATAL("setting shared memory name failed");
exit(-1);
}
} else if (utils_env_var_has_str("UMF_PROXY",
"page.disposition=shared-shm")) {
umf_result = umfOsMemoryProviderParamsSetVisibility(os_params,
UMF_MEM_MAP_SHARED);
if (umf_result != UMF_RESULT_SUCCESS) {
LOG_ERR("setting visibility mode failed");
LOG_FATAL("setting visibility mode failed");
exit(-1);
}

Expand All @@ -219,7 +221,7 @@ void proxy_lib_create_common(void) {
sprintf(shm_name, "umf_proxy_lib_shm_pid_%i", utils_getpid());
umf_result = umfOsMemoryProviderParamsSetShmName(os_params, shm_name);
if (umf_result != UMF_RESULT_SUCCESS) {
LOG_ERR("setting shared memory name failed");
LOG_FATAL("setting shared memory name failed");
exit(-1);
}

Expand All @@ -233,14 +235,14 @@ void proxy_lib_create_common(void) {
&OS_memory_provider);
umfOsMemoryProviderParamsDestroy(os_params);
if (umf_result != UMF_RESULT_SUCCESS) {
LOG_ERR("creating OS memory provider failed");
LOG_FATAL("creating OS memory provider failed");
exit(-1);
}

umf_result = umfPoolCreate(umfPoolManagerOps(), OS_memory_provider, NULL, 0,
&Proxy_pool);
if (umf_result != UMF_RESULT_SUCCESS) {
LOG_ERR("creating UMF pool manager failed");
LOG_FATAL("creating UMF pool manager failed");
exit(-1);
}

Expand Down
Loading