Subject: Re: [PATCH v4 06/24] iommu: Defer iommu_group free via kfree_rcu()

From: Jason Gunthorpe <[email-masked]>
Date: Tue, 19 May 2026 08:39:16 -0300

On Mon, May 18, 2026 at 08:38:49PM -0700, Nicolin Chen wrote:
> dev->iommu_group will be read in an ISR-context to look up a group_device
> for fault reporting, in which case mutex cannot be used. For that read to
> be safe, two things are needed:

What driver does this? iommu_report_device_fault() has to be called in
a sleepable context - usually a threaded IRQ handler. So mutex is no
problem.

This seems like Sashiko slop - iommu_group does not change while a
driver is attached and a driver is not permitted to do any "fault
handling" after it has detached, it must flush and synchronize its
IRQ if it is using this from a hard IRQ for some bad reason.

You need to be alot more critical about the noise that Sashiko
generates, alot is useful, alot is not. It is a not a tool you want to
have 0 reports, complaining about hallucinations is expected.

> +#define dev_iommu_group_rcu(dev) \
> +	(*((struct iommu_group __rcu __force **)&(dev)->iommu_group))

Don't do things like this.

Jason