From: Baolu Lu <baolu.lu@linux.intel.com>
To: Ethan Zhao <haifeng.zhao@linux.intel.com>
Cc: baolu.lu@linux.intel.com, linux-pci@vger.kernel.org,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
bhelgaas@google.com, dwmw2@infradead.org, will@kernel.org,
robin.murphy@arm.com, lukas@wunner.de
Subject: Re: [PATCH v3 2/2] iommu/vt-d: don's issue devTLB flush request when device is disconnected
Date: Tue, 19 Dec 2023 15:35:57 +0800 [thread overview]
Message-ID: <fa317b2b-b1b8-4776-a122-ae7993bd3c41@linux.intel.com> (raw)
In-Reply-To: <53591775-b93c-4963-b57b-8027e39a6ecc@linux.intel.com>
On 2023/12/19 15:27, Ethan Zhao wrote:
> Baolu,
>
> On 12/19/2023 3:16 PM, Ethan Zhao wrote:
>>
>> On 12/19/2023 2:57 PM, Baolu Lu wrote:
>>> On 2023/12/19 14:49, Ethan Zhao wrote:
>>>>>> diff --git a/drivers/iommu/intel/pasid.c
>>>>>> b/drivers/iommu/intel/pasid.c
>>>>>> index 74e8e4c17e81..182eb5df244d 100644
>>>>>> --- a/drivers/iommu/intel/pasid.c
>>>>>> +++ b/drivers/iommu/intel/pasid.c
>>>>>> @@ -476,6 +476,23 @@ devtlb_invalidation_with_pasid(struct
>>>>>> intel_iommu *iommu,
>>>>>> {
>>>>>> struct device_domain_info *info;
>>>>>> u16 sid, qdep, pfsid;
>>>>>> + struct pci_dev *pdev;
>>>>>> +
>>>>>> + pdev = to_pci_dev(dev);
>>>>>> + if (!pdev)
>>>>>> + return;
>>>>>> +
>>>>>> + /*
>>>>>> + * If endpoint device's link was brough down by user's pci
>>>>>> configuration
>>>>>> + * access to it's hotplug capable slot link control register,
>>>>>> as sequence
>>>>>> + * response for DLLSC, pciehp_ist() will set the device
>>>>>> error_state to
>>>>>> + * pci_channel_io_perm_failure. Checking device's state here
>>>>>> to avoid
>>>>>> + * issuing meaningless devTLB flush request to it, that might
>>>>>> cause lockup
>>>>>> + * warning or deadlock because too long time waiting in
>>>>>> interrupt context.
>>>>>> + */
>>>>>> +
>>>>>> + if (pci_dev_is_disconnected(pdev))
>>>>>> + return;
>>>>>> info = dev_iommu_priv_get(dev);
>>>>>> if (!info || !info->ats_enabled)
>>>>>
>>>>> It's likely better to check the device status after verifying
>>>>> ats_enabled. How about below change?
>>>>>
>>>>> diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
>>>>> index 74e8e4c17e81..fa19c6cdfd8b 100644
>>>>> --- a/drivers/iommu/intel/pasid.c
>>>>> +++ b/drivers/iommu/intel/pasid.c
>>>>> @@ -481,6 +481,9 @@ devtlb_invalidation_with_pasid(struct
>>>>> intel_iommu *iommu,
>>>>> if (!info || !info->ats_enabled)
>>>>> return;
>>>>>
>>>>> + if (pci_dev_is_disconnected(to_pci_dev(dev)))
>>>>
>>>> I like this kind of simplicity, but rationalist always brings me
>>>> back to the no-error(ugly)
>>>>
>>>> style. 🙂
>>>
>>> The rational is that Intel IOMMU driver only supports PCI ATS. So if
>>> device is marked as ATS supported, then it must be a PCI device.
>>> Therefore, it's safe to convert it to pci_device with to_pci_dev().
>>
>> Fair engough !
>>
>>
> May I use your reviewed-by sign in next version after that ?
I am not sure about the changes in the PCI subsystem. Since the code
here calls the new interface from that subsystem, I need acked-by on
that change before proceeding.
Best regards,
baolu
next prev parent reply other threads:[~2023-12-19 7:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-17 11:49 [PATCH v3 0/2] fix vt-d hard lockup when hotplug ATS capable device Ethan Zhao
2023-12-17 11:49 ` [PATCH v3 1/2] PCI: make pci_dev_is_disconnected() helper public for Ethan Zhao
2023-12-17 11:49 ` [PATCH v3 2/2] iommu/vt-d: don's issue devTLB flush request when device is disconnected Ethan Zhao
2023-12-19 6:09 ` Baolu Lu
2023-12-19 6:37 ` Ethan Zhao
2023-12-19 6:49 ` Ethan Zhao
2023-12-19 6:57 ` Baolu Lu
2023-12-19 7:16 ` Ethan Zhao
2023-12-19 7:27 ` Ethan Zhao
2023-12-19 7:35 ` Baolu Lu [this message]
2023-12-19 7:44 ` Ethan Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa317b2b-b1b8-4776-a122-ae7993bd3c41@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dwmw2@infradead.org \
--cc=haifeng.zhao@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox