Skip to content

Commit 4ccf369

Browse files
Merge pull request #1095 from ldorau/Use_LOG_FATAL_in_case_of_critical_errors
Use LOG_FATAL() in case of critical errors
2 parents f0a34f6 + a77a37c commit 4ccf369

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

src/pool/pool_scalable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023-2024 Intel Corporation
3+
* Copyright (C) 2023-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -143,7 +143,7 @@ static int init_tbb_callbacks(tbb_callbacks_t *tbb_callbacks) {
143143
!tbb_callbacks->pool_aligned_malloc || !tbb_callbacks->pool_free ||
144144
!tbb_callbacks->pool_create_v1 || !tbb_callbacks->pool_destroy ||
145145
!tbb_callbacks->pool_identify) {
146-
LOG_ERR("Could not find symbols in %s", lib_name);
146+
LOG_FATAL("Could not find all TBB symbols in %s", lib_name);
147147
utils_close_library(tbb_callbacks->lib_handle);
148148
return -1;
149149
}
@@ -266,7 +266,7 @@ static umf_result_t tbb_pool_initialize(umf_memory_provider_handle_t provider,
266266

267267
int ret = init_tbb_callbacks(&pool_data->tbb_callbacks);
268268
if (ret != 0) {
269-
LOG_ERR("loading TBB symbols failed");
269+
LOG_FATAL("loading TBB symbols failed");
270270
return UMF_RESULT_ERROR_UNKNOWN;
271271
}
272272

src/provider/provider_cuda.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static void init_cu_global_state(void) {
202202
!g_cu_ops.cuCtxGetCurrent || !g_cu_ops.cuCtxSetCurrent ||
203203
!g_cu_ops.cuIpcGetMemHandle || !g_cu_ops.cuIpcOpenMemHandle ||
204204
!g_cu_ops.cuIpcCloseMemHandle) {
205-
LOG_ERR("Required CUDA symbols not found.");
205+
LOG_FATAL("Required CUDA symbols not found.");
206206
Init_cu_global_state_failed = true;
207207
}
208208
}
@@ -296,7 +296,7 @@ static umf_result_t cu_memory_provider_initialize(void *params,
296296

297297
utils_init_once(&cu_is_initialized, init_cu_global_state);
298298
if (Init_cu_global_state_failed) {
299-
LOG_ERR("Loading CUDA symbols failed");
299+
LOG_FATAL("Loading CUDA symbols failed");
300300
return UMF_RESULT_ERROR_UNKNOWN;
301301
}
302302

src/provider/provider_level_zero.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static void init_ze_global_state(void) {
242242
!g_ze_ops.zeDeviceGetProperties || !g_ze_ops.zeMemGetAllocProperties) {
243243
// g_ze_ops.zeMemPutIpcHandle can be NULL because it was introduced
244244
// starting from Level Zero 1.6
245-
LOG_ERR("Required Level Zero symbols not found.");
245+
LOG_FATAL("Required Level Zero symbols not found.");
246246
Init_ze_global_state_failed = true;
247247
}
248248
}
@@ -550,7 +550,7 @@ static umf_result_t ze_memory_provider_initialize(void *params,
550550

551551
utils_init_once(&ze_is_initialized, init_ze_global_state);
552552
if (Init_ze_global_state_failed) {
553-
LOG_ERR("Loading Level Zero symbols failed");
553+
LOG_FATAL("Loading Level Zero symbols failed");
554554
return UMF_RESULT_ERROR_UNKNOWN;
555555
}
556556

src/proxy_lib/proxy_lib.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2024 Intel Corporation
2+
* Copyright (C) 2024-2025 Intel Corporation
33
*
44
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -138,7 +138,7 @@ static size_t get_size_threshold(void) {
138138
LOG_DEBUG("UMF_PROXY[size.threshold] = %s", str_threshold);
139139
long threshold = utils_get_size_threshold(str_threshold);
140140
if (threshold < 0) {
141-
LOG_ERR("incorrect size threshold: %s", str_threshold);
141+
LOG_FATAL("incorrect size threshold: %s", str_threshold);
142142
exit(-1);
143143
}
144144

@@ -163,6 +163,8 @@ static int get_system_allocator_symbols(void) {
163163
return 0;
164164
}
165165

166+
LOG_FATAL("Required system allocator's symbols not found.");
167+
166168
return -1;
167169
}
168170
#endif /* _WIN32 */
@@ -174,15 +176,15 @@ void proxy_lib_create_common(void) {
174176

175177
umf_result = umfOsMemoryProviderParamsCreate(&os_params);
176178
if (umf_result != UMF_RESULT_SUCCESS) {
177-
LOG_ERR("creating OS memory provider params failed");
179+
LOG_FATAL("creating OS memory provider params failed");
178180
exit(-1);
179181
}
180182

181183
#ifndef _WIN32
182184
size_t _threshold = get_size_threshold();
183185
if (_threshold > 0) {
184186
if (get_system_allocator_symbols()) {
185-
LOG_ERR("initialization of the system allocator failed!");
187+
LOG_FATAL("initialization of the system allocator failed!");
186188
exit(-1);
187189
}
188190

@@ -197,20 +199,20 @@ void proxy_lib_create_common(void) {
197199
umf_result = umfOsMemoryProviderParamsSetVisibility(os_params,
198200
UMF_MEM_MAP_SHARED);
199201
if (umf_result != UMF_RESULT_SUCCESS) {
200-
LOG_ERR("setting visibility mode failed");
202+
LOG_FATAL("setting visibility mode failed");
201203
exit(-1);
202204
}
203205
umf_result = umfOsMemoryProviderParamsSetShmName(os_params, NULL);
204206
if (umf_result != UMF_RESULT_SUCCESS) {
205-
LOG_ERR("setting shared memory name failed");
207+
LOG_FATAL("setting shared memory name failed");
206208
exit(-1);
207209
}
208210
} else if (utils_env_var_has_str("UMF_PROXY",
209211
"page.disposition=shared-shm")) {
210212
umf_result = umfOsMemoryProviderParamsSetVisibility(os_params,
211213
UMF_MEM_MAP_SHARED);
212214
if (umf_result != UMF_RESULT_SUCCESS) {
213-
LOG_ERR("setting visibility mode failed");
215+
LOG_FATAL("setting visibility mode failed");
214216
exit(-1);
215217
}
216218

@@ -219,7 +221,7 @@ void proxy_lib_create_common(void) {
219221
sprintf(shm_name, "umf_proxy_lib_shm_pid_%i", utils_getpid());
220222
umf_result = umfOsMemoryProviderParamsSetShmName(os_params, shm_name);
221223
if (umf_result != UMF_RESULT_SUCCESS) {
222-
LOG_ERR("setting shared memory name failed");
224+
LOG_FATAL("setting shared memory name failed");
223225
exit(-1);
224226
}
225227

@@ -233,14 +235,14 @@ void proxy_lib_create_common(void) {
233235
&OS_memory_provider);
234236
umfOsMemoryProviderParamsDestroy(os_params);
235237
if (umf_result != UMF_RESULT_SUCCESS) {
236-
LOG_ERR("creating OS memory provider failed");
238+
LOG_FATAL("creating OS memory provider failed");
237239
exit(-1);
238240
}
239241

240242
umf_result = umfPoolCreate(umfPoolManagerOps(), OS_memory_provider, NULL, 0,
241243
&Proxy_pool);
242244
if (umf_result != UMF_RESULT_SUCCESS) {
243-
LOG_ERR("creating UMF pool manager failed");
245+
LOG_FATAL("creating UMF pool manager failed");
244246
exit(-1);
245247
}
246248

0 commit comments

Comments
 (0)