From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 0F79143C046 for ; Fri, 6 Mar 2026 19:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772827180; cv=none; b=s1sktAS51d38ZqbJVvsTAgY+MXXihKDmzQhVIHkWwsB5MTJctB1qe8RW8EbDFy0UHmtFT+gV5kuO+RQSxwhfr4tOrAB0vgmhRCz7paP7bp9e5KQgSpN6BtCwFunboqSxVxLTCJvXUhl5tWgKVoPqiBMqY130fkHrqW1XH9/wixk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772827180; c=relaxed/simple; bh=945rH/e5rNYp7DXMDC1/KmZIttMnGVuMabmAVl9nIC0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OCYUra13bJsekYxkdGQHOVzWvXLUCz19VDNxHHBd6QPao+t/jb6bpcTZICYBDEO7VZNBCPDJR9brzdofsNRKNL997M1hls5Y7UAIuI+dBvuWu6FdByiFDRM3bETZ4Ospgb2sagKORt8gEOrpehXZYByWB26lq6awCZ8t0Aj1B8M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OrWt7DWb; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OrWt7DWb" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2ae49120e97so12515ad.0 for ; Fri, 06 Mar 2026 11:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772827178; x=1773431978; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=945rH/e5rNYp7DXMDC1/KmZIttMnGVuMabmAVl9nIC0=; b=OrWt7DWbIRNvwgpJ1SXQfaUPeSPg/CMtLN4LLK77HtDC7TsRliYyagu2uKAMxouZEN D6ijFaq8M8csmb2299380mt4vwVXkFM1QNmVA8oIfKP+ogJClfFSKui1qKjMLELs674l HEPrEJ9web5tXJu+qIG1yFeI94nhABZBkCNCdAwLF8UZxvZu+050hH4+hEXjgNd/KpP/ JKV2BwLymXLwasbv76dSsHU2wlNncZg6YBZkO/aWTeS80BYmD/m73wZPEzwYYQY+SMJE Df+3ndbkdNhXqHUImdG1zNXq2Na8Y+dYst5ALI3t6iAVKmvdEHHVKrmNkhPR9tB78HGd V2Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772827178; x=1773431978; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=945rH/e5rNYp7DXMDC1/KmZIttMnGVuMabmAVl9nIC0=; b=RG9Xxwe0B89dfPh+3qC3Wno4cfRn+FAihskBuyl7ln04OM17XRWPInrMwLiYeZ7c+a vDVP6hYpGFdQEUL5MtdEiN3RhuHyep4IOIw9AyPNN6mWjc4XI9P4cekklQcbRyRN+xIn WmcrNf199tjsuAEMzDCJHkQdIf3YiXDqvB4QvD3Xs28IQlCZrz0Q3NbCmkphokSCM/Na 9HXEUiRlugucsBjXMytS7x0ooeG+GoHptxmRX9/FYII6s8yv8vvXR+eBtAoAUU2MYmpK Ui5Jk5v3gE9Kha7IHlZ+TQUInesokqYD1gX1z+9/wqVj2/MMw1HY/hYU32MSZZQz8IKs 5paw== X-Forwarded-Encrypted: i=1; AJvYcCW8s7xi7YJxehpASnXRMrgOXXBOKwJR7q8T7exow9ByIFIXuh3GK9DamQWqMF17vbi6kW54QIA17G9hdb8=@vger.kernel.org X-Gm-Message-State: AOJu0YxUENk6mihymeTSKMfUXGee4nvze9dto7LWLF7Bd9Sbt178yGQm deHt7uBvBe318yTb3Z85ujP2+f6Pt6DxxjiiWDwtYbjwRJxLSoQ/rVvQ7A/LWd71yw== X-Gm-Gg: ATEYQzxHmYfPO3TJMCX9GMaEGxxdyKkSUJehiN+TFmwpwzkT2onKk2qGF9KpRtKec3m cgjOjbeDhNbvfmY5Eda3FjSnKPPnj6L1zEiSeHIAXsU1XWdzdaP/fSTofxuHvNO5WLhGcfONWYS kkTAeM7ToQs15F1BKVBuUqHI0b4Mn7bz5VGZdcA10+mKFvxOz6d+PcGnTBLO3wsmGc9cjzmUrhZ D2tIg9ouBbgXQkvjK35H0WVnXdHOx5MjywUnis3kplA2SFZEUhA9Gq7rQ1XLrrAwFwgX7CIDPXO LcjiqxlBW1w5AadbAbh7xKTbQyRel8eP67hHAs9LqquPMmfztdJawKrn9qgZpsczugH/7NeLyn5 1evZwOvsw+JWqeUITJ+i58YLmzWS7EMfJmAjRKc5vi0RfkBybyFhbjyfpwU9ZP5uW2zu3InbF2E vfgk2wbBClBrhuLkB9Qr6GeIfUa6geNfnXjZE0mr8Dm5ixNKb6Gbajm1yHTqdN1g== X-Received: by 2002:a17:903:2f8a:b0:2ae:575f:3755 with SMTP id d9443c01a7336-2ae8ad8939bmr404865ad.20.1772827178041; Fri, 06 Mar 2026 11:59:38 -0800 (PST) Received: from google.com (168.136.83.34.bc.googleusercontent.com. [34.83.136.168]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae840b2130sm30703795ad.83.2026.03.06.11.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 11:59:37 -0800 (PST) Date: Fri, 6 Mar 2026 19:59:33 +0000 From: Samiullah Khawaja To: Jason Gunthorpe Cc: Baolu Lu , Nicolin Chen , will@kernel.org, robin.murphy@arm.com, joro@8bytes.org, bhelgaas@google.com, rafael@kernel.org, lenb@kernel.org, praan@google.com, kees@kernel.org, smostafa@google.com, Alexander.Grest@microsoft.com, kevin.tian@intel.com, miko.lenczewski@arm.com, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, vsethi@nvidia.com Subject: Re: [PATCH v1 2/2] iommu/arm-smmu-v3: Recover ATC invalidate timeouts Message-ID: References: <20260305153911.GT972761@nvidia.com> <6416b7fe-0190-4c7b-9a62-5da7d5eea794@linux.intel.com> <20260306130006.GF1651202@nvidia.com> <20260306194312.GL1651202@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20260306194312.GL1651202@nvidia.com> On Fri, Mar 06, 2026 at 03:43:12PM -0400, Jason Gunthorpe wrote: >On Fri, Mar 06, 2026 at 07:35:19PM +0000, Samiullah Khawaja wrote: >> On Fri, Mar 06, 2026 at 09:00:06AM -0400, Jason Gunthorpe wrote: >> > On Fri, Mar 06, 2026 at 11:22:52AM +0800, Baolu Lu wrote: >> > > I believe this issue is not unique to the arm-smmu-v3 driver. Device ATC >> > > invalidation timeout is a generic challenge across all IOMMU >> > > architectures that support PCI ATS. Would it be feasible to implement a >> > > common 'fencing and recovery' mechanism in the IOMMU core so that all >> > > IOMMU drivers could benefit? >> > >> > I think yes, for parts, but the driver itself has to do something deep >> > inside it's invalidation to allow the flush to complete without >> > exposing the system to memory corruption - meaning it has to block >> > translated requests before completing the flush >> >> Yes and currently the underlying drivers have software timeouts >> (AMD=100millisecond, arm-smmu-v3=1second) defined which could timeout >> before the actual ATC invalidation timeout occurs. Do you think maybe >> the timeout needs to be propagated to the caller (flush callback) so the >> memory/IOVA is not allocated to something else? > >No, definitely not, that's basically impossible, so many callers just >can't handle such an idea, and you can't ever fully recover from such >a thing. > Agreed. >> Or blocking translated requests for such devices should be enough? > >Yes, we have to fence the hardware and then allow the existing SW >stack to continue without any fear of UAF from the broken HW. And this applies to software timeout also I think, since both have same end result. I am working on a series to solve this for VT-d and testing it internally. > >Fencing the HW means using the IOMMU to block translated requests. > >Jason