Skip to content

Commit 8a24416

Browse files
committed
btl/usnic: remove all calls to abort()
Inspired by #5205, finally remove all calls to abort() from the usnic BTL. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent b82a082 commit 8a24416

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

opal/mca/btl/usnic/btl_usnic_compat.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2018 Cisco Systems, Inc. All rights reserved
2+
* Copyright (c) 2014-2019 Cisco Systems, Inc. All rights reserved
33
* Copyright (c) 2015 Intel, Inc. All rights reserved.
44
* $COPYRIGHT$
55
*
@@ -205,7 +205,7 @@ opal_event_base_t *opal_progress_thread_init(const char *name)
205205
ret = opal_thread_start(&agent_thread);
206206
if (OPAL_SUCCESS != ret) {
207207
OPAL_ERROR_LOG(ret);
208-
ABORT("Failed to start usNIC agent thread");
208+
opal_btl_usnic_util_abort("Failed to start usNIC agent thread", __FILE__, __LINE__);
209209
/* Will not return */
210210
}
211211

@@ -338,8 +338,8 @@ pack_chunk_seg_chain_with_reserve(
338338
first_pass) {
339339
seg = opal_btl_usnic_chunk_segment_alloc(module);
340340
if (OPAL_UNLIKELY(NULL == seg)) {
341-
BTL_ERROR(("chunk segment allocation error"));
342-
abort(); /* XXX */
341+
opal_btl_usnic_util_abort("chunk segment allocation error",
342+
__FILE__, __LINE__);
343343
}
344344
++n_segs;
345345

@@ -446,8 +446,8 @@ prepare_src_large(
446446
rc = opal_convertor_clone(convertor, &frag->sf_convertor,
447447
/*copy_stack=*/true);
448448
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
449-
BTL_ERROR(("unexpected convertor clone error"));
450-
abort(); /* XXX */
449+
opal_btl_usnic_util_abort("unexpected convertor clone error",
450+
__FILE__, __LINE__);
451451
}
452452
}
453453
else {

opal/mca/btl/usnic/btl_usnic_module.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2006 Sandia National Laboratories. All rights
1414
* reserved.
15-
* Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved.
15+
* Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved
1616
* Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* Copyright (c) 2014 Intel, Inc. All rights reserved
@@ -808,8 +808,8 @@ pack_chunk_seg_from_frag(
808808
/* TODO look at ways to deal with this case more gracefully, possibly as
809809
* part of capping the overall BTL memory consumption. Watch out for
810810
* possible MPI-layer deadlock. */
811-
BTL_ERROR(("chunk segment allocation error"));
812-
abort(); /* XXX */
811+
opal_btl_usnic_util_abort("chunk segment allocation error",
812+
__FILE__, __LINE__);
813813
}
814814

815815
seg_space = module->max_chunk_payload;
@@ -1008,8 +1008,7 @@ usnic_do_resends(
10081008
ret = opal_hotel_checkin(&endpoint->endpoint_hotel,
10091009
sseg, &sseg->ss_hotel_room);
10101010
if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) {
1011-
BTL_ERROR(("hotel checkin failed\n"));
1012-
abort(); /* should not be possible */
1011+
opal_btl_usnic_util_abort("hotel checkin failed\n", __FILE__, __LINE__);
10131012
}
10141013
}
10151014
}
@@ -2149,7 +2148,8 @@ static void init_connectivity_checker(opal_btl_usnic_module_t *module)
21492148
int rc = opal_btl_usnic_connectivity_listen(module);
21502149
if (OPAL_SUCCESS != rc) {
21512150
OPAL_ERROR_LOG(rc);
2152-
ABORT("Failed to notify connectivity agent to listen");
2151+
opal_btl_usnic_util_abort("Failed to notify connectivity agent to listen",
2152+
__FILE__, __LINE__);
21532153
}
21542154
}
21552155

@@ -2539,7 +2539,8 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
25392539
int rc = opal_btl_usnic_connectivity_listen(module);
25402540
if (OPAL_SUCCESS != rc) {
25412541
OPAL_ERROR_LOG(rc);
2542-
ABORT("Failed to notify connectivity agent to listen");
2542+
opal_btl_usnic_util_abort("Failed to notify connectivity agent to listen",
2543+
__FILE__, __LINE__);
25432544
}
25442545
} else {
25452546
/* If we're not doing a connectivity check, just set the port

opal/mca/btl/usnic/btl_usnic_recv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2006 Sandia National Laboratories. All rights
1313
* reserved.
14-
* Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved
14+
* Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved
1515
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* $COPYRIGHT$
@@ -231,7 +231,7 @@ void opal_btl_usnic_recv_call(opal_btl_usnic_module_t *module,
231231
fip->rfi_data_in_pool = false;
232232
}
233233
if (fip->rfi_data == NULL) {
234-
abort();
234+
opal_btl_usnic_util_abort("malloc failed", __FILE__, __LINE__);
235235
}
236236
#if MSGDEBUG1
237237
opal_output(0, "Start large recv to %p, size=%"PRIu32"\n",

opal/mca/btl/usnic/btl_usnic_util.h

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2017 Cisco Systems, Inc. All rights reserved
2+
* Copyright (c) 2013-2019 Cisco Systems, Inc. All rights reserved
33
* $COPYRIGHT$
44
*
55
* Additional copyrights may follow
@@ -18,6 +18,38 @@
1818
# define MIN(a,b) ((a) < (b) ? (a) : (b))
1919
#endif
2020

21+
/*
22+
* Safely (but abnornmally) exit this process without abort()'ing (and
23+
* leaving a corefile).
24+
*/
25+
struct opal_btl_usnic_module_t;
26+
void opal_btl_usnic_exit(struct opal_btl_usnic_module_t *module);
27+
28+
/*
29+
* Print a show_help message and then call opal_btl_usnic_exit().
30+
*/
31+
void opal_btl_usnic_util_abort(const char *msg, const char *file, int line);
32+
33+
/*
34+
* Long enough to hold "xxx.xxx.xxx.xxx/xx"
35+
*/
36+
#define IPV4STRADDRLEN 20
37+
38+
/*
39+
* If netmask==0, it is not included in the output string. addr is
40+
* expected to be in network byte order.
41+
*/
42+
void opal_btl_usnic_snprintf_ipv4_addr(char *out, size_t maxlen,
43+
uint32_t addr_be, uint32_t netmask_be);
44+
45+
void opal_btl_usnic_snprintf_bool_array(char *s, size_t slen, bool a[], size_t alen);
46+
47+
void opal_btl_usnic_dump_hex(int verbose_level, int output_id,
48+
void *vaddr, int len);
49+
50+
size_t opal_btl_usnic_convertor_pack_peek(const opal_convertor_t *conv,
51+
size_t max_len);
52+
2153
/* avoid "defined but not used" warnings */
2254
static inline int __opal_attribute_always_inline__ usnic_fls(int x)
2355
__opal_attribute_unused__;
@@ -69,8 +101,7 @@ usnic_convertor_pack_simple(
69101
*bytes_packed = max_bytes_to_pack;
70102
rc = opal_convertor_pack(convertor, &iov, &iov_count, bytes_packed);
71103
if (OPAL_UNLIKELY(rc < 0)) {
72-
BTL_ERROR(("opal_convertor_pack error"));
73-
abort(); /* XXX */
104+
opal_btl_usnic_util_abort("opal_convertor_pack error", __FILE__, __LINE__);
74105
}
75106
}
76107

@@ -91,36 +122,4 @@ usnic_cidrlen_to_netmask(
91122
return htonl(mask);
92123
}
93124

94-
/*
95-
* Safely (but abnornmally) exit this process without abort()'ing (and
96-
* leaving a corefile).
97-
*/
98-
struct opal_btl_usnic_module_t;
99-
void opal_btl_usnic_exit(struct opal_btl_usnic_module_t *module);
100-
101-
/*
102-
* Print a show_help message and then call opal_btl_usnic_exit().
103-
*/
104-
void opal_btl_usnic_util_abort(const char *msg, const char *file, int line);
105-
106-
/*
107-
* Long enough to hold "xxx.xxx.xxx.xxx/xx"
108-
*/
109-
#define IPV4STRADDRLEN 20
110-
111-
/*
112-
* If netmask==0, it is not included in the output string. addr is
113-
* expected to be in network byte order.
114-
*/
115-
void opal_btl_usnic_snprintf_ipv4_addr(char *out, size_t maxlen,
116-
uint32_t addr_be, uint32_t netmask_be);
117-
118-
void opal_btl_usnic_snprintf_bool_array(char *s, size_t slen, bool a[], size_t alen);
119-
120-
void opal_btl_usnic_dump_hex(int verbose_level, int output_id,
121-
void *vaddr, int len);
122-
123-
size_t opal_btl_usnic_convertor_pack_peek(const opal_convertor_t *conv,
124-
size_t max_len);
125-
126125
#endif /* BTL_USNIC_UTIL_H */

0 commit comments

Comments
 (0)