Re: [PATCH v4 4/4] dmaengine: wait for RCU readers before releasing dma_device
"Garg, Shivank" <[email protected]>
| Newsgroups | org.kernel.vger.dmaengine,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2026-08-18 at 10:21 -0600, Logan Gunthorpe wrote: > > On 2026-08-17 21:43, Shivank Garg wrote: > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > > index d075051dd187..604c9af19936 100644 > > --- a/drivers/dma/dmaengine.c > > +++ b/drivers/dma/dmaengine.c > > @@ -429,6 +429,12 @@ static void dma_device_release(struct kref *ref) > > list_del_rcu(&device->global_node); > > dma_channel_rebalance(); > > > > + /* > > + * Wait for RCU readers (e.g. dma_issue_pending_all()) that may still > > + * be traversing dma_device_list before the device is freed. > > + */ > > + synchronize_rcu(); > > + > > if (device->device_release) > > device->device_release(device); > > } > > > > A couple minor points on this: > > 1. I think the comment, as is, isn't useful. It's pretty clear the > synchronize_rcu() call is paired with the list_del_rcu() call above it. > Sure, I'll drop it. > 2. The new synchronize_rcu() call will delay for a grace period with the > dma_list_mutex lock held. Is that okay? It might be, but if so, it could > use a note in the commit message. > yeah, I believe it is okay as the added latency is confined to only teardown path. I'll add note. > Besides that, these are minor points and the patch does fix a real issue so: > > Reviewed-by: Logan Gunthorpe <[email protected]> > > Thanks for the review Best regards, Shivank