]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
dtest: pre-allocated buffer too small for RMR, DTO ops timeout
authorAmir Hanania <amir.hanania@intel.com>
Wed, 5 Aug 2015 20:16:12 +0000 (13:16 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Wed, 5 Aug 2015 20:16:12 +0000 (13:16 -0700)
The buf_len settings (-b) for small IO may cause segfault.
Increase allocation and adjust DTO operations to infinite.

Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
Signed-off-by: Amir Hanania <amir.hanania@intel.com>
test/dtest/dtest.c

index cfb074b5ae15a23b9e4005fb9aa9243a6fed79d6..2ac26eade3633829f6c5903eb907e86afcfca0d0 100755 (executable)
 #define MAX_RDMA_RD    4
 #define MAX_PROCS      1000
 
+#define min(a, b) ((a < b) ? (a) : (b))
+#define max(a, b) ((a > b) ? (a) : (b))
+
 /* Header files needed for DAT/uDAPL */
 #include "dat2/udat.h"
 #include "dat2/dat_ib_extensions.h"
 
 /* definitions */
 #define SERVER_CONN_QUAL  45248
-#define DTO_TIMEOUT       (1000*1000*5)
+#define DTO_TIMEOUT       DAT_TIMEOUT_INFINITE
 #define CNO_TIMEOUT       (1000*1000*1)
 #define DTO_FLUSH_TIMEOUT (1000*1000*2)
 #define CONN_TIMEOUT      (1000*1000*100)
@@ -657,15 +660,15 @@ int main(int argc, char **argv)
 
        if (align_data) {
                /* allocate send and receive buffers */
-               if (posix_memalign((void**)&rbuf, 4096, buf_len * (burst+1)) ||
-                   posix_memalign((void**)&sbuf, 4096, buf_len * (burst+1))) {
+               if (posix_memalign((void**)&rbuf, 4096, max(64, buf_len * (burst+1))) ||
+                   posix_memalign((void**)&sbuf, 4096, max(64, buf_len * (burst+1)))) {
                        perror("malloc");
                        exit(1);
                }
        } else {
                /* allocate send and receive buffers */
-               if (((rbuf = malloc(buf_len * (burst+1))) == NULL) ||
-                   ((sbuf = malloc(buf_len * (burst+1))) == NULL)) {
+               if (((rbuf = malloc(max(64, buf_len * (burst+1)))) == NULL) ||
+                   ((sbuf = malloc(max(64, buf_len * (burst+1)))) == NULL)) {
                        perror("malloc");
                        exit(1);
                }
@@ -1420,11 +1423,11 @@ no_resolution:
         *  Setup our remote memory and tell the other side about it
         */
        p_rmr_snd->virtual_address = htonll((DAT_VADDR) (uintptr_t) rbuf);
-       p_rmr_snd->segment_length = htonl(RDMA_BUFFER_SIZE);
+       p_rmr_snd->segment_length = htonl(buf_len);
        p_rmr_snd->rmr_context = htonl(rmr_context_recv);
 
        printf("%d Send RMR msg to remote: r_key_ctx=0x%x,va=%p,len=0x%x\n",
-              getpid(), rmr_context_recv, rbuf, RDMA_BUFFER_SIZE);
+              getpid(), rmr_context_recv, rbuf, buf_len);
 
        ret = send_msg(p_rmr_snd,
                       sizeof(DAT_RMR_TRIPLET),