From 60b338e85735751a07cfd427089b66d15f3a0c96 Mon Sep 17 00:00:00 2001
From: Ralph Castain <rhc@open-mpi.org>
Date: Sat, 14 Oct 2017 08:24:57 -0700
Subject: [PATCH] Sync to PMIx v3. Ensure prun uses the ess/tool component.

Signed-off-by: Ralph Castain <rhc@open-mpi.org>
---
 opal/mca/pmix/pmix3x/pmix/NEWS                |  22 ++
 opal/mca/pmix/pmix3x/pmix/README              |  26 +++
 opal/mca/pmix/pmix3x/pmix/VERSION             |   4 +-
 opal/mca/pmix/pmix3x/pmix/config/pmix.m4      |  26 +++
 .../pmix3x/pmix/config/pmix_config_asm.m4     |  16 +-
 .../pmix/src/atomics/sys/Makefile.include     |   2 -
 .../src/atomics/sys/ia64/Makefile.include     |  24 ---
 .../pmix3x/pmix/src/atomics/sys/ia64/atomic.h | 146 -------------
 .../pmix3x/pmix/src/atomics/sys/ia64/timer.h  |  48 -----
 .../src/atomics/sys/mips/Makefile.include     |  24 ---
 .../pmix3x/pmix/src/atomics/sys/mips/atomic.h | 199 ------------------
 .../pmix3x/pmix/src/atomics/sys/mips/timer.h  |  33 ---
 .../pmix/src/mca/base/pmix_mca_base_open.c    |   4 +-
 .../pmix/src/mca/base/pmix_mca_base_var.c     |   2 +-
 .../src/mca/bfrops/base/bfrop_base_copy.c     |   1 +
 .../pmix3x/pmix/src/mca/bfrops/v20/copy.c     |   1 +
 .../pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c |   5 +-
 .../pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h  |   2 +
 .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c     |   7 +
 .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c  |  10 +-
 .../pmix/pmix3x/pmix/src/server/pmix_server.c |  24 ++-
 orte/tools/prun/prun.c                        |   2 +
 22 files changed, 125 insertions(+), 503 deletions(-)
 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/Makefile.include
 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/atomic.h
 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/timer.h
 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/Makefile.include
 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/atomic.h
 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/timer.h

diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS
index 4df8ad3aae..93468a64f1 100644
--- a/opal/mca/pmix/pmix3x/pmix/NEWS
+++ b/opal/mca/pmix/pmix3x/pmix/NEWS
@@ -83,6 +83,28 @@ Master (not on release branches yet)
   and to themselves
 
 
+1.2.4 -- 13 Oct. 2017
+----------------------
+- Silence some unnecessary warning messages (PR #487)
+- Coverity fix - TOCTOU (PR #465)
+- automake 1.13 configure fix (PR #486)
+- Update RPM spec file (rpmbuild -ta, and --rebuild fixes) (PR #523)
+- Support singletons in PMI-1/PMI-2 (PR #537)
+
+
+1.2.3 -- 24 Aug. 2017
+----------------------
+- Resolve visibility issues for public APIs (PR #451)
+- Atomics update - remove custom ASM atomics (PR #458)
+- Fix job-fence test (PR #423)
+- Replace stale PMIX_DECLSPEC with PMIX_EXPORT (PR #448)
+- Memory barrier fixes for thread shifting (PR #387)
+- Fix race condition in dmodex (PR #346)
+- Allow disable backward compatability for PMI-1/2 (PR #350)
+- Fix segv in PMIx_server_deregister_nspace (PR #343)
+- Fix possible hang in PMIx_Abort (PR #339)
+
+
 1.2.2 -- 21 March 2017
 ----------------------
 - Compiler fix for Sun/Oracle CC (PR #322)
diff --git a/opal/mca/pmix/pmix3x/pmix/README b/opal/mca/pmix/pmix3x/pmix/README
index 6eaf57526f..1baa106987 100644
--- a/opal/mca/pmix/pmix3x/pmix/README
+++ b/opal/mca/pmix/pmix3x/pmix/README
@@ -128,6 +128,32 @@ INSTALLATION OPTIONS
   --disable-shared; enabling static libraries and disabling shared
   libraries are two independent options.
 
+ --disable-show-load-errors-by-default
+   Set the default value of the mca_base_component_show_load_errors MCA
+   variable: the --enable form of this option sets the MCA variable to
+   true, the --disable form sets the MCA variable to false.  The MCA
+   mca_base_component_show_load_errors variable can still be overridden
+   at run time via the usual MCA-variable-setting mechanisms; this
+   configure option simply sets the default value.
+
+   The --disable form of this option is intended for PMIx packagers
+   who tend to enable support for many different types of networks and
+   systems in their packages.  For example, consider a packager who
+   includes support for both the FOO and BAR networks in their PMIx
+   package, both of which require support libraries (libFOO.so and
+   libBAR.so).  If an end user only has BAR hardware, they likely only
+   have libBAR.so available on their systems -- not libFOO.so.
+   Disabling load errors by default will prevent the user from seeing
+   potentially confusing warnings about the FOO components failing to
+   load because libFOO.so is not available on their systems.
+
+   Conversely, system administrators tend to build a PMIx that is
+   targeted at their specific environment, and contains few (if any)
+   components that are not needed.  In such cases, they might want
+   their users to be warned that the FOO network components failed to
+   load (e.g., if libFOO.so was mistakenly unavailable), and thus
+   some PMIx calls might unexpectedly return "not supported".
+
 --with-platform=FILE
   Load configure options for the build from FILE.  Options on the
   command line that are not in FILE are also used.  Options on the
diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION
index 0953e608d0..37ef26cf0f 100644
--- a/opal/mca/pmix/pmix3x/pmix/VERSION
+++ b/opal/mca/pmix/pmix3x/pmix/VERSION
@@ -30,7 +30,7 @@ greek=
 # command, or with the date (if "git describe" fails) in the form of
 # "date<date>".
 
-repo_rev=git6001265
+repo_rev=gitd74c321
 
 # If tarball_version is not empty, it is used as the version string in
 # the tarball filename, regardless of all other versions listed in
@@ -44,7 +44,7 @@ tarball_version=
 
 # The date when this release was created
 
-date="Oct 09, 2017"
+date="Oct 14, 2017"
 
 # The shared library version of each of PMIx's public libraries.
 # These versions are maintained in accordance with the "Library
diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4
index cef9975d90..55fe4d4a4a 100644
--- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4
+++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4
@@ -705,6 +705,32 @@ AC_DEFUN([PMIX_SETUP_CORE],[
 
     pmix_show_title "Modular Component Architecture (MCA) setup"
 
+    #
+    # Do we want to show component load error messages by default?
+    #
+
+    AC_MSG_CHECKING([for default value of mca_base_component_show_load_errors])
+    AC_ARG_ENABLE([show-load-errors-by-default],
+                  [AC_HELP_STRING([--enable-show-load-errors-by-default],
+                                  [Set the default value for the MCA parameter
+                                   mca_base_component_show_load_errors (but can be
+                                   overridden at run time by the usual
+                                   MCA-variable-setting mechansism).  This MCA variable
+                                   controls whether warnings are displayed when an MCA
+                                   component fails to load at run time due to an error.
+                                   (default: enabled, meaning that
+                                   mca_base_component_show_load_errors is enabled
+                                   by default])])
+    if test "$enable_show_load_errors_by_default" = "no" ; then
+        PMIX_SHOW_LOAD_ERRORS_DEFAULT=0
+        AC_MSG_RESULT([disabled by default])
+    else
+        PMIX_SHOW_LOAD_ERRORS_DEFAULT=1
+        AC_MSG_RESULT([enabled by default])
+    fi
+    AC_DEFINE_UNQUOTED(PMIX_SHOW_LOAD_ERRORS_DEFAULT, $PMIX_SHOW_LOAD_ERRORS_DEFAULT,
+                       [Default value for mca_base_component_show_load_errors MCA variable])
+
     AC_MSG_CHECKING([for subdir args])
     PMIX_CONFIG_SUBDIR_ARGS([pmix_subdir_args])
     AC_MSG_RESULT([$pmix_subdir_args])
diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4
index 91f24ad1f1..062440499a 100644
--- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4
+++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4
@@ -959,8 +959,8 @@ AC_DEFUN([PMIX_CONFIG_ASM],[
 
         ia64-*)
             pmix_cv_asm_arch="IA64"
-            PMIX_ASM_SUPPORT_64BIT=1
-            PMIX_GCC_INLINE_ASSIGN='"mov %0=r0\n;;\n" : "=&r"(ret)'
+            PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"],
+                          [AC_MSG_ERROR([No atomic primitives available for $host])])
             ;;
 	aarch64*)
             pmix_cv_asm_arch="ARM64"
@@ -993,20 +993,16 @@ AC_DEFUN([PMIX_CONFIG_ASM],[
         armv5*linux*|armv4*linux*|arm-*-linux-gnueabi)
             # uses Linux kernel helpers for some atomic operations
             pmix_cv_asm_arch="ARM"
-            PMIX_ASM_SUPPORT_64BIT=0
-            PMIX_ASM_ARM_VERSION=5
-            CCASFLAGS="$CCASFLAGS -march=armv7-a"
-            AC_DEFINE_UNQUOTED([PMIX_ASM_ARM_VERSION], [$PMIX_ASM_ARM_VERSION],
-                               [What ARM assembly version to use])
-            PMIX_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
+            PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"],
+                          [AC_MSG_ERROR([No atomic primitives available for $host])])
             ;;
 
         mips-*|mips64*)
             # Should really find some way to make sure that we are on
             # a MIPS III machine (r4000 and later)
             pmix_cv_asm_arch="MIPS"
-            PMIX_ASM_SUPPORT_64BIT=1
-            PMIX_GCC_INLINE_ASSIGN='"or %0,[$]0,[$]0" : "=&r"(ret)'
+            PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"],
+                          [AC_MSG_ERROR([No atomic primitives available for $host])])
             ;;
 
         powerpc-*|powerpc64-*|powerpcle-*|powerpc64le-*|rs6000-*|ppc-*)
diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include
index 9f677e5e44..dbd384e3e5 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include
+++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include
@@ -36,8 +36,6 @@ include atomics/sys/x86_64/Makefile.include
 include atomics/sys/arm/Makefile.include
 include atomics/sys/arm64/Makefile.include
 include atomics/sys/ia32/Makefile.include
-include atomics/sys/ia64/Makefile.include
-include atomics/sys/mips/Makefile.include
 include atomics/sys/powerpc/Makefile.include
 include atomics/sys/sparcv9/Makefile.include
 include atomics/sys/sync_builtin/Makefile.include
diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/Makefile.include
deleted file mode 100644
index d1f4e5e4b6..0000000000
--- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/Makefile.include
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
-#                         University Research and Technology
-#                         Corporation.  All rights reserved.
-# Copyright (c) 2004-2005 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) 2017      Intel, Inc. All rights reserved.
-# $COPYRIGHT$
-#
-# Additional copyrights may follow
-#
-# $HEADER$
-#
-
-# This makefile.am does not stand on its own - it is included from pmix/include/Makefile.am
-
-headers += \
-	atomics/sys/ia64/atomic.h \
-	atomics/sys/ia64/timer.h
diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/atomic.h
deleted file mode 100644
index ca8ce8dfdd..0000000000
--- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/atomic.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
- *                         University Research and Technology
- *                         Corporation.  All rights reserved.
- * Copyright (c) 2004-2005 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) 2017      Intel, Inc. All rights reserved.
- * $COPYRIGHT$
- *
- * Additional copyrights may follow
- *
- * $HEADER$
- */
-
-#ifndef PMIX_SYS_ARCH_ATOMIC_H
-#define PMIX_SYS_ARCH_ATOMIC_H 1
-
-/*
- * On ia64, we use cmpxchg, which supports acquire/release semantics natively.
- */
-
-
-#define PMIXMB() __asm__ __volatile__("mf": : :"memory")
-
-
-/**********************************************************************
- *
- * Define constants for IA64
- *
- *********************************************************************/
-#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1
-
-#define PMIX_HAVE_ATOMIC_CMPSET_32 1
-#define PMIX_HAVE_ATOMIC_CMPSET_64 1
-
-/**********************************************************************
- *
- * Memory Barriers
- *
- *********************************************************************/
-#if PMIX_GCC_INLINE_ASSEMBLY
-
-static inline void pmix_atomic_mb(void)
-{
-    PMIXMB();
-}
-
-
-static inline void pmix_atomic_rmb(void)
-{
-    PMIXMB();
-}
-
-
-static inline void pmix_atomic_wmb(void)
-{
-    PMIXMB();
-}
-
-static inline void pmix_atomic_isync(void)
-{
-}
-
-#endif /* PMIX_GCC_INLINE_ASSEMBLY */
-
-
-/**********************************************************************
- *
- * Atomic math operations
- *
- *********************************************************************/
-#if PMIX_GCC_INLINE_ASSEMBLY
-
-#define ia64_cmpxchg4_acq(ptr, new, old)                 \
-({                               \
-   __u64 ia64_intri_res;                        \
-   ia64_intri_res;                           \
-})
-
-static inline int pmix_atomic_cmpset_acq_32( volatile int32_t *addr,
-                                             int32_t oldval, int32_t newval)
-{
-    int64_t ret;
-
-    __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval));
-    __asm__ __volatile__ ("cmpxchg4.acq %0=[%1],%2,ar.ccv":
-                          "=r"(ret) : "r"(addr), "r"(newval) : "memory");
-
-    return ((int32_t)ret == oldval);
-}
-
-
-static inline int pmix_atomic_cmpset_rel_32( volatile int32_t *addr,
-                                             int32_t oldval, int32_t newval)
-{
-    int64_t ret;
-
-    __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval));
-    __asm__ __volatile__ ("cmpxchg4.rel %0=[%1],%2,ar.ccv":
-                  "=r"(ret) : "r"(addr), "r"(newval) : "memory");
-
-    return ((int32_t)ret == oldval);
-}
-
-#endif /* PMIX_GCC_INLINE_ASSEMBLY */
-
-
-#define pmix_atomic_cmpset_32 pmix_atomic_cmpset_acq_32
-
-#if PMIX_GCC_INLINE_ASSEMBLY
-
-static inline int pmix_atomic_cmpset_acq_64( volatile int64_t *addr,
-                                             int64_t oldval, int64_t newval)
-{
-    int64_t ret;
-
-    __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval));
-    __asm__ __volatile__ ("cmpxchg8.acq %0=[%1],%2,ar.ccv":
-                  "=r"(ret) : "r"(addr), "r"(newval) : "memory");
-
-    return (ret == oldval);
-}
-
-
-static inline int pmix_atomic_cmpset_rel_64( volatile int64_t *addr,
-                                             int64_t oldval, int64_t newval)
-{
-    int64_t ret;
-
-    __asm__ __volatile__ ("mov ar.ccv=%0;;" :: "rO"(oldval));
-    __asm__ __volatile__ ("cmpxchg8.rel %0=[%1],%2,ar.ccv":
-                  "=r"(ret) : "r"(addr), "r"(newval) : "memory");
-
-    return (ret == oldval);
-}
-
-#endif /* PMIX_GCC_INLINE_ASSEMBLY */
-
-#define pmix_atomic_cmpset_64 pmix_atomic_cmpset_acq_64
-
-#endif /* ! PMIX_SYS_ARCH_ATOMIC_H */
diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/timer.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/timer.h
deleted file mode 100644
index 65a9bef316..0000000000
--- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia64/timer.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
- *                         University Research and Technology
- *                         Corporation.  All rights reserved.
- * Copyright (c) 2004-2005 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$
- *
- * Additional copyrights may follow
- *
- * $HEADER$
- */
-
-#ifndef PMIX_SYS_ARCH_TIMER_H
-#define PMIX_SYS_ARCH_TIMER_H 1
-
-
-typedef uint64_t pmix_timer_t;
-
-
-#if PMIX_GCC_INLINE_ASSEMBLY
-
-static inline pmix_timer_t
-pmix_sys_timer_get_cycles(void)
-{
-    pmix_timer_t ret;
-
-    __asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret));
-
-    return ret;
-}
-
-#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1
-
-#else
-
-pmix_timer_t pmix_sys_timer_get_cycles(void);
-
-#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1
-
-#endif /* PMIX_GCC_INLINE_ASSEMBLY */
-
-#endif /* ! PMIX_SYS_ARCH_TIMER_H */
diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/Makefile.include
deleted file mode 100644
index f3916e581d..0000000000
--- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/Makefile.include
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
-#                         University Research and Technology
-#                         Corporation.  All rights reserved.
-# Copyright (c) 2004-2008 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) 2017      Intel, Inc. All rights reserved.
-# $COPYRIGHT$
-#
-# Additional copyrights may follow
-#
-# $HEADER$
-#
-
-# This makefile.am does not stand on its own - it is included from pmix/include/Makefile.am
-
-headers += \
-	atomics/sys/mips/atomic.h \
-	atomics/sys/mips/timer.h
diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/atomic.h
deleted file mode 100644
index 2e0765d9e2..0000000000
--- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/atomic.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
- *                         University Research and Technology
- *                         Corporation.  All rights reserved.
- * Copyright (c) 2004-2005 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) 2017      Intel, Inc. All rights reserved.
- * $COPYRIGHT$
- *
- * Additional copyrights may follow
- *
- * $HEADER$
- */
-
-#ifndef PMIX_SYS_ARCH_ATOMIC_H
-#define PMIX_SYS_ARCH_ATOMIC_H 1
-
-
-/* BWB - FIX ME! */
-#ifdef __linux__
-#define PMIXMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory")
-#define PMIXRMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory")
-#define PMIXWMB() __asm__ __volatile__(".set mips2; sync; .set mips0": : :"memory")
-#define PMIXSMP_SYNC ".set mips2; sync; .set mips0"
-#else
-#define PMIXMB() __asm__ __volatile__("sync": : :"memory")
-#define PMIXRMB() __asm__ __volatile__("sync": : :"memory")
-#define PMIXWMB() __asm__ __volatile__("sync": : :"memory")
-#define PMIXSMP_SYNC "sync"
-#endif
-
-
-/**********************************************************************
- *
- * Define constants for MIPS
- *
- *********************************************************************/
-#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1
-
-#define PMIX_HAVE_ATOMIC_CMPSET_32 1
-
-#ifdef __mips64
-#define PMIX_HAVE_ATOMIC_CMPSET_64 1
-#endif
-
-/**********************************************************************
- *
- * Memory Barriers
- *
- *********************************************************************/
-#if PMIX_GCC_INLINE_ASSEMBLY
-
-static inline
-void pmix_atomic_mb(void)
-{
-    PMIXMB();
-}
-
-
-static inline
-void pmix_atomic_rmb(void)
-{
-    PMIXRMB();
-}
-
-
-static inline
-void pmix_atomic_wmb(void)
-{
-    PMIXWMB();
-}
-
-static inline
-void pmix_atomic_isync(void)
-{
-}
-
-#endif
-
-/**********************************************************************
- *
- * Atomic math operations
- *
- *********************************************************************/
-#if PMIX_GCC_INLINE_ASSEMBLY
-
-static inline int pmix_atomic_cmpset_32(volatile int32_t *addr,
-                                        int32_t oldval, int32_t newval)
-{
-    int32_t ret;
-
-   __asm__ __volatile__ (".set noreorder        \n"
-                         ".set noat             \n"
-                         "1:                    \n"
-#ifdef __linux__
-                         ".set mips2         \n\t"
-#endif
-                         "ll     %0, %2         \n" /* load *addr into ret */
-                         "bne    %0, %z3, 2f    \n" /* done if oldval != ret */
-                         "or     $1, %z4, 0     \n" /* tmp = newval (delay slot) */
-                         "sc     $1, %2         \n" /* store tmp in *addr */
-#ifdef __linux__
-                         ".set mips0         \n\t"
-#endif
-                         /* note: ret will be 0 if failed, 1 if succeeded */
-                         "beqz   $1, 1b         \n" /* if 0 jump back to 1b */
-                         "nop                   \n" /* fill delay slots */
-                         "2:                    \n"
-                         ".set reorder          \n"
-                         : "=&r"(ret), "=m"(*addr)
-                         : "m"(*addr), "r"(oldval), "r"(newval)
-                         : "cc", "memory");
-   return (ret == oldval);
-}
-
-
-/* these two functions aren't inlined in the non-gcc case because then
-   there would be two function calls (since neither cmpset_32 nor
-   atomic_?mb can be inlined).  Instead, we "inline" them by hand in
-   the assembly, meaning there is one function call overhead instead
-   of two */
-static inline int pmix_atomic_cmpset_acq_32(volatile int32_t *addr,
-                                            int32_t oldval, int32_t newval)
-{
-    int rc;
-
-    rc = pmix_atomic_cmpset_32(addr, oldval, newval);
-    pmix_atomic_rmb();
-
-    return rc;
-}
-
-
-static inline int pmix_atomic_cmpset_rel_32(volatile int32_t *addr,
-                                            int32_t oldval, int32_t newval)
-{
-    pmix_atomic_wmb();
-    return pmix_atomic_cmpset_32(addr, oldval, newval);
-}
-
-#ifdef PMIX_HAVE_ATOMIC_CMPSET_64
-static inline int pmix_atomic_cmpset_64(volatile int64_t *addr,
-                                        int64_t oldval, int64_t newval)
-{
-    int64_t ret;
-
-   __asm__ __volatile__ (".set noreorder        \n"
-                         ".set noat             \n"
-                         "1:                    \n\t"
-                         "lld    %0, %2         \n\t" /* load *addr into ret */
-                         "bne    %0, %z3, 2f    \n\t" /* done if oldval != ret */
-                         "or     $1, %4, 0      \n\t" /* tmp = newval (delay slot) */
-                         "scd    $1, %2         \n\t" /* store tmp in *addr */
-                         /* note: ret will be 0 if failed, 1 if succeeded */
-                         "beqz   $1, 1b         \n\t" /* if 0 jump back to 1b */
-                         "nop                   \n\t" /* fill delay slot */
-                         "2:                    \n\t"
-                         ".set reorder          \n"
-                         : "=&r" (ret), "=m" (*addr)
-                         : "m" (*addr), "r" (oldval), "r" (newval)
-                         : "cc", "memory");
-
-   return (ret == oldval);
-}
-
-
-/* these two functions aren't inlined in the non-gcc case because then
-   there would be two function calls (since neither cmpset_64 nor
-   atomic_?mb can be inlined).  Instead, we "inline" them by hand in
-   the assembly, meaning there is one function call overhead instead
-   of two */
-static inline int pmix_atomic_cmpset_acq_64(volatile int64_t *addr,
-                                            int64_t oldval, int64_t newval)
-{
-    int rc;
-
-    rc = pmix_atomic_cmpset_64(addr, oldval, newval);
-    pmix_atomic_rmb();
-
-    return rc;
-}
-
-
-static inline int pmix_atomic_cmpset_rel_64(volatile int64_t *addr,
-                                            int64_t oldval, int64_t newval)
-{
-    pmix_atomic_wmb();
-    return pmix_atomic_cmpset_64(addr, oldval, newval);
-}
-#endif /* PMIX_HAVE_ATOMIC_CMPSET_64 */
-
-#endif /* PMIX_GCC_INLINE_ASSEMBLY */
-
-#endif /* ! PMIX_SYS_ARCH_ATOMIC_H */
diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/timer.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/timer.h
deleted file mode 100644
index fd280cc221..0000000000
--- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/mips/timer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2008      The University of Tennessee and The University
- *                         of Tennessee Research Foundation.  All rights
- *                         reserved.
- * $COPYRIGHT$
- *
- * Additional copyrights may follow
- *
- * $HEADER$
- */
-
-#ifndef PMIX_SYS_ARCH_TIMER_H
-#define PMIX_SYS_ARCH_TIMER_H 1
-
-#include <sys/times.h>
-
-typedef uint64_t pmix_timer_t;
-
-static inline pmix_timer_t
-pmix_sys_timer_get_cycles(void)
-{
-    pmix_timer_t ret;
-    struct tms accurate_clock;
-
-    times(&accurate_clock);
-    ret = accurate_clock.tms_utime + accurate_clock.tms_stime;
-
-    return ret;
-}
-
-#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1
-
-#endif /* ! PMIX_SYS_ARCH_TIMER_H */
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c
index 25264c265e..74f09fcded 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c
@@ -48,7 +48,7 @@ char *pmix_mca_base_component_path = NULL;
 int pmix_mca_base_opened = 0;
 char *pmix_mca_base_system_default_path = NULL;
 char *pmix_mca_base_user_default_path = NULL;
-bool pmix_mca_base_component_show_load_errors = true;
+bool pmix_mca_base_component_show_load_errors = (bool) PMIX_SHOW_LOAD_ERRORS_DEFAULT;
 bool pmix_mca_base_component_disable_dlopen = false;
 
 static char *pmix_mca_base_verbose = NULL;
@@ -109,7 +109,7 @@ int pmix_mca_base_open(void)
                                               PMIX_MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
     free(value);
 
-    pmix_mca_base_component_show_load_errors = true;
+    pmix_mca_base_component_show_load_errors = (bool) PMIX_SHOW_LOAD_ERRORS_DEFAULT;;
     var_id = pmix_mca_base_var_register("pmix", "mca", "base", "component_show_load_errors",
                                    "Whether to show errors for components that failed to load or not",
                                    PMIX_MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c
index 3f3b3848a8..bbc2e12365 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c
@@ -436,7 +436,7 @@ int pmix_mca_base_var_cache_files(bool rel_path_search)
 #if PMIX_WANT_HOME_CONFIG_FILES
     ret = asprintf(&pmix_mca_base_var_files, "%s"PMIX_PATH_SEP".pmix" PMIX_PATH_SEP
                    "mca-params.conf%c%s" PMIX_PATH_SEP "pmix-mca-params.conf",
-                   home, PMIX_ENV_SEP, pmix_pinstall_dirs.sysconfdir);
+                   home, ',', pmix_pinstall_dirs.sysconfdir);
 #else
     ret = asprintf(&pmix_mca_base_var_files, "%s" PMIX_PATH_SEP "pmix-mca-params.conf",
                    pmix_pinstall_dirs.sysconfdir);
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c
index 40b0f48693..7b91c19bae 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c
@@ -410,6 +410,7 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest,
     p->type = src->type;
     p->size = src->size;
     if (0 == p->size || NULL == src->array) {
+        *dest = p;
         return PMIX_SUCCESS;
     }
 
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c
index c4ad0b97b9..53fbf9b264 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c
@@ -1061,6 +1061,7 @@ pmix_status_t pmix20_bfrop_copy_darray(pmix_data_array_t **dest,
     p->type = src->type;
     p->size = src->size;
     if (0 == p->size || NULL == src->array) {
+        *dest = p;
         return PMIX_SUCCESS;
     }
 
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c
index 18de98afb2..cdebc3fe8a 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c
@@ -2958,8 +2958,9 @@ static pmix_status_t _store_job_info(pmix_proc_t *proc)
     }
 
     PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) {
-      if (!PMIX_PROC_IS_V21(_client_peer()) && 0 != strncmp("pmix.", kv->key, 4) &&
-                kv->value->type == PMIX_DATA_ARRAY) {
+      if ((PMIX_PROC_IS_V1(_client_peer()) || PMIX_PROC_IS_V20(_client_peer())) &&
+           0 != strncmp("pmix.", kv->key, 4) &&
+           kv->value->type == PMIX_DATA_ARRAY) {
             pmix_info_t *info;
             size_t size, i;
             info = kv->value->data.darray->array;
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h
index 56419197f0..9795956f5c 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h
@@ -70,6 +70,7 @@ typedef uint16_t pmix_proc_type_t;
 #define PMIX_PROC_V1        0x0008
 #define PMIX_PROC_V20       0x0010
 #define PMIX_PROC_V21       0x0020
+#define PMIX_PROC_V3        0x0040
 
 /* defins some convenience macros for testing proc type */
 #define PMIX_PROC_IS_CLIENT(p)      (PMIX_PROC_CLIENT & (p)->proc_type)
@@ -78,6 +79,7 @@ typedef uint16_t pmix_proc_type_t;
 #define PMIX_PROC_IS_V1(p)          (PMIX_PROC_V1 & (p)->proc_type)
 #define PMIX_PROC_IS_V20(p)         (PMIX_PROC_V20 & (p)->proc_type)
 #define PMIX_PROC_IS_V21(p)         (PMIX_PROC_V21 & (p)->proc_type)
+#define PMIX_PROC_IS_V3(p)          (PMIX_PROC_V3 & (p)->proc_type)
 
 
 /****    MESSAGING STRUCTURES    ****/
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c
index 33905dc930..a900230c3b 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c
@@ -249,12 +249,19 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer,
         } else {
             /* we need to extract the nspace/rank of the server from the string */
             p = strchr(mca_ptl_tcp_component.super.uri, ';');
+            if (NULL == p) {
+                return PMIX_ERR_BAD_PARAM;
+            }
             *p = '\0';
             p++;
             suri = strdup(p); // save the uri portion
             /* the '.' in the first part of the original string separates
              * nspace from rank */
             p = strchr(mca_ptl_tcp_component.super.uri, '.');
+            if (NULL == p) {
+                free(suri);
+                return PMIX_ERR_BAD_PARAM;
+            }
             *p = '\0';
             p++;
             nspace = strdup(mca_ptl_tcp_component.super.uri);
diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c
index 572ac0fcd8..1f1d3e89b2 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c
@@ -1000,7 +1000,15 @@ static void connection_handler(int sd, short args, void *cbdata)
         bftype = pmix_bfrops_globals.default_type;  // we can't know any better
         gds = NULL;
     } else {
-        proc_type = PMIX_PROC_V21;
+        if (0 == strncmp(version, "2.1", 3)) {
+            proc_type = PMIX_PROC_V21;
+        } else if (0 == strncmp(version, "3", 1)) {
+            proc_type = PMIX_PROC_V3;
+        } else {
+            free(msg);
+            rc = PMIX_ERR_NOT_SUPPORTED;
+            goto error;
+        }
         /* extract the name of the bfrops module they used */
         PMIX_STRNLEN(msglen, mg, cnt);
         if (msglen < cnt) {
diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c
index 4efc8a7816..d0bf076220 100644
--- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c
+++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c
@@ -1933,6 +1933,7 @@ static void _cnct(int sd, short args, void *cbdata)
                 if (PMIX_SUCCESS != rc) {
                     PMIX_ERROR_LOG(rc);
                     PMIX_RELEASE(reply);
+                    PMIX_DESTRUCT(&pbkt);
                     PMIX_DESTRUCT(&cb);
                     goto cleanup;
                 }
@@ -1941,29 +1942,34 @@ static void _cnct(int sd, short args, void *cbdata)
                     if (PMIX_SUCCESS != rc) {
                         PMIX_ERROR_LOG(rc);
                         PMIX_RELEASE(reply);
+                        PMIX_DESTRUCT(&pbkt);
                         PMIX_DESTRUCT(&cb);
                         goto cleanup;
                     }
                 }
                 PMIX_DESTRUCT(&cb);
-                if (PMIX_PROC_IS_V21(cd->peer)) {
+
+                if (PMIX_PROC_IS_V1(cd->peer) || PMIX_PROC_IS_V20(cd->peer)) {
+                    PMIX_BFROPS_PACK(rc, cd->peer, reply, &pbkt, 1, PMIX_BUFFER);
+                    if (PMIX_SUCCESS != rc) {
+                        PMIX_ERROR_LOG(rc);
+                        PMIX_RELEASE(reply);
+                        PMIX_DESTRUCT(&pbkt);
+                        PMIX_DESTRUCT(&cb);
+                        goto cleanup;
+                    }
+                } else {
                     PMIX_UNLOAD_BUFFER(&pbkt, bo.bytes, bo.size);
                     PMIX_BFROPS_PACK(rc, cd->peer, reply, &bo, 1, PMIX_BYTE_OBJECT);
                     if (PMIX_SUCCESS != rc) {
                         PMIX_ERROR_LOG(rc);
                         PMIX_RELEASE(reply);
                         PMIX_DESTRUCT(&pbkt);
-                        goto cleanup;
-                    }
-                } else {
-                    PMIX_BFROPS_PACK(rc, cd->peer, reply, &pbkt, 1, PMIX_BUFFER);
-                    if (PMIX_SUCCESS != rc) {
-                        PMIX_ERROR_LOG(rc);
-                        PMIX_RELEASE(reply);
-                        PMIX_DESTRUCT(&pbkt);
+                        PMIX_DESTRUCT(&cb);
                         goto cleanup;
                     }
                 }
+
                 PMIX_DESTRUCT(&pbkt);
             }
         }
diff --git a/orte/tools/prun/prun.c b/orte/tools/prun/prun.c
index 155ea98cd1..6a31e4bb90 100644
--- a/orte/tools/prun/prun.c
+++ b/orte/tools/prun/prun.c
@@ -352,6 +352,8 @@ int prun(int argc, char *argv[])
         exit(0);
     }
 
+    /* ensure we ONLY take the ess/tool component */
+    opal_setenv(OPAL_MCA_PREFIX"ess", "tool", true, &environ);
     /* tell the ess/tool component how we want to connect */
     if (myoptions.system_server_only) {
         opal_setenv(OPAL_MCA_PREFIX"ess_tool_system_server_only", "1", true, &environ);