1
1
openmpi/opal/runtime/opal.h
Jeff Squyres 5071602c59 PSM/PSM2: Disable signal handler hijacking by default
Per discussion on https://github.com/open-mpi/ompi/pull/1767 (and some
subsequent phone calls and off-issue email discussions), the PSM
library is hijacking signal handlers by default.  Specifically: unless
the environment variables `IPATH_NO_BACKTRACE=1` (for PSM / Intel
TrueScale) is set, the library constructor for this library will
hijack various signal handlers for the purpose of invoking its own
error reporting mechanisms.

This may be a bit *surprising*, but is not a *problem*, per se.  The
real problem is that older versions of at least the PSM library do not
unregister these signal handlers upon being unloaded from memory.
Hence, a segv can actually result in a double segv (i.e., the original
segv and then another segv when the now-non-existent signal handler is
invoked).

This PSM signal hijacking subverts Open MPI's own signal reporting
mechanism, which may be a bit surprising for some users (particularly
those who do not have Intel TrueScale).  As such, we disable it by
default so that Open MPI's own error-reporting mechanisms are used.

Additionally, there is a typo in the library destructor for the PSM2
library that may cause problems in the unloading of its signal
handlers.  This problem can be avoided by setting `HFI_NO_BACKTRACE=1`
(for PSM2 / Intel OmniPath).

This is further compounded by the fact that the PSM / PSM2 libraries
can be loaded by the OFI MTL and the usNIC BTL (because they are
loaded by libfabric), even when there is no Intel networking hardware
present.  Having the PSM/PSM2 libraries behave this way when no Intel
hardware is present is clearly undesirable (and is likely to be fixed
in future releases of the PSM/PSM2 libraries).

This commit sets the following two environment variables to disable
this behavior from the PSM/PSM2 libraries (if they are not already
set):

* IPATH_NO_BACKTRACE=1
* HFI_NO_BACKTRACE=1

If the user has set these variables before invoking Open MPI, we will
not override their values (i.e., their preferences will be honored).

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
2016-06-14 11:45:23 -07:00

137 строки
4.0 KiB
C

/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file **/
#ifndef OPAL_H
#define OPAL_H
#include "opal_config.h"
#include "opal/types.h"
BEGIN_C_DECLS
/** version string of opal */
OPAL_DECLSPEC extern const char opal_version_string[];
/* Size of a cache line. Initialized to a fixed value (see
opal_init.c) until hwloc data is available, at which time it is
filled with the smallest size of the lowest cache line (e.g., the
smallest line size from all L2 caches found on the current system).
If the hwloc data is available, opal_cache_line_size will be set to
its final value by the end of orte_init(). */
OPAL_DECLSPEC extern int opal_cache_line_size;
/** Do we want to be warned on fork or not? */
OPAL_DECLSPEC extern bool opal_warn_on_fork;
/**
* Initialize the OPAL layer, including the MCA system.
*
* @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERROR Upon failure.
*
* \note If this function is called, opal_init_util() should *not* be
* called.
*/
OPAL_DECLSPEC int opal_init(int* pargc, char*** pargv);
/**
* Finalize the OPAL layer, including the MCA system.
*
* @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERROR Upon failure.
*
* \note If this function is called, opal_finalize_util() should *not*
* be called.
*/
OPAL_DECLSPEC int opal_finalize(void);
/**
* Initialize the OPAL layer, excluding the MCA system.
*
* @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERROR Upon failure.
*
* \note If this function is called, opal_init() should *not*
* be called.
*/
OPAL_DECLSPEC int opal_init_util(int* pargc, char*** pargv);
/**
* Disable PSM/PSM2 signal hijacking.
*
* See comment in the function for more detail.
*/
OPAL_DECLSPEC int opal_init_psm(void);
/**
* Finalize the OPAL layer, excluding the MCA system.
*
* @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERROR Upon failure.
*
* \note If this function is called, opal_finalize() should *not*
* be called.
*/
OPAL_DECLSPEC int opal_finalize_util(void);
/**
* Initialize a very thin OPAL layer solely for use
* by unit tests. The purpose of this function is to
* provide the absolute bare minimum support required
* to open, select, and close a framework. This is
* maintained separately from the other OPAL runtime
* APIs to avoid conflicts when new frameworks are
* added to the normal OPAL init sequence. It has no
* other purpose and should not be used outside of
* unit tests.
*
* @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERROR Upon failure.
*/
OPAL_DECLSPEC int opal_init_test(void);
/**
* Finalize the very thin OPAL layer used solely
* by unit tests. The purpose of this function is to
* finalize the absolute bare minimum support opened
* by its companion opal_init_test API. It has no
* other purpose and should not be used outside of
* unit tests.
*
* @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERROR Upon failure.
*/
OPAL_DECLSPEC void opal_finalize_test(void);
OPAL_DECLSPEC void opal_warn_fork(void);
/**
* Internal function. Do not call.
*/
OPAL_DECLSPEC int opal_register_params(void);
OPAL_DECLSPEC int opal_deregister_params(void);
END_C_DECLS
#endif