Re: [PATCH v4 4/4] dmaengine: wait for RCU readers before releasing dma_device
From: Logan Gunthorpe
Date: Tue Aug 18 2026 - 12:26:58 EST
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.
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.
Besides that, these are minor points and the patch does fix a real issue so:
Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Thanks,
Logan