Commit 93b114e3 authored by Xin Zhao's avatar Xin Zhao Committed by Pavan Balaji
Browse files

Bug-fix in Request_load_recv_iov() when initial value of segment_first is not 0.



Originally Request_load_recv_iov() function assumes that
the initial value of req->dev.segment_first is always zero,
which is not correct if we set it to a non-zero value for
streaming the RMA operations.

The way Request_load_recv_iov() works is that, it is triggered
multiple times for the same receiving request until all data is
received. During this process, req->dev.segment_first is rewritten
to the current offset value. When the initial value of
req->dev.segment_first is non-zero, we need another variable
to store that value until the receiving process for this request
is finished. Here we use a static variable in this function to
reach the purpose.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent 9d3ddf8a
......@@ -300,6 +300,8 @@ int MPIDI_CH3U_Request_load_send_iov(MPID_Request * const sreq,
return mpi_errno;
}
#define MPIDI_LOAD_RECV_IOV_ORIG_SEGMENT_FIRST_UNSET (-1)
/*
* MPIDI_CH3U_Request_load_recv_iov()
*
......@@ -315,10 +317,16 @@ int MPIDI_CH3U_Request_load_send_iov(MPID_Request * const sreq,
int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq)
{
MPI_Aint last;
static MPIDI_msg_sz_t orig_segment_first = MPIDI_LOAD_RECV_IOV_ORIG_SEGMENT_FIRST_UNSET;
int mpi_errno = MPI_SUCCESS;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3U_REQUEST_LOAD_RECV_IOV);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3U_REQUEST_LOAD_RECV_IOV);
if (orig_segment_first == MPIDI_LOAD_RECV_IOV_ORIG_SEGMENT_FIRST_UNSET) {
orig_segment_first = rreq->dev.segment_first;
}
if (rreq->dev.segment_first < rreq->dev.segment_size)
{
/* still reading data that needs to go into the user buffer */
......@@ -351,14 +359,15 @@ int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq)
rreq->dev.iov[0].MPID_IOV_LEN = data_sz;
rreq->dev.iov_offset = 0;
rreq->dev.iov_count = 1;
MPIU_Assert(rreq->dev.segment_first + data_sz +
MPIU_Assert(rreq->dev.segment_first - orig_segment_first + data_sz +
rreq->dev.tmpbuf_off <= rreq->dev.recv_data_sz);
if (rreq->dev.segment_first + data_sz + rreq->dev.tmpbuf_off ==
if (rreq->dev.segment_first - orig_segment_first + data_sz + rreq->dev.tmpbuf_off ==
rreq->dev.recv_data_sz)
{
MPIU_DBG_MSG(CH3_CHANNEL,VERBOSE,
"updating rreq to read the remaining data into the SRBuf");
rreq->dev.OnDataAvail = MPIDI_CH3_ReqHandler_UnpackSRBufComplete;
orig_segment_first = MPIDI_LOAD_RECV_IOV_ORIG_SEGMENT_FIRST_UNSET;
}
else
{
......@@ -407,12 +416,13 @@ int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq)
}
/* --END ERROR HANDLING-- */
if (last == rreq->dev.recv_data_sz)
if (last == rreq->dev.recv_data_sz + orig_segment_first)
{
MPIU_DBG_MSG(CH3_CHANNEL,VERBOSE,
"updating rreq to read the remaining data directly into the user buffer");
/* Eventually, use OnFinal for this instead */
rreq->dev.OnDataAvail = rreq->dev.OnFinal;
orig_segment_first = MPIDI_LOAD_RECV_IOV_ORIG_SEGMENT_FIRST_UNSET;
}
else if (MPIDI_Request_get_type(rreq) == MPIDI_REQUEST_TYPE_ACCUM_RECV ||
MPIDI_Request_get_type(rreq) == MPIDI_REQUEST_TYPE_GET_ACCUM_RECV ||
......@@ -484,6 +494,7 @@ int MPIDI_CH3U_Request_load_recv_iov(MPID_Request * const rreq)
MPIU_Assert(MPIDI_Request_get_type(rreq) == MPIDI_REQUEST_TYPE_RECV);
/* Eventually, use OnFinal for this instead */
rreq->dev.OnDataAvail = rreq->dev.OnFinal;
orig_segment_first = MPIDI_LOAD_RECV_IOV_ORIG_SEGMENT_FIRST_UNSET;
}
else
{
......
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