diff --git a/opal/mca/btl/usnic/btl_usnic_compat.c b/opal/mca/btl/usnic/btl_usnic_compat.c index 05a4e0c97b..03c4aa1e1f 100644 --- a/opal/mca/btl/usnic/btl_usnic_compat.c +++ b/opal/mca/btl/usnic/btl_usnic_compat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2014-2019 Cisco Systems, Inc. All rights reserved * Copyright (c) 2015 Intel, Inc. All rights reserved. * $COPYRIGHT$ * @@ -205,7 +205,7 @@ opal_event_base_t *opal_progress_thread_init(const char *name) ret = opal_thread_start(&agent_thread); if (OPAL_SUCCESS != ret) { OPAL_ERROR_LOG(ret); - ABORT("Failed to start usNIC agent thread"); + opal_btl_usnic_util_abort("Failed to start usNIC agent thread", __FILE__, __LINE__); /* Will not return */ } @@ -338,8 +338,8 @@ pack_chunk_seg_chain_with_reserve( first_pass) { seg = opal_btl_usnic_chunk_segment_alloc(module); if (OPAL_UNLIKELY(NULL == seg)) { - BTL_ERROR(("chunk segment allocation error")); - abort(); /* XXX */ + opal_btl_usnic_util_abort("chunk segment allocation error", + __FILE__, __LINE__); } ++n_segs; @@ -446,8 +446,8 @@ prepare_src_large( rc = opal_convertor_clone(convertor, &frag->sf_convertor, /*copy_stack=*/true); if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - BTL_ERROR(("unexpected convertor clone error")); - abort(); /* XXX */ + opal_btl_usnic_util_abort("unexpected convertor clone error", + __FILE__, __LINE__); } } else { diff --git a/opal/mca/btl/usnic/btl_usnic_module.c b/opal/mca/btl/usnic/btl_usnic_module.c index 7f166b0cce..d92fc71b36 100644 --- a/opal/mca/btl/usnic/btl_usnic_module.c +++ b/opal/mca/btl/usnic/btl_usnic_module.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2006 Sandia National Laboratories. All rights * reserved. - * Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved @@ -808,8 +808,8 @@ pack_chunk_seg_from_frag( /* TODO look at ways to deal with this case more gracefully, possibly as * part of capping the overall BTL memory consumption. Watch out for * possible MPI-layer deadlock. */ - BTL_ERROR(("chunk segment allocation error")); - abort(); /* XXX */ + opal_btl_usnic_util_abort("chunk segment allocation error", + __FILE__, __LINE__); } seg_space = module->max_chunk_payload; @@ -1008,8 +1008,7 @@ usnic_do_resends( ret = opal_hotel_checkin(&endpoint->endpoint_hotel, sseg, &sseg->ss_hotel_room); if (OPAL_UNLIKELY(OPAL_SUCCESS != ret)) { - BTL_ERROR(("hotel checkin failed\n")); - abort(); /* should not be possible */ + opal_btl_usnic_util_abort("hotel checkin failed\n", __FILE__, __LINE__); } } } @@ -2149,7 +2148,8 @@ static void init_connectivity_checker(opal_btl_usnic_module_t *module) int rc = opal_btl_usnic_connectivity_listen(module); if (OPAL_SUCCESS != rc) { OPAL_ERROR_LOG(rc); - ABORT("Failed to notify connectivity agent to listen"); + opal_btl_usnic_util_abort("Failed to notify connectivity agent to listen", + __FILE__, __LINE__); } } @@ -2539,7 +2539,8 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module) int rc = opal_btl_usnic_connectivity_listen(module); if (OPAL_SUCCESS != rc) { OPAL_ERROR_LOG(rc); - ABORT("Failed to notify connectivity agent to listen"); + opal_btl_usnic_util_abort("Failed to notify connectivity agent to listen", + __FILE__, __LINE__); } } else { /* If we're not doing a connectivity check, just set the port diff --git a/opal/mca/btl/usnic/btl_usnic_recv.c b/opal/mca/btl/usnic/btl_usnic_recv.c index 00e48d7a0d..6fe2991015 100644 --- a/opal/mca/btl/usnic/btl_usnic_recv.c +++ b/opal/mca/btl/usnic/btl_usnic_recv.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2006 Sandia National Laboratories. All rights * reserved. - * Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved * Copyright (c) 2012 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ @@ -231,7 +231,7 @@ void opal_btl_usnic_recv_call(opal_btl_usnic_module_t *module, fip->rfi_data_in_pool = false; } if (fip->rfi_data == NULL) { - abort(); + opal_btl_usnic_util_abort("malloc failed", __FILE__, __LINE__); } #if MSGDEBUG1 opal_output(0, "Start large recv to %p, size=%"PRIu32"\n", diff --git a/opal/mca/btl/usnic/btl_usnic_util.h b/opal/mca/btl/usnic/btl_usnic_util.h index 09bec876ab..f3552e0b33 100644 --- a/opal/mca/btl/usnic/btl_usnic_util.h +++ b/opal/mca/btl/usnic/btl_usnic_util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2013-2019 Cisco Systems, Inc. All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,6 +18,38 @@ # define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif +/* + * Safely (but abnornmally) exit this process without abort()'ing (and + * leaving a corefile). + */ +struct opal_btl_usnic_module_t; +void opal_btl_usnic_exit(struct opal_btl_usnic_module_t *module); + +/* + * Print a show_help message and then call opal_btl_usnic_exit(). + */ +void opal_btl_usnic_util_abort(const char *msg, const char *file, int line); + +/* + * Long enough to hold "xxx.xxx.xxx.xxx/xx" + */ +#define IPV4STRADDRLEN 20 + +/* + * If netmask==0, it is not included in the output string. addr is + * expected to be in network byte order. + */ +void opal_btl_usnic_snprintf_ipv4_addr(char *out, size_t maxlen, + uint32_t addr_be, uint32_t netmask_be); + +void opal_btl_usnic_snprintf_bool_array(char *s, size_t slen, bool a[], size_t alen); + +void opal_btl_usnic_dump_hex(int verbose_level, int output_id, + void *vaddr, int len); + +size_t opal_btl_usnic_convertor_pack_peek(const opal_convertor_t *conv, + size_t max_len); + /* avoid "defined but not used" warnings */ static inline int __opal_attribute_always_inline__ usnic_fls(int x) __opal_attribute_unused__; @@ -69,8 +101,7 @@ usnic_convertor_pack_simple( *bytes_packed = max_bytes_to_pack; rc = opal_convertor_pack(convertor, &iov, &iov_count, bytes_packed); if (OPAL_UNLIKELY(rc < 0)) { - BTL_ERROR(("opal_convertor_pack error")); - abort(); /* XXX */ + opal_btl_usnic_util_abort("opal_convertor_pack error", __FILE__, __LINE__); } } @@ -91,36 +122,4 @@ usnic_cidrlen_to_netmask( return htonl(mask); } -/* - * Safely (but abnornmally) exit this process without abort()'ing (and - * leaving a corefile). - */ -struct opal_btl_usnic_module_t; -void opal_btl_usnic_exit(struct opal_btl_usnic_module_t *module); - -/* - * Print a show_help message and then call opal_btl_usnic_exit(). - */ -void opal_btl_usnic_util_abort(const char *msg, const char *file, int line); - -/* - * Long enough to hold "xxx.xxx.xxx.xxx/xx" - */ -#define IPV4STRADDRLEN 20 - -/* - * If netmask==0, it is not included in the output string. addr is - * expected to be in network byte order. - */ -void opal_btl_usnic_snprintf_ipv4_addr(char *out, size_t maxlen, - uint32_t addr_be, uint32_t netmask_be); - -void opal_btl_usnic_snprintf_bool_array(char *s, size_t slen, bool a[], size_t alen); - -void opal_btl_usnic_dump_hex(int verbose_level, int output_id, - void *vaddr, int len); - -size_t opal_btl_usnic_convertor_pack_peek(const opal_convertor_t *conv, - size_t max_len); - #endif /* BTL_USNIC_UTIL_H */