Skip to content

Commit b712296

Browse files
author
rhc54
authored
Merge pull request #1847 from rhc54/topic/updatepmix
Update pmix2x to track upstream changes
2 parents eac5b3c + 7e0af3f commit b712296

File tree

15 files changed

+238
-84
lines changed

15 files changed

+238
-84
lines changed

opal/mca/pmix/pmix2x/pmix/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ greek=
3030
# command, or with the date (if "git describe" fails) in the form of
3131
# "date<date>".
3232

33-
repo_rev=git4940b48
33+
repo_rev=git92df386
3434

3535
# If tarball_version is not empty, it is used as the version string in
3636
# the tarball filename, regardless of all other versions listed in
@@ -44,7 +44,7 @@ tarball_version=
4444

4545
# The date when this release was created
4646

47-
date="Jun 29, 2016"
47+
date="Jul 05, 2016"
4848

4949
# The shared library version of each of PMIx's public libraries.
5050
# These versions are maintained in accordance with the "Library

opal/mca/pmix/pmix2x/pmix/config/pmix_setup_hwloc.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
44
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
5-
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
5+
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
66
# $COPYRIGHT$
77
#
88
# Additional copyrights may follow
@@ -18,8 +18,8 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[
1818
[The value that should be included in C files to include hwloc.h])])
1919

2020
AC_ARG_ENABLE([embedded-hwloc],
21-
[AC_HELP_STRING([--enable-embedded-hwloc],
22-
[Enable use of locally embedded hwloc])])
21+
[AC_HELP_STRING([--enable-embedded-hwloc],
22+
[Enable use of locally embedded hwloc])])
2323

2424
pmix_hwloc_support=0
2525
AS_IF([test "$enable_embedded_hwloc" = "yes"],

opal/mca/pmix/pmix2x/pmix/config/pmix_setup_libevent.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
44
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
5-
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
5+
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
66
# $COPYRIGHT$
77
#
88
# Additional copyrights may follow
@@ -18,8 +18,8 @@ AC_DEFUN([PMIX_LIBEVENT_CONFIG],[
1818
[The value that should be included in C files to include event.h])])
1919

2020
AC_ARG_ENABLE([embedded-libevent],
21-
[AC_HELP_STRING([--enable-embedded-libevent],
22-
[Enable use of locally embedded libevent])])
21+
[AC_HELP_STRING([--enable-embedded-libevent],
22+
[Enable use of locally embedded libevent])])
2323

2424
AS_IF([test "$enable_embedded_libevent" = "yes"],
2525
[_PMIX_LIBEVENT_EMBEDDED_MODE],

opal/mca/pmix/pmix2x/pmix/include/pmix/pmix_common.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ BEGIN_C_DECLS
206206
#define PMIX_EVENT_CUSTOM_RANGE "pmix.evrange" // (pmix_proc_t*) array of pmix_proc_t defining range of event notification
207207
#define PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_proc_t*) array of pmix_proc_t defining affected procs
208208
#define PMIX_EVENT_NON_DEFAULT "pmix.evnondef" // (bool) event is not to be delivered to default event handlers
209-
/* fault tolerance-related events */
210-
#define PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session
211-
#define PMIX_EVENT_TERMINATE_JOB "pmix.evterm.job" // (bool) RM intends to terminate this job
212-
#define PMIX_EVENT_TERMINATE_NODE "pmix.evterm.node" // (bool) RM intends to terminate all procs on this node
213-
#define PMIX_EVENT_TERMINATE_PROC "pmix.evterm.proc" // (bool) RM intends to terminate just this process
214-
#define PMIX_EVENT_ACTION_TIMEOUT "pmix.evtimeout" // (int) time in sec before RM will execute error response
209+
/* fault tolerance-related events */
210+
#define PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session
211+
#define PMIX_EVENT_TERMINATE_JOB "pmix.evterm.job" // (bool) RM intends to terminate this job
212+
#define PMIX_EVENT_TERMINATE_NODE "pmix.evterm.node" // (bool) RM intends to terminate all procs on this node
213+
#define PMIX_EVENT_TERMINATE_PROC "pmix.evterm.proc" // (bool) RM intends to terminate just this process
214+
#define PMIX_EVENT_ACTION_TIMEOUT "pmix.evtimeout" // (int) time in sec before RM will execute error response
215215

216216
/* attributes used to describe "spawn" attributes */
217217
#define PMIX_PERSONALITY "pmix.pers" // (char*) name of personality to use

opal/mca/pmix/pmix2x/pmix/src/event/pmix_event_registration.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
4-
* Copyright (c) 2016 Research Organization for Information Science
5-
* and Technology (RIST). All rights reserved.
64
* $COPYRIGHT$
75
*
86
* Additional copyrights may follow

opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
4-
* Copyright (c) 2014-2015 Research Organization for Information Science
4+
* Copyright (c) 2014-2016 Research Organization for Information Science
55
* and Technology (RIST). All rights reserved.
66
* Copyright (c) 2014-2015 Artem Y. Polyakov <[email protected]>.
77
* All rights reserved.
@@ -227,7 +227,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
227227
size_t n, m;
228228
pmix_kval_t kv;
229229
pmix_listener_t *lt;
230-
int myhostnamelen = 10;
230+
bool need_listener;
231+
int myhostnamelen = 30;
231232
char myhostname[myhostnamelen];
232233
char *pmix_pid, *tdir;
233234
char **protected = NULL;
@@ -291,8 +292,10 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
291292
pmix_listener_t *tl = PMIX_NEW(pmix_listener_t);
292293
tl -> address.sun_family = AF_UNIX;
293294
tl->protocol = PMIX_PROTOCOL_TOOL;
294-
/* Get up to 10 chars of hostname.*/
295+
/* Get up to 30 chars of hostname.*/
295296
gethostname(myhostname, myhostnamelen);
297+
/* ensure it is NULL terminated */
298+
myhostname[myhostnamelen-1] = '\0';
296299
/* need to put this in the global tmpdir as opposed to
297300
* where the server tmpdir might be */
298301
if (NULL == (tdir = getenv("TMPDIR"))) {
@@ -328,8 +331,15 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
328331
pmix_list_append(&pmix_usock_globals.posted_recvs, &req->super);
329332

330333
/* start listening */
334+
need_listener = false;
331335
PMIX_LIST_FOREACH(lt, &pmix_server_globals.listeners, pmix_listener_t) {
332-
if (PMIX_SUCCESS != pmix_start_listening(lt)) {
336+
if (PMIX_SUCCESS != pmix_prepare_listening(lt, &need_listener)) {
337+
PMIx_server_finalize();
338+
return PMIX_ERR_INIT;
339+
}
340+
}
341+
if (need_listener) {
342+
if (PMIX_SUCCESS != pmix_start_listening()) {
333343
PMIx_server_finalize();
334344
return PMIX_ERR_INIT;
335345
}
@@ -2007,6 +2017,7 @@ static void notifyerror_cbfunc (pmix_status_t status, void *cbdata)
20072017
PMIX_RELEASE(cd);
20082018
}
20092019

2020+
20102021
static void query_cbfunc(pmix_status_t status,
20112022
pmix_info_t *info, size_t ninfo,
20122023
void *cbdata,

opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_listener.c

Lines changed: 58 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "src/util/argv.h"
5454
#include "src/util/error.h"
5555
#include "src/util/fd.h"
56+
#include "src/util/getid.h"
5657
#include "src/util/output.h"
5758
#include "src/util/pmix_environ.h"
5859
#include "src/util/progress_threads.h"
@@ -73,7 +74,7 @@ static pthread_t engine;
7374
/*
7475
* start listening on our rendezvous file
7576
*/
76-
pmix_status_t pmix_start_listening(pmix_listener_t *lt)
77+
pmix_status_t pmix_prepare_listening(pmix_listener_t *lt, bool *need_listener)
7778
{
7879
int flags;
7980
pmix_status_t rc;
@@ -95,7 +96,6 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
9596
}
9697

9798

98-
9999
addrlen = sizeof(struct sockaddr_un);
100100
if (bind(lt->socket, (struct sockaddr*)address, addrlen) < 0) {
101101
printf("%s:%d bind() failed\n", __FILE__, __LINE__);
@@ -137,16 +137,18 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
137137
goto sockerror;
138138
}
139139

140-
/* setup my version for validating connections - we
141-
* only check the major version numbers */
142-
myversion = strdup(PMIX_VERSION);
143-
/* find the first '.' */
144-
ptr = strchr(myversion, '.');
145-
if (NULL != ptr) {
146-
++ptr;
147-
/* stop it at the second '.', if present */
148-
if (NULL != (ptr = strchr(ptr, '.'))) {
149-
*ptr = '\0';
140+
if (NULL == myversion) {
141+
/* setup my version for validating connections - we
142+
* only check the major version numbers */
143+
myversion = strdup(PMIX_VERSION);
144+
/* find the first '.' */
145+
ptr = strchr(myversion, '.');
146+
if (NULL != ptr) {
147+
++ptr;
148+
/* stop it at the second '.', if present */
149+
if (NULL != (ptr = strchr(ptr, '.'))) {
150+
*ptr = '\0';
151+
}
150152
}
151153
}
152154

@@ -157,27 +159,7 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
157159
}
158160

159161
if (PMIX_SUCCESS != rc && !pmix_server_globals.listen_thread_active) {
160-
/*** spawn internal listener thread */
161-
if (0 > pipe(pmix_server_globals.stop_thread)) {
162-
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
163-
return PMIX_ERR_OUT_OF_RESOURCE;
164-
}
165-
/* Make sure the pipe FDs are set to close-on-exec so that
166-
they don't leak into children */
167-
if (pmix_fd_set_cloexec(pmix_server_globals.stop_thread[0]) != PMIX_SUCCESS ||
168-
pmix_fd_set_cloexec(pmix_server_globals.stop_thread[1]) != PMIX_SUCCESS) {
169-
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
170-
close(pmix_server_globals.stop_thread[0]);
171-
close(pmix_server_globals.stop_thread[1]);
172-
return PMIX_ERR_OUT_OF_RESOURCE;
173-
}
174-
/* fork off the listener thread */
175-
if (0 > pthread_create(&engine, NULL, listen_thread, NULL)) {
176-
pmix_server_globals.listen_thread_active = false;
177-
return PMIX_ERROR;
178-
} else {
179-
pmix_server_globals.listen_thread_active = true;
180-
}
162+
*need_listener = true;
181163
}
182164

183165
return PMIX_SUCCESS;
@@ -188,6 +170,31 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
188170
return PMIX_ERROR;
189171
}
190172

173+
pmix_status_t pmix_start_listening(void) {
174+
/*** spawn internal listener thread */
175+
if (0 > pipe(pmix_server_globals.stop_thread)) {
176+
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
177+
return PMIX_ERR_OUT_OF_RESOURCE;
178+
}
179+
/* Make sure the pipe FDs are set to close-on-exec so that
180+
they don't leak into children */
181+
if (pmix_fd_set_cloexec(pmix_server_globals.stop_thread[0]) != PMIX_SUCCESS ||
182+
pmix_fd_set_cloexec(pmix_server_globals.stop_thread[1]) != PMIX_SUCCESS) {
183+
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
184+
close(pmix_server_globals.stop_thread[0]);
185+
close(pmix_server_globals.stop_thread[1]);
186+
return PMIX_ERR_OUT_OF_RESOURCE;
187+
}
188+
/* fork off the listener thread */
189+
pmix_server_globals.listen_thread_active = true;
190+
if (0 > pthread_create(&engine, NULL, listen_thread, NULL)) {
191+
pmix_server_globals.listen_thread_active = false;
192+
return PMIX_ERROR;
193+
}
194+
195+
return PMIX_SUCCESS;
196+
}
197+
191198
void pmix_stop_listening(void)
192199
{
193200
int i;
@@ -533,6 +540,8 @@ static pmix_status_t pmix_server_authenticate(pmix_pending_connection_t *pnd,
533540
pmix_peer_t *psave = NULL;
534541
bool found;
535542
pmix_proc_t proc;
543+
uid_t uid;
544+
gid_t gid;
536545

537546
pmix_output_verbose(2, pmix_globals.debug_output,
538547
"RECV CONNECT ACK FROM PEER ON SOCKET %d",
@@ -720,9 +729,24 @@ static pmix_status_t pmix_server_authenticate(pmix_pending_connection_t *pnd,
720729
}
721730
}
722731
} else {
732+
/* get the tool socket's uid and gid so we can pass them to
733+
* the host RM for validation */
734+
if (PMIX_SUCCESS != (rc = pmix_util_getid(pnd->sd, &uid, &gid))) {
735+
return rc;
736+
}
737+
/* we pass this info in an array of pmix_info_t structs,
738+
* so set that up here */
739+
pnd->ninfo = 2;
740+
PMIX_INFO_CREATE(pnd->info, pnd->ninfo);
741+
(void)strncpy(pnd->info[0].key, PMIX_USERID, PMIX_MAX_KEYLEN);
742+
pnd->info[0].value.type = PMIX_UINT32;
743+
pnd->info[0].value.data.uint32 = uid;
744+
(void)strncpy(pnd->info[1].key, PMIX_GRPID, PMIX_MAX_KEYLEN);
745+
pnd->info[0].value.type = PMIX_UINT32;
746+
pnd->info[0].value.data.uint32 = gid;
723747
/* request an nspace for this requestor - it will
724748
* automatically be assigned rank=0 */
725-
pmix_host_server.tool_connected(NULL, 0, cnct_cbfunc, pnd);
749+
pmix_host_server.tool_connected(pnd->info, pnd->ninfo, cnct_cbfunc, pnd);
726750
return PMIX_ERR_OPERATION_IN_PROGRESS;
727751
}
728752
return rc;
@@ -799,7 +823,6 @@ static void tool_handler(int sd, short flags, void* cbdata)
799823

800824
/* initiate the authentication handshake */
801825
if (PMIX_ERR_OPERATION_IN_PROGRESS != pmix_server_authenticate(pnd, NULL, NULL)) {
802-
pmix_output(0, "SHOOT");
803826
CLOSE_THE_SOCKET(pnd->sd);
804827
PMIX_RELEASE(pnd);
805828
}

opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c

100755100644
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer,
11181118
}
11191119
}
11201120

1121-
cleanup:
1121+
cleanup:
11221122
pmix_output_verbose(2, pmix_globals.debug_output,
11231123
"server register events: ninfo =%lu rc =%d", ninfo, rc);
11241124
/* be sure to execute the callback */
@@ -1175,7 +1175,8 @@ void pmix_server_deregister_events(pmix_peer_t *peer,
11751175
{
11761176
int32_t cnt;
11771177
pmix_status_t rc, *codes = NULL, *cdptr, maxcode = PMIX_MAX_ERR_CONSTANT;
1178-
size_t ncodes, ncds, n;
1178+
pmix_info_t *info = NULL;
1179+
size_t ninfo=0, ncodes, ncds, n;
11791180
pmix_regevents_info_t *reginfo = NULL;
11801181
pmix_regevents_info_t *reginfo_next;
11811182
pmix_peer_events_info_t *prev;
@@ -1230,11 +1231,13 @@ void pmix_server_deregister_events(pmix_peer_t *peer,
12301231
}
12311232
}
12321233

1233-
12341234
cleanup:
12351235
if (NULL != codes) {
12361236
free(codes);
12371237
}
1238+
if (NULL != info) {
1239+
PMIX_INFO_FREE(info, ninfo);
1240+
}
12381241
return;
12391242
}
12401243

@@ -1384,7 +1387,6 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer,
13841387

13851388

13861389

1387-
13881390
/***** INSTANCE SERVER LIBRARY CLASSES *****/
13891391
static void tcon(pmix_server_trkr_t *t)
13901392
{
@@ -1520,13 +1522,14 @@ PMIX_CLASS_INSTANCE(pmix_dmdx_local_t,
15201522

15211523
static void pccon(pmix_pending_connection_t *p)
15221524
{
1523-
p->msg = NULL;
15241525
memset(p->nspace, 0, PMIX_MAX_NSLEN+1);
1526+
p->info = NULL;
1527+
p->ninfo = 0;
15251528
}
15261529
static void pcdes(pmix_pending_connection_t *p)
15271530
{
1528-
if (NULL != p->msg) {
1529-
free(p->msg);
1531+
if (NULL != p->info) {
1532+
PMIX_INFO_FREE(p->info, p->ninfo);
15301533
}
15311534
}
15321535
PMIX_CLASS_INSTANCE(pmix_pending_connection_t,

0 commit comments

Comments
 (0)