public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jinhui Guo <guojinhui.liam@bytedance.com>
Cc: dwmw2@infradead.org, iommu@lists.linux.dev, joro@8bytes.org,
	linux-kernel@vger.kernel.org, will@kernel.org
Subject: Re: [PATCH 1/2] iommu/vt-d: Skip dev-iotlb flush for inaccessible PCIe device without scalable mode
Date: Thu, 11 Dec 2025 12:59:23 +0800	[thread overview]
Message-ID: <bfdc356b-7670-4942-a359-9393090468f3@linux.intel.com> (raw)
In-Reply-To: <20251211041741.2132-1-guojinhui.liam@bytedance.com>

On 12/11/25 12:17, Jinhui Guo wrote:
> On Thu, Dec 11, 2025 10:10:52AM +0800, Baolu Lu wrote:
>>> Since __context_flush_dev_iotlb() is only called on
>>> {attach,release}_dev paths (not hot), add pci_device_is_present()
>>> there to skip inaccessible devices and avoid the hard-lock.
>>>
>>> Fixes: 37764b952e1b ("iommu/vt-d: Global devTLB flush when present context entry changed")
>>> Fixes: 81e921fd3216 ("iommu/vt-d: Fix NULL domain on device release")
>> Cc:stable@vger.kernel.org
>>
>>> Signed-off-by: Jinhui Guo<guojinhui.liam@bytedance.com>
>>> ---
>>>    drivers/iommu/intel/pasid.c | 11 +++++++++++
>>>    1 file changed, 11 insertions(+)
>>>
>>> diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
>>> index 3e2255057079..b1e8eb6a6504 100644
>>> --- a/drivers/iommu/intel/pasid.c
>>> +++ b/drivers/iommu/intel/pasid.c
>>> @@ -1099,9 +1099,20 @@ int intel_pasid_setup_sm_context(struct device *dev)
>>>     */
>>>    static void __context_flush_dev_iotlb(struct device_domain_info *info)
>>>    {
>>> +	struct pci_dev *pdev;
>>> +
>>>    	if (!info->ats_enabled)
>>>    		return;
>>>    
>>> +	/*
>>> +	 * Skip dev-IOTLB flush for inaccessible PCIe devices to prevent the
>>> +	 * Intel IOMMU from waiting indefinitely for an ATS invalidation that
>>> +	 * cannot complete.
>>> +	 */
>>> +	pdev = dev_is_pci(info->dev) ? to_pci_dev(info->dev) : NULL;
>>> +	if (pdev && !pci_device_is_present(pdev))
>>> +		return;
>> Could simply be
>>
>> 	if (dev_is_pci(info->dev) &&
>> 	    !pci_device_is_present(to_pci_dev(info->dev)))
>> 		return;
>>
>> ?
>>
>>> +
>>>    	qi_flush_dev_iotlb(info->iommu, PCI_DEVID(info->bus, info->devfn),
>>>    			   info->pfsid, info->ats_qdep, 0, MAX_AGAW_PFN_WIDTH);
>>>    
>> Thanks,
>> baolu
> Hi, baolu
> 
> Thanks for your time and suggestions.
> 
> I’ve sent v2 (https://lore.kernel.org/all/20251211035946.2071-1- 
> guojinhui.liam@bytedance.com/)
> with the following changes:
> 
> 1. Simplified the pci_device_is_present() check in __context_flush_dev_iotlb().
> 2. Added Cc:stable@vger.kernel.org to both patches.

Thanks! I would suggest not updating the patch versions so frequently
next time. It is important to provide the reviewers with more time to
comment on your submissions. :-)

Thanks,
baolu

  reply	other threads:[~2025-12-11  5:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 17:14 [PATCH 0/2] iommu/vt-d: Skip dev-iotlb flush for inaccessible PCIe device Jinhui Guo
2025-12-10 17:14 ` [PATCH 1/2] iommu/vt-d: Skip dev-iotlb flush for inaccessible PCIe device without scalable mode Jinhui Guo
2025-12-11  2:10   ` Baolu Lu
2025-12-11  4:17     ` Jinhui Guo
2025-12-11  4:59       ` Baolu Lu [this message]
2025-12-10 17:14 ` [PATCH 2/2] iommu/vt-d: Flush dev-IOTLB only when PCIe device is accessible in " Jinhui Guo

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=bfdc356b-7670-4942-a359-9393090468f3@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=guojinhui.liam@bytedance.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --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