Commit b7507b1f authored by David Goodell's avatar David Goodell
Browse files

[svn-r7002] use a separate mutex for the PMI CS to avoid lock ordering issues

No reviewer.
parent afe361fc
......@@ -89,6 +89,7 @@ typedef struct MPICH_ThreadInfo_t {
MPID_Thread_mutex_t msgq_mutex;
MPID_Thread_mutex_t completion_mutex;
MPID_Thread_mutex_t ctx_mutex;
MPID_Thread_mutex_t pmi_mutex;
#endif
#if (MPICH_THREAD_LEVEL >= MPI_THREAD_SERIALIZED)
......@@ -609,6 +610,7 @@ enum MPIU_Nest_mutexes {
MPIU_Nest_msgq_mutex,
MPIU_Nest_completion_mutex,
MPIU_Nest_ctx_mutex,
MPIU_Nest_pmi_mutex,
MPIU_Nest_NUM_MUTEXES
};
......@@ -707,8 +709,6 @@ enum MPIU_Nest_mutexes {
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
/* There are multiple locks, one for each (major) object */
/* FIXME needs testing and work */
#define MPIU_THREAD_CS_ENTER_ALLFUNC(_context)
#define MPIU_THREAD_CS_EXIT_ALLFUNC(_context)
#define MPIU_THREAD_CS_YIELD_ALLFUNC(_context)
......@@ -848,15 +848,13 @@ enum MPIU_Nest_mutexes {
} while (0)
#endif
/* MT FIXME should all of these CS types share the global_mutex? If yes, how do
* we avoid accidental deadlock? If not, we probably risk inconsistent locking
* schemes, leading to races. */
/* MT FIXME should this CS share the global_mutex? If yes, how do
* we avoid accidental deadlock? */
#define MPIU_THREAD_CS_ENTER_INITFLAG(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(global_mutex)
#define MPIU_THREAD_CS_EXIT_INITFLAG(_context) MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(global_mutex)
#define MPIU_THREAD_CS_ENTER_PMI(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(global_mutex)
#define MPIU_THREAD_CS_EXIT_PMI(_context) MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(global_mutex)
#define MPIU_THREAD_CS_ENTER_PMI(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(pmi_mutex)
#define MPIU_THREAD_CS_EXIT_PMI(_context) MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(pmi_mutex)
#define MPIU_THREAD_CS_ENTER_CONTEXTID(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(ctx_mutex)
#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context) MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(ctx_mutex)
......
......@@ -155,6 +155,7 @@ static int MPIR_Thread_CS_Init( void )
MPID_Thread_mutex_create(&MPIR_ThreadInfo.msgq_mutex, NULL);
MPID_Thread_mutex_create(&MPIR_ThreadInfo.completion_mutex, NULL);
MPID_Thread_mutex_create(&MPIR_ThreadInfo.ctx_mutex, NULL);
MPID_Thread_mutex_create(&MPIR_ThreadInfo.pmi_mutex, NULL);
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
/* Updates to shared data and access to shared services is handled without
......@@ -190,6 +191,7 @@ int MPIR_Thread_CS_Finalize( void )
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.msgq_mutex, NULL);
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.completion_mutex, NULL);
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.ctx_mutex, NULL);
MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.pmi_mutex, NULL);
#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
......
......@@ -28,8 +28,6 @@ int MPIDI_CH3_iSendv (MPIDI_VC_t *vc, MPID_Request *sreq, MPID_IOV *iov, int n_i
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_ISENDV);
/* MT FIXME should these function pointer invocations be covered by the
* MPIDCOMM CS? */
if (vc_ch->iSendContig)
{
MPIU_Assert(n_iov > 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment