Re: [PATCH RESEND v2 04/10] dmaengine: idxd: Flush kernel workqueues on Function Level Reset

From: Vinicius Costa Gomes

Date: Fri Jan 16 2026 - 20:18:12 EST


Dave Jiang <dave.jiang@xxxxxxxxx> writes:

> On 1/15/26 3:47 PM, Vinicius Costa Gomes wrote:
>> When a Function Level Reset (FLR) happens, terminate the pending
>> descriptors that were issued by in-kernel users and disable the
>> interrupts associated with those. They will be re-enabled after FLR
>> finishes.
>>
>> idxd_wq_flush_desc() is declared on idxd.h because it's going to be
>> used in by the DMA backend in a future patch.
>>
>> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxx>
>> ---
>> drivers/dma/idxd/device.c | 20 ++++++++++++++++++++
>> drivers/dma/idxd/idxd.h | 1 +
>> drivers/dma/idxd/irq.c | 16 ++++++++++++++++
>> 3 files changed, 37 insertions(+)
>>
>> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
>> index 5265925f3076..b8422dc7d2ca 100644
>> --- a/drivers/dma/idxd/device.c
>> +++ b/drivers/dma/idxd/device.c
>> @@ -1339,6 +1339,11 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
>>
>> free_irq(ie->vector, ie);
>> idxd_flush_pending_descs(ie);
>> +
>> + /* The interrupt might have been already released by FLR */
>> + if (ie->int_handle == INVALID_INT_HANDLE)
>> + return;
>> +
>> if (idxd->request_int_handles)
>> idxd_device_release_int_handle(idxd, ie->int_handle, IDXD_IRQ_MSIX);
>> idxd_device_clear_perm_entry(idxd, ie);
>> @@ -1347,6 +1352,21 @@ void idxd_wq_free_irq(struct idxd_wq *wq)
>> ie->pasid = IOMMU_PASID_INVALID;
>> }
>>
>> +void idxd_wq_flush_descs(struct idxd_wq *wq)
>> +{
>> + struct idxd_irq_entry *ie = &wq->ie;
>> + struct idxd_device *idxd = wq->idxd;
>> +
> Should it take a wq lock for this function?
>

Good catch. Will take a another look and see if I am missing any locks
elsewhere.


Cheers,
--
Vinicius