Re: [PATCH v8 12/12] iommu: Use refcount for fault data access

Baolu Lu
2023-12-12T05:28:11Z

On 12/11/23 11:24 PM, Jason Gunthorpe wrote:
>> @@ -282,22 +313,15 @@ EXPORT_SYMBOL_GPL(iommu_page_response);
>> */
>> int iopf_queue_flush_dev(struct device *dev)
>> {
>> - int ret = 0;
>> - struct iommu_fault_param *iopf_param;
>> - struct dev_iommu *param = dev->iommu;
>> + struct iommu_fault_param *iopf_param = iopf_get_dev_fault_param(dev);
>>
>> - if (!param)
>> + if (!iopf_param)
>> return -ENODEV;
> And this also seems unnecessary, it is a bug to call this after
> iopf_queue_remove_device() right? Just

Yes. They both are called from the iommu driver. The iommu driver should
guarantee this.

> rcu_derefernce(param->fault_param, true) and WARN_ON NULL.

Okay, sure.

Best regards,
baolu