Commit 96b4b7b3 authored by Norio Yamaguchi's avatar Norio Yamaguchi Committed by Pavan Balaji
Browse files

Wait until all UNSOLICITED are done

Sender does not know if UNSOLICITED command was sent or not.
So process might be finished before the command is sent.
To avoid this, wait until all UNSOLICITED are done.
parent f96034aa
......@@ -32,12 +32,26 @@ typedef struct
uint64_t remote_endpoint_addr;
void *endpoint;
rque_t send_queue; /* MPID_Request Queue */
unsigned int unsolicited_count;
} MPID_nem_tofu_vc_area;
/* macro for tofu private in VC */
#define VC_TOFU(vc) ((MPID_nem_tofu_vc_area *)(vc)->ch.netmod_area.padding)
#define VC_FIELD(vcp, field) (((MPID_nem_tofu_vc_area *)(vc)->ch.netmod_area.padding)->field)
#define UNSOLICITED_NUM_INC(req) \
{ \
MPID_Request *sreq = req; \
MPIDI_VC_t *vc = sreq->ch.vc; \
VC_FIELD(vc, unsolicited_count)++; \
}
#define UNSOLICITED_NUM_DEC(req) \
{ \
MPID_Request *sreq = req; \
MPIDI_VC_t *vc = sreq->ch.vc; \
VC_FIELD(vc, unsolicited_count)--; \
}
typedef struct
{
void *cmds;
......
......@@ -493,6 +493,7 @@ ssize_t llctofu_writev(void *endpt, uint64_t raddr,
lcmd[0].iov_local = LLC_iov_alloc(1);
lcmd[0].iov_remote = LLC_iov_alloc(1);
UNSOLICITED_NUM_INC(cbarg);
lcmd->opcode = LLC_OPCODE_UNSOLICITED;
lcmd->comm = LLC_COMM_WORLD;
lcmd->rank = (uint32_t)raddr; /* XXX */
......@@ -636,6 +637,7 @@ int llctofu_poll(int in_blocking_poll,
usr = (void *)lcmd->usr_area;
vp_sreq = usr->cbarg;
UNSOLICITED_NUM_DEC(vp_sreq);
if(events[0].side.initiator.error_code != LLC_ERROR_SUCCESS) {
printf("llctofu_poll,error_code=%d\n", events[0].side.initiator.error_code);
......
......@@ -83,6 +83,11 @@ int MPID_nem_tofu_vc_destroy(MPIDI_VC_t *vc)
vc_tofu->endpoint = 0;
}
/* wait until all UNSOLICITED are done */
while (VC_FIELD(vc, unsolicited_count)) {
MPID_nem_tofu_poll(1);
}
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_TOFU_VC_DESTROY);
return mpi_errno;
......
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