From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E056311975 for ; Sun, 1 Mar 2026 03:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.193 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772337057; cv=none; b=OYz9fUrLAOuYiSDN5CO1l81ZZgZVhifELGTwwpUxKpW9+naBDtS2A6lcTgNMH4LyiG8HZS6kU/i/zhCwtb5DeU+mLAYY06S5EHLpFxvU3XlvvwK0RME65SjfJJ8MzpsVpkPebA0zNoEd5xKOsAu0fRSuZGKQd+q2aAnVk6PjKAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772337057; c=relaxed/simple; bh=dMPwz83V0EGBSQGUv+05EFSISdqfMRyZjBUGlzSck3U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bwsWMvv4uDyIIUyt/GTvBVPgU2N1UbrEATBymjByIZJWVmH3nyhgvzHJpz4osRPHrfaSoMZ4FAxqEzhqt4umnj5o4TtHX2/n+vQyo8SrflTXm03gGNkVfWrT/mwBqZgahdyTMz3K5Ph1QAJHGwi6CloXpVhJ8Mg6Rql0TwRNPBE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cmdxjAi/; arc=none smtp.client-ip=209.85.215.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cmdxjAi/" Received: by mail-pg1-f193.google.com with SMTP id 41be03b00d2f7-c70fb6aa323so1103114a12.3 for ; Sat, 28 Feb 2026 19:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772337055; x=1772941855; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+WmlZ9Q2/zs3s/Gu9x2MdBKtAiPtvLREfo+aflS322E=; b=cmdxjAi/gfi1J5TR/i0YJ0HOqOCQk7KZtAbM/bqJb5dJf6Kr3XHc5n8XfNkS7plm9f cnjBc6Qd6TYs+zLbqZ2lyVQFllQu71EAecdhEKD0CTGVIn6tpou61oRyLYXq4t9FwYR9 PvR/sxC+ORvwWVZFOpIPH2y1IyNCGUb3faxJvEF/UE4+rB/9CfJYhXnnZ2dMmZA/QWi6 ikYP1lDulDESCW1nipI2GYk7fvFAn8Nw0T2QqdNfXCMMEYIniEoqveiXow3+HCT5pCTk hjQkWYqsUYGztBqc8G5soXZjt/Tqa0DRGVduhr/DhnbUV6NoQxAA0rVIil3QTjvceGcQ Ehwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772337055; x=1772941855; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+WmlZ9Q2/zs3s/Gu9x2MdBKtAiPtvLREfo+aflS322E=; b=jh9NOLGd6dVYdGsH/vkz/NNxGEv7ZYxUBhexiyzjmjbEU20cmPrgJpM5a+pTnyWv0d cA5auzCb5J3d8Bl1e89CyYWPggNbkeeoA0m00xC36ObVG2CC7yZyIUOe8hVQSgJPhOAo b8DaihHjIEiQAY40WkLBQLwvKqkowSmbqz25CrQrvrpSm+9G0azZSJ7EyUBTazMiO25A M23fadzuBpsN8ZUxbQ6YlYE90UgbXGhgxinyX0XEwu2Up/y7xla4+2yhmJyl5c+0DwO7 RWdzrNkifxW39zT+5Hu2s07bYzZEXrGd4U86hagC9LbaUnWPSdUm2JM2thGdyMFxovQk 7k5Q== X-Forwarded-Encrypted: i=1; AJvYcCXWwniJGJcyadynsrF9W15Nz6E/SUgLaXnB2PCEXK69m2xHf7sfEP6zpUMwOQOa3t3GmVZFz+THhfNi5IQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyE/X4GVC4B447YCBDnokNMxPkm207D9SwaLBj9fP+GDnxTy+qr K6F0jZurwDudKePBAzJL6vJXYtz1VwrOSld3lesH0425zK5yFZ93wfUZ X-Gm-Gg: ATEYQzxZbTr4+CV4sVcaYJgZa10Gn1ePUk7WT1fva2kaXu9cyQet4tu4NT3rJkuNa+E TnI4bL5CsO9NcnUsJm6ti+slqCL0LA6ZaMqAT2SxuCBkE/gP1ubyLeNNtX8g3Ors7+sgL2BybEs iM4mIM1x2yITEaFS/tCc7xfOCK+fUv2ZeB/3FYy5FGSEwDVtQem7cAGg6I9Uyl6bepnnj3KLlPi a5mLHxjyWqlecufkbZPjCXVBjS1LWNXtbxgSqHWXTKRTDo4DWBLcxClwguKn5J85WITHrY2Soax eukJh0gicW/Rs7EKglRV+tWGC8sLyj9T6ybGDOS5hnD09kwYZIjqFIOZmCUI7hNtRMkshacyRSV UqDbnkmg1w5TwMUVut45NPuU5kdlUIDC84UnyM6M1RUQvfzTBkWMUlvThERbaI2FCwtqFgSfCrC XF+SQPT6jkR77SP4d2yfy6u2B+a8+3x7DkmVxXa2cEdqU31LGnXPok9Lb5AwAqg9yV8vJydOxiW irOpAgmhQW1SN9aj3ERJ1M= X-Received: by 2002:a05:6a00:4503:b0:827:3b1b:43e6 with SMTP id d2e1a72fcca58-8274d94caf9mr6631233b3a.21.1772337055416; Sat, 28 Feb 2026 19:50:55 -0800 (PST) Received: from [26.26.26.1] (107.153.212.35.bc.googleusercontent.com. [35.212.153.107]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82739d4d880sm9534477b3a.7.2026.02.28.19.50.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 28 Feb 2026 19:50:55 -0800 (PST) Message-ID: <0a506efc-a06d-4523-b149-eb74eb5df067@gmail.com> Date: Sun, 1 Mar 2026 11:50:51 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/2] iommu/vt-d: Skip dev-iotlb flush for inaccessible PCIe device To: Jinhui Guo , dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20251211035946.2071-1-guojinhui.liam@bytedance.com> Content-Language: en-US From: Ethan Zhao In-Reply-To: <20251211035946.2071-1-guojinhui.liam@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/11/2025 11:59 AM, Jinhui Guo wrote: > Hi, all > > We hit hard-lockups when the Intel IOMMU waits indefinitely for an ATS invalidation > that cannot complete, especially under GDR high-load conditions. > > 1. Hard-lock when a passthrough PCIe NIC with ATS enabled link-down in Intel IOMMU > non-scalable mode. Two scenarios exist: NIC link-down with an explicit link-down > event and link-down without any event. > > a) NIC link-down with an explicit link-dow event. > Call Trace: > qi_submit_sync > qi_flush_dev_iotlb > __context_flush_dev_iotlb.part.0 > domain_context_clear_one_cb > pci_for_each_dma_alias > device_block_translation > blocking_domain_attach_dev > iommu_deinit_device > __iommu_group_remove_device > iommu_release_device > iommu_bus_notifier > blocking_notifier_call_chain > bus_notify > device_del > pci_remove_bus_device > pci_stop_and_remove_bus_device > pciehp_unconfigure_device > pciehp_disable_slot > pciehp_handle_presence_or_link_change > pciehp_ist > > b) NIC link-down without an event - hard-lock on VM destroy. > Call Trace: > qi_submit_sync > qi_flush_dev_iotlb > __context_flush_dev_iotlb.part.0 > domain_context_clear_one_cb > pci_for_each_dma_alias > device_block_translation > blocking_domain_attach_dev > __iommu_attach_device > __iommu_device_set_domain > __iommu_group_set_domain_internal > iommu_detach_group > vfio_iommu_type1_detach_group > vfio_group_detach_container > vfio_group_fops_release > __fput > > 2. Hard-lock when a passthrough PCIe NIC with ATS enabled link-down in Intel IOMMU > scalable mode; NIC link-down without an event hard-locks on VM destroy. > Call Trace: > qi_submit_sync > qi_flush_dev_iotlb > intel_pasid_tear_down_entry > device_block_translation > blocking_domain_attach_dev > __iommu_attach_device > __iommu_device_set_domain > __iommu_group_set_domain_internal > iommu_detach_group > vfio_iommu_type1_detach_group > vfio_group_detach_container > vfio_group_fops_release > __fput > > Fix both issues with two patches: > 1. Skip dev-IOTLB flush for inaccessible devices in __context_flush_dev_iotlb() using > pci_device_is_present(). > 2. Use pci_device_is_present() instead of pci_dev_is_disconnected() to decide when to > skip ATS invalidation in devtlb_invalidation_with_pasid(). If what I remembered right, using pci_device_is_present() to replace pci_device_is_disconnected() might not be the correct choice against link down case, you might misunderstand the function of pci_device_is _present() when device is there but link is not up. if you want to check link status, just check link status. Bjorn, correct me if I am wrong. Thanks, Ethan > > Best Regards, > Jinhui > > --- > v1: https://lore.kernel.org/all/20251210171431.1589-1-guojinhui.liam@bytedance.com/ > > Changelog in v1 -> v2 (suggested by Baolu Lu) > - Simplify the pci_device_is_present() check in __context_flush_dev_iotlb(). > - Add Cc: stable@vger.kernel.org to both patches. > > Jinhui Guo (2): > iommu/vt-d: Skip dev-iotlb flush for inaccessible PCIe device without > scalable mode > iommu/vt-d: Flush dev-IOTLB only when PCIe device is accessible in > scalable mode > > drivers/iommu/intel/pasid.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) >