[openib-general] understanding mthca_alloc_db()
Roland Dreier
rdreier at cisco.com
Wed Dec 28 10:54:39 PST 2005
yipee> Hi, I'm trying to understand what's going on inside
yipee> mthca_alloc_db() (in libmthca/ src/memfree.c). I
yipee> understand that this function manages a bitmap-based
yipee> freelist of doorbells for send, receive & completion
yipee> queues. Is there a possibility of a memory leak when
yipee> posix_memalign() steps on a previously allocated
yipee> 'db_tab->page[i].db_rec' (when all of 'db_tab->page[i].
yipee> free[j]' is cleared)? isn't 'i' already out of bounds?
I don't think so. i is being set by the loop
for (i = start; i != end; i += dir)
so if we fall through the end of loop, then i == end, which is where
we want to allocate a new doorbell page.
yipee> The functions defines two types/groups of doorbells. Why
yipee> are these doorbells allocated differently (one group starts
yipee> at the begining of the array and the other at the end)?
This is the way the hardware works.
yipee> Another thing I noticed is that doorbells are different
yipee> between Tavor and Arbel HCA's (e.g. see
yipee> update_cons_index(). Is it correct that Arbel doorbells are
yipee> only 32 bits wide?
Sort of. It is definitely true that Tavor-mode doorbells work
differently from Arbel/mem-free-mode doorbells.
- R.
More information about the general
mailing list