1
1

We had long-ago added a new loop type to libevent: EVLOOP_ONELOOP.

After talking with Brian, we're pretty sure that this is only because
really, really old libevent didn't allow bitwise or-ing of the other
loop types, because what we really need is (EVLOOP_ONCE |
EVLOOP_NONBLOCK).  And that's what EVLOOP_ONELOOP did (i.e., we
changed the logic of libevent's event.c to let ONELOOP do both ONCE
and NONBLOCK things).

In the new libevent version, we didn't implement EVLOOP_ONELOOP
properly.  As a result, and we got hangs in the SM BTL add_procs
function.  Note that the SM BTL wasn't to blame -- it was purely a
side-effect of bad ONELOOP integration (i.e., if you got past the SM
BTL add_procs, you may well have hung somewhere else).

This commit removes all ONELOOP customizations from event.c and
returns it to (almost) its original state from the libevent 2.0.7-rc
distribution.  Everwhere in the code base where we used ONELOOP, we
now use (ONCE | NONBLOCK).

This commit was SVN r23957.
Этот коммит содержится в:
Jeff Squyres 2010-10-26 20:29:22 +00:00
родитель a5c440c974
Коммит 33c3b71317
6 изменённых файлов: 4 добавлений и 24 удалений

Просмотреть файл

@ -144,7 +144,7 @@ int ompi_mpi_finalize(void)
ompi_mpi_finalized = true;
#if OMPI_ENABLE_PROGRESS_THREADS == 0
opal_progress_set_event_flag(OPAL_EVLOOP_ONELOOP);
opal_progress_set_event_flag(OPAL_EVLOOP_ONCE | OPAL_EVLOOP_NONBLOCK);
#endif
/* Redo ORTE calling opal_progress_event_users_increment() during

Просмотреть файл

@ -66,16 +66,3 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
This isn't critical, but it makes the compiler output MUCH
prettier (and consistent with OMPI).
7. Edit two files to add a new evloop option that OMPI uses
and doesn't exist in libevent:
libevent/event.c: change event_base_loop in two places by
adding EVLOOP_ONELOOP to the conditional:
if (!base->event_count_active && (flags & (EVLOOP_ONCE|EVLOOP_ONELOOP)))
.....
} else if (flags & (EVLOOP_NONBLOCK|EVLOOP_ONELOOP))
libevent/include/event2/event.h:
#define EVLOOP_ONELOOP 0x05

Просмотреть файл

@ -56,10 +56,6 @@ typedef unsigned short u_short;
#define OPAL_EVLOOP_ONCE 0x01 /**< Block at most once. */
#define OPAL_EVLOOP_NONBLOCK 0x02 /**< Do not block. */
/* run once through the loop, but do have the default timeout.
* Need to be both something special *AND* OPAL_EVLOOP_ONCE
*/
#define OPAL_EVLOOP_ONELOOP 0x05
/* selected module will fill this typedef in with their
* own definition of ev_struct

Просмотреть файл

@ -1557,9 +1557,9 @@ event_base_loop(struct event_base *base, int flags)
if (N_ACTIVE_CALLBACKS(base)) {
event_process_active(base);
if (!base->event_count_active && (flags & (EVLOOP_ONCE|EVLOOP_ONELOOP)))
if (!base->event_count_active && (flags & EVLOOP_ONCE))
done = 1;
} else if (flags & (EVLOOP_NONBLOCK|EVLOOP_ONELOOP))
} else if (flags & EVLOOP_NONBLOCK)
done = 1;
}
event_debug(("%s: asked to terminate loop.", __func__));

Просмотреть файл

@ -308,9 +308,6 @@ int event_base_set(struct event_base *, struct event *);
/*@{*/
#define EVLOOP_ONCE 0x01 /**< Block at most once. */
#define EVLOOP_NONBLOCK 0x02 /**< Do not block. */
/* run once through the loop, but do have the default timeout.
* Need to be both something special *AND* EVLOOP_ONCE */
#define EVLOOP_ONELOOP 0x05
/*@}*/
/**

Просмотреть файл

@ -37,7 +37,7 @@
/*
* default parameters
*/
static int opal_progress_event_flag = OPAL_EVLOOP_ONELOOP;
static int opal_progress_event_flag = OPAL_EVLOOP_ONCE | OPAL_EVLOOP_NONBLOCK;
volatile int32_t opal_progress_thread_count = 0;
int opal_progress_spin_count = 10000;