* Does ib_dereg_mr require an additional IB_WR_LOCAL_INV?
@ 2025-09-23 21:09 Stefan Metzmacher
2025-09-24 15:10 ` Jason Gunthorpe
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Metzmacher @ 2025-09-23 21:09 UTC (permalink / raw)
To: linux-rdma@vger.kernel.org, linux-cifs@vger.kernel.org
Hi,
I'm trying to understand (and hopefully simplify) the code in fs/smb/client/smbdirect.c,
related to 'struct ib_mr' cleanup on disconnect.
Assume we have the following sequence of calls:
...
ib_alloc_mr()
ib_dma_map_sg()
ib_map_mr_sg()
ib_post_send(IB_WR_REG_MR)
On cleanup we currently us something like this:
ib_drain_qp()
init_completion()
ib_post_send(IB_WR_LOCAL_INV)
wait_for_completion()...
ib_dereg_mr()
ib_drain_qp() // again
rdma_destroy_qp();
ib_destroy_cq(revc_cq)
ib_destroy_cq(send_cq)
ib_dealloc_pd()
rdma_destroy_id()
Now I'm wondering if the following is really required:
init_completion()
ib_post_send(IB_WR_LOCAL_INV)
wait_for_completion()...
It would make things much easier if not...
Thanks for any possible hint :-)
metze
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Does ib_dereg_mr require an additional IB_WR_LOCAL_INV?
2025-09-23 21:09 Does ib_dereg_mr require an additional IB_WR_LOCAL_INV? Stefan Metzmacher
@ 2025-09-24 15:10 ` Jason Gunthorpe
2025-09-25 11:21 ` Stefan Metzmacher
0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2025-09-24 15:10 UTC (permalink / raw)
To: Stefan Metzmacher; +Cc: linux-rdma@vger.kernel.org, linux-cifs@vger.kernel.org
On Tue, Sep 23, 2025 at 11:09:48PM +0200, Stefan Metzmacher wrote:
> Hi,
>
> I'm trying to understand (and hopefully simplify) the code in fs/smb/client/smbdirect.c,
> related to 'struct ib_mr' cleanup on disconnect.
>
> Assume we have the following sequence of calls:
>
> ...
> ib_alloc_mr()
> ib_dma_map_sg()
> ib_map_mr_sg()
> ib_post_send(IB_WR_REG_MR)
>
> On cleanup we currently us something like this:
>
> ib_drain_qp()
> init_completion()
> ib_post_send(IB_WR_LOCAL_INV)
> wait_for_completion()...
> ib_dereg_mr()
> ib_drain_qp() // again
> rdma_destroy_qp();
> ib_destroy_cq(revc_cq)
> ib_destroy_cq(send_cq)
> ib_dealloc_pd()
> rdma_destroy_id()
>
> Now I'm wondering if the following is really required:
> init_completion()
> ib_post_send(IB_WR_LOCAL_INV)
> wait_for_completion()...
I would say IB_WR_LOCAL_INV is redundent with the ib_dereg_mr(). There
is no need to invalidate something that will be de-registered in a few
moments.
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Does ib_dereg_mr require an additional IB_WR_LOCAL_INV?
2025-09-24 15:10 ` Jason Gunthorpe
@ 2025-09-25 11:21 ` Stefan Metzmacher
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Metzmacher @ 2025-09-25 11:21 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: linux-rdma@vger.kernel.org, linux-cifs@vger.kernel.org
Am 24.09.25 um 17:10 schrieb Jason Gunthorpe:
> On Tue, Sep 23, 2025 at 11:09:48PM +0200, Stefan Metzmacher wrote:
>> Hi,
>>
>> I'm trying to understand (and hopefully simplify) the code in fs/smb/client/smbdirect.c,
>> related to 'struct ib_mr' cleanup on disconnect.
>>
>> Assume we have the following sequence of calls:
>>
>> ...
>> ib_alloc_mr()
>> ib_dma_map_sg()
>> ib_map_mr_sg()
>> ib_post_send(IB_WR_REG_MR)
>>
>> On cleanup we currently us something like this:
>>
>> ib_drain_qp()
>> init_completion()
>> ib_post_send(IB_WR_LOCAL_INV)
>> wait_for_completion()...
>> ib_dereg_mr()
>> ib_drain_qp() // again
>> rdma_destroy_qp();
>> ib_destroy_cq(revc_cq)
>> ib_destroy_cq(send_cq)
>> ib_dealloc_pd()
>> rdma_destroy_id()
>>
>> Now I'm wondering if the following is really required:
>> init_completion()
>> ib_post_send(IB_WR_LOCAL_INV)
>> wait_for_completion()...
>
> I would say IB_WR_LOCAL_INV is redundent with the ib_dereg_mr(). There
> is no need to invalidate something that will be de-registered in a few
> moments.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-25 11:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 21:09 Does ib_dereg_mr require an additional IB_WR_LOCAL_INV? Stefan Metzmacher
2025-09-24 15:10 ` Jason Gunthorpe
2025-09-25 11:21 ` Stefan Metzmacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox