Re: [PATCH v2 4/7] iommu/arm-smmu-v3: Mark ATC invalidate timeouts via lockless bitmap
From: Nicolin Chen <hidden>
Date: 2026-03-19 01:15:45
Also in:
linux-acpi, linux-iommu, linux-pci, lkml
On Thu, Mar 19, 2026 at 12:08:04AM +0000, Samiullah Khawaja wrote:
On Wed, Mar 18, 2026 at 04:23:53PM -0700, Nicolin Chen wrote:quoted
If the software times out first at 1s, it means the CMDQ is still pending on wait for the completion of ATC invalidation. Then, the caller sees -ETIMEOUT and tries to bisect the ATC batch or update the STE directly, either of which involves CMDQ. But CMDQ has not recovered yet. Then, in case of a batch, all the reties could timeout again. So, it will fail to identify which device is truly broken. This would end badly by blindly disabling all the devices in the batch. Also the disabling calls require CMDQ too, so they might fail as well.Yes, looking at VT-d currently and the queue length is 256 and this spirals out of control quickly.quoted
Thus, partially to answer the question, in case software timeout, I am afraid that we can hardly do anything.. :-/Agreed. Do you think we can maybe document this somewhere? Maybe add to the cover letter?
Yes. I will add a note inline as well where software times out.
quoted
This means I need to set a different return code for ATC timeouts v.s. software timeouts. Also, there is another problem: when PCI CTO finally reaches, the GERROR ISR will set atc_sync_timeouts but nobody will clear it.. So, before calling arm_smmu_cmdq_issue_cmdlist(), we need to make sure there is no dirty bit on the bitmap too.Yes, Just to confirm, do you think this needs to be handled regardless whether we handle the software timeout for the ATC invalidation? Basically to cleanup the bit on bitmap.
I don't see a reason not to. I think the next issuer who sees a dirty slot in the bitmap will not have any idea about that ATC timeout (batch). Basically the previous issuer was returned and the batch is gone. So, it can do nothing but clear the slot in the bitmap and move forward. Nicolin