Re: [PATCH 14/16] IB uverbs: add mthca user CQ support

From: Roland Dreier
Date: Wed Jun 29 2005 - 11:14:47 EST


>> + int is_kernel;

Andrew> I assume we have one body of code which is capable of
Andrew> handling data structures in either kenrel memory of user
Andrew> memory? (guess).

Andrew> If so, that's a fairly sensitive thing to be doing. Tell
Andrew> us more, please.

It's actually not that bad. A completion queue (CQ) is a basically a
chunk of memory where completion information is written when a work
request completes. The hardware can handle many CQs (64K is not an
unreasonable number), and we always do things like allocation of CQ
numbers, programming HW for CQ context, etc. in the kernel.

Both the kernel and userspace can do data path operations like looking
for a new CQ entry. This means that for userspace CQs, the actual
memory where entries are written should be in userspace. However the
struct mthca_cq will always be in the kernel.

If you look at how the is_kernel flag is used, you can see that all it
does is control whether we allocate/free the actual buffer and a few
other things in the kernel, or just use the stuff that userspace has
already allocated.

- R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/