Re: [PATCH v4 2/5] iommu/vt-d: Remove the pasid present check in prq_event_thread

Baolu Lu
2024-10-31T03:43:05Z

On 10/30/24 22:28, Joel Granados wrote:
>> /*
>> diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
>> index 078d1e32a24e..ff88f31053d1 100644
>> --- a/drivers/iommu/intel/svm.c
>> +++ b/drivers/iommu/intel/svm.c
>> @@ -304,9 +304,6 @@ void intel_drain_pasid_prq(struct device *dev, u32
>> pasid)
>> int qdep;
>>
>> info = dev_iommu_priv_get(dev);
>> - if (WARN_ON(!info || !dev_is_pci(dev)))
>> - return;
> Did you mean to take out both checks?:
> 1. The info pointer check
> 2. the dev_is_pci check
>
> I can understand the dev_is_pci check, but we should definitely take
> action if info is NULL. Right?

WARN_ON(!info) is duplicate as far as I can see. Accessing
info->pri_enable when info is NULL will cause a null pointer dereference
warning. This appears irrelevant to this patch though.

>
>> -
>> if (!info->pri_enabled)
>> return;
>>
>> Generally, intel_drain_pasid_prq() should be called if
>>
>> - a translation is removed from a pasid entry; and
> This is the path that is already mentiond
>
>> - PRI on this device is enabled.
> And this path is:
> -> intel_iommu_enable_iopf
> -> context_flip_pri
> -> intel_context_flush_present
> -> qi_flush_pasid_cache
>
> Right?

Sorry that I didn't make it clear. It should be "PRI on this device was
enabled", a.k.a. info->pri_enabled is true. I didn't meant to say in the
PRI enabling path.

--
baolu