1
1

osc/rdma: ensure fragment headers and the packed datatype are 8-byte aligned.

The datatype unpacking code assumes that the packed datatype buffer has the
same alignment as an OPAL_PTRDIFF_TYPE. This was not enforced by the rdma
one-sided component. I changed the ordering and sized of various osc/rdma
headers to ensure their sizes are a multiple of 8-bytes and modified the
fragment allocation call to ensure all headers are 8-byte aligned. While
not the cleanest way to handle this situation it should resolve the issue.

Fixes trac:4315

cmr=v1.7.5:reviewer=jsquyres

This commit was SVN r30974.

The following Trac tickets were found above:
  Ticket 4315 --> https://svn.open-mpi.org/trac/ompi/ticket/4315
Этот коммит содержится в:
Nathan Hjelm 2014-03-10 18:11:22 +00:00
родитель 85515f2587
Коммит 5df8cd75a9
3 изменённых файлов: 19 добавлений и 12 удалений

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

@ -1360,7 +1360,9 @@ static inline int process_frag (ompi_osc_rdma_module_t *module,
abort(); /* FIX ME */
}
header = (ompi_osc_rdma_header_t *) ((uintptr_t) header + ret);
/* the next header will start on an 8-byte boundary. this is done to ensure
* that the packed datatype is properly aligned */
header = (ompi_osc_rdma_header_t *) (((uintptr_t) header + ret + 0x07) & ~0x07);
}
return OMPI_SUCCESS;

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

@ -54,6 +54,9 @@ static inline int ompi_osc_rdma_frag_alloc(ompi_osc_rdma_module_t *module, int t
ompi_osc_rdma_frag_t *curr = module->peers[target].active_frag;
int ret;
/* ensure the next fragment will be allocated on an 8-byte boundary */
request_len = (request_len + 0x7) & ~0x7;
if (request_len > mca_osc_rdma_component.buffer_size) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
@ -114,18 +117,19 @@ static inline int ompi_osc_rdma_frag_alloc(ompi_osc_rdma_module_t *module, int t
/*
* Note: module lock must be held for this operation
*/
static inline int
ompi_osc_rdma_frag_finish(ompi_osc_rdma_module_t *module,
ompi_osc_rdma_frag_t* buffer)
static inline int ompi_osc_rdma_frag_finish(ompi_osc_rdma_module_t *module,
ompi_osc_rdma_frag_t* buffer)
{
int ret = OMPI_SUCCESS;
buffer->pending--;
if (0 == buffer->pending && 0 == buffer->remain_len) {
ret = ompi_osc_rdma_frag_start(module, buffer);
if (0 == --buffer->pending && 0 == buffer->remain_len) {
if (OPAL_LIKELY(buffer == module->peers[buffer->target].active_frag)) {
/* this is the active fragment. need to set the current fragment to null
* or it will be started multiple times */
module->peers[buffer->target].active_frag = NULL;
}
return ompi_osc_rdma_frag_start(module, buffer);
}
return ret;
return OMPI_SUCCESS;
}
#endif

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

@ -78,9 +78,9 @@ struct ompi_osc_rdma_header_acc_t {
uint16_t tag;
uint32_t count;
uint32_t op;
uint64_t len;
uint64_t displacement;
uint32_t op;
};
typedef struct ompi_osc_rdma_header_acc_t ompi_osc_rdma_header_acc_t;
@ -105,9 +105,9 @@ struct ompi_osc_rdma_header_get_acc_t {
uint16_t tag;
uint32_t count;
uint32_t op;
uint64_t len;
uint64_t displacement;
uint32_t op;
};
typedef struct ompi_osc_rdma_header_get_acc_t ompi_osc_rdma_header_get_acc_t;
@ -172,6 +172,7 @@ struct ompi_osc_rdma_frag_header_t {
uint16_t windx; /* cid of communicator backing window (our window id) */
uint32_t source; /* rank in window of source process */
uint16_t num_ops; /* number of operations in this buffer */
uint16_t pad[3]; /* ensure the fragment header is a multiple of 8 bytes */
};
typedef struct ompi_osc_rdma_frag_header_t ompi_osc_rdma_frag_header_t;