From: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: Sagi Grimberg
<sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Shani Michaeli <shanim-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr
Date: Sun, 20 Dec 2015 13:33:55 +0200 [thread overview]
Message-ID: <56769223.7090308@mellanox.com> (raw)
In-Reply-To: <5676756B.6090208-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
On 20/12/2015 11:31, Sagi Grimberg wrote:
>
>>> 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.
A memory window takes reference on its PD during creation. It can only
be used by that PD, and it isn't bound to any memory region yet. You
are right that we want to prevent deregistration of an MR when there
are memory windows bound to it. This is suggested (although not
required) by the IBA specifications (section 10.6.7.2.6 Deregistering
Regions with Bound Windows). The problem with the usecnt field in ib_mr
as you wrote is that it needs to reflect what happens at bind /
invalidate time, but bind can happen in user-space without the kernel
knowing, and invalidation can similarly occur due to a
send-with-invalidate message being received. This is why in the
ConnectX-3 implementation of memory windows we didn't use the
ib_mr.usecnt field, but relied on a hardware implementation of the
reference count.
As I said, the spec also allows a device to proceed with deregistering
an MR, leaving an orphan memory window. I don't think we can prevent
this in the kernel, and I'm not sure it would be a good idea anyway, so
I think it is okay to remove the use_cnt field.
Regards,
Haggai
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-12-20 11:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 13:54 MR cleanups Christoph Hellwig
[not found] ` <1450446906-10336-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-12-18 13:54 ` [PATCH 01/10] IB: start documenting device capabilities Christoph Hellwig
2015-12-18 13:54 ` [PATCH 02/10] IB: remove ib_query_mr Christoph Hellwig
2015-12-18 13:54 ` [PATCH 03/10] IB: remove support for phys MRs Christoph Hellwig
2015-12-18 13:55 ` [PATCH 04/10] IB: remove in-kernel support for memory windows Christoph Hellwig
2015-12-18 13:55 ` [PATCH 05/10] cxgb3: simplify iwch_get_dma_wr Christoph Hellwig
2015-12-18 13:55 ` [PATCH 06/10] nes: simplify nes_reg_phys_mr calling conventions Christoph Hellwig
2015-12-18 13:55 ` [PATCH 07/10] amso1100: fold c2_reg_phys_mr into c2_get_dma_mr Christoph Hellwig
2015-12-18 13:55 ` [PATCH 08/10] ehca: stop using struct ib_phys_buf Christoph Hellwig
2015-12-18 13:55 ` [PATCH 09/10] IB: remove the struct ib_phys_buf definition Christoph Hellwig
[not found] ` <1450446906-10336-10-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-12-20 7:37 ` Or Gerlitz
[not found] ` <56765AC2.2010104-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-20 15:41 ` Christoph Hellwig
[not found] ` <20151220154137.GA10351-jcswGhMUV9g@public.gmane.org>
2015-12-20 16:54 ` Or Gerlitz
2015-12-18 13:55 ` [PATCH 10/10] IB: remove the unused usecnt field from struct ib_mr Christoph Hellwig
[not found] ` <1450446906-10336-11-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-12-18 14:14 ` Bart Van Assche
[not found] ` <567414B0.2050406-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-12-20 7:16 ` Or Gerlitz
2015-12-20 15:42 ` Christoph Hellwig
2015-12-20 7:25 ` Or Gerlitz
[not found] ` <567657D1.5010700-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-20 7:36 ` Or Gerlitz
2015-12-20 9:31 ` Sagi Grimberg
[not found] ` <5676756B.6090208-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-12-20 11:27 ` Or Gerlitz
2015-12-20 11:28 ` Or Gerlitz
2015-12-20 11:33 ` Haggai Eran [this message]
[not found] ` <56769223.7090308-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-12-20 11:42 ` Sagi Grimberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56769223.7090308@mellanox.com \
--to=haggaie-vpraknaxozvwk0htik3j/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=shanim-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.