[openib-general] Patch for review: ipath mmaped CQs, QPs, SRQs [1 of 2]

Roland Dreier rdreier at cisco.com
Fri Jun 16 09:25:38 PDT 2006


 > +	/* Unmap the old queue so we can resize it. */
 > +	size = sizeof(struct ipath_cq_wc) +
 > +		(sizeof(struct ipath_wc) * cq->ibv_cq.cqe);
 > +	(void) munmap(cq->queue, size);
 > +	ret = ibv_cmd_resize_cq_resp(ibcq, cqe, &cmd, sizeof cmd,
 > +				     &resp.ibv_resp, sizeof resp);
 > +	if (ret) {
 > +		pthread_spin_unlock(&cq->lock);
 > +		return ret;
 > +	}

It seems that this method of returning a new buffer address to mmap
from the resize operation leads to some really nasty error handling
though.  If the resize operation fails (either because of bad
userspace values or because the kernel is out of memory and can't
allocate a new buffer) then the old CQ is gone, possibly beyond recovery.

mthca avoids all this by allocating a resize buffer in advance.

 - R.




More information about the general mailing list