Re: [PATCH 3/3] dmaengine: idxd: Do not call DMX TX callbacks during workqueue disable
From: Reinette Chatre
Date: Fri Dec 02 2022 - 16:51:27 EST
Hi Fenghua,
On 12/2/2022 1:12 PM, Yu, Fenghua wrote:
...
>> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c index
>> b4d7bb923a40..2ac71a34fa34 100644
>> --- a/drivers/dma/idxd/device.c
>> +++ b/drivers/dma/idxd/device.c
>> @@ -1156,6 +1156,7 @@ int idxd_device_load_config(struct idxd_device *idxd)
>>
>> static void idxd_flush_pending_descs(struct idxd_irq_entry *ie) {
>> + struct dma_async_tx_descriptor *tx;
>
> Nitpicking. It's better to move this line to below:
>
>> struct idxd_desc *desc, *itr;
>> struct llist_node *head;
>> LIST_HEAD(flist);
>> @@ -1175,6 +1176,15 @@ static void idxd_flush_pending_descs(struct
>> idxd_irq_entry *ie)
>> list_for_each_entry_safe(desc, itr, &flist, list) {
>
> here?
> + struct dma_async_tx_descriptor *tx;
>
Will do.
>> list_del(&desc->list);
>> ctype = desc->completion->status ?
>> IDXD_COMPLETE_NORMAL : IDXD_COMPLETE_ABORT;
>> + /*
>> + * wq is being disabled. Any remaining descriptors are
>> + * likely to be stuck and can be dropped. callback could
>> + * point to code that is no longer accessible, for example
>> + * if dmatest module has been unloaded.
>> + */
>> + tx = &desc->txd;
>> + tx->callback = NULL;
>> + tx->callback_result = NULL;
>> idxd_dma_complete_txd(desc, ctype, true);
>> }
>> }
>> --
>> 2.34.1
>
> Reviewed-by: Fenghua Yu <fenghua.yu@xxxxxxxxx>
Thank you very much.
Reinette