[ofa-general] valgrind warnings in libibverbs & PVFS

Roland Dreier rdreier at cisco.com
Sun Mar 9 20:57:14 PDT 2008


 > The first thing I managed to figure out is this change to libibverbs:

 > diff --git a/src/verbs.c b/src/verbs.c
 > index 11d3c4c..bdfe723 100644
 > --- a/src/verbs.c
 > +++ b/src/verbs.c
 > @@ -226,6 +226,8 @@ struct ibv_comp_channel
 > *ibv_create_comp_channel(struct ibv_context *context)
 >                return NULL;
 >        }
 > 
 > +       VALGRIND_MAKE_MEM_DEFINED(&resp.fd, sizeof(resp.fd));

Thanks, I applied this to my libibverbs git tree.

 > ==2541== Syscall param write(buf) points to uninitialised byte(s)
 > ==2541==    at 0xFEB2B14: write (in /usr/lib/debug/libpthread-0.10.so)
 > ==2541==    by 0xFE7DD3C: ibv_cmd_create_cq (cmd.c:320)
 > ==2541==    by 0xFE84080: ibv_create_cq@@IBVERBS_1.1 (verbs.c:281)

This is a valgrind false positive in libmthca for non-mem-free HCAs.
I just pushed out a libmthca git tree with a fix for this and a
similar false positive in the create SRQ path (see below).

 > ==2541== Conditional jump or move depends on uninitialised value(s)
 > ==2541==    at 0xFB19A80: mthca_cq_clean (cq.c:576)

This is almost certainly a missing VALGRIND_MAKE_MEM_DEFINED in
mthca_cq_clean() when sweeping through the CQ moving entries around.
I just need to code a test case for this to come up with a fix.
However I think you can ignore it for now.

 - R.

commit 8546775611986e65695d1b749676af4fcb544778
Author: Roland Dreier <rolandd at cisco.com>
Date:   Sun Mar 9 20:31:33 2008 -0700

    Fix Valgrind false positives in mthca_create_cq() and mthca_create_srq()
    
    For non-mem-free devices, we should zero out the doorbell-table-related
    fields in command structures to avoid Valgrind warningabout passing
    uninitialized memory to write().
    
    Signed-off-by: Roland Dreier <rolandd at cisco.com>

diff --git a/src/verbs.c b/src/verbs.c
index ef1b52c..84c9491 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -226,6 +226,9 @@ struct ibv_cq *mthca_create_cq(struct ibv_context *context, int cqe,
 		cmd.set_db_page  = db_align(cq->set_ci_db);
 		cmd.arm_db_index = cq->arm_db_index;
 		cmd.set_db_index = cq->set_ci_db_index;
+	} else {
+		cmd.arm_db_page  = cmd.set_db_page  =
+		cmd.arm_db_index = cmd.set_db_index = 0;
 	}
 
 	cmd.lkey   = cq->mr->lkey;
@@ -416,6 +419,8 @@ struct ibv_srq *mthca_create_srq(struct ibv_pd *pd,
 
 		cmd.db_page  = db_align(srq->db);
 		cmd.db_index = srq->db_index;
+	} else {
+		cmd.db_page  = cmd.db_index = 0;
 	}
 
 	cmd.lkey = srq->mr->lkey;



More information about the general mailing list