Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr

Sagi Grimberg
2015-12-20T09:31:23Z

>> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
>> index 284916d..e45776e 100644
>> --- a/include/rdma/ib_verbs.h
>> +++ b/include/rdma/ib_verbs.h
>> @@ -1306,7 +1306,6 @@ struct ib_mr {
>> u64 iova;
>> u32 length;
>> unsigned int page_size;
>> - atomic_t usecnt; /* count number of MWs */
>> };
>
> This comment is part of Roland's uverbs commit.
>
> I wonder if LL driver supporting the IB_WR_BIND_MW op
> ref the MR on port send and deref it on completion?

I don't see why any driver would ref the underlying MR at
post_send(IB_WR_BIND_MW) time. It doesn't really make sense.

However, I think that the patch from Shani 6b52a12bc3fc ("IB/uverbs:
Implement memory windows support in uverbs") is wrong. A memory
window allocation should really reference the MR and not the PD (which
is referenced by the MR). Otherwise the MR deregistration is allowed
with windows bound to it. If this is the case then this field is not
useless and we should fix ib_uverbs_alloc_mw()?

Haggai, can you shed some light here? It's Shani's and your code.