From nobody Thu Apr 9 23:25:15 2026 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (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 8960B388395 for ; Wed, 4 Mar 2026 21:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772659838; cv=none; b=Zo3pxTFd6yj1WN0vt6Fcl+3yPj7INb6ePBY41pXMy6YwWgDU48F3gIf8WUUBbZP6sUdi5TSQgfevGn/Z9oppdyr3dq1HKAi0ELAfM4PArtyS9La9thzjAJtGpMI2mZUoA3JDJuAFNvZDsgA5/gzGmjxdu0VSJtP1wRfq/LDMk3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772659838; c=relaxed/simple; bh=3c6quBI7XKemYPlN0GskGbNjt6avnY6lfsxgp6Bz4Sg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KZkRJ4zTvGKCMZv7+6bcKhh5cPBqM9NcrX6akF4hRZczldp86iR0cIUSya7XRVsjtZLpi4fRjQd0+Mqowxe5onXy1LDQv0jDcKQbUMcnYj8ObXCV4xjt2Kf7+ot6JA3roKeJdHzNh9qSVzLYLj5UEugLqpZa2SPhOFGWRWXNdmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com; spf=pass smtp.mailfrom=toxicpanda.com; dkim=pass (2048-bit key) header.d=toxicpanda.com header.i=@toxicpanda.com header.b=EH9xGzUi; arc=none smtp.client-ip=209.85.222.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toxicpanda.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda.com header.i=@toxicpanda.com header.b="EH9xGzUi" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-8cb7edbcde6so894883485a.3 for ; Wed, 04 Mar 2026 13:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda.com; s=google; t=1772659834; x=1773264634; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mSYjaX5A2f3fgxWLqUioHt5Z6vX3IWJb5py3eGwR73M=; b=EH9xGzUiDPZym6bgre+wwGDAa/w+CkEOE7HIumNYtHqXUCGvGs+Ci4kSaJkKeIdZkJ AEBAEi4xlxMTDg67I4owIWa9tvRP+NV6fGtV34yCM2EUeCbDv36LHIT9ZU+r4DjX6aGs pzTpT9W4uP4aUcSAkcGcnUxmNvyXE9vANgNVmiQpx/kmpKeLw9nf0m9E8EdoqTcd/DZB Fk5oEiunel84z1T8JDWCKFoFwBojlu4cnoVEKA41bFm3zZiOe7qF6ylSeF85ncwKwy+e SF/DSqk101uaMFT6qksjC1HyVcndjV/g5YwATRAQQHwhtToO7DetFnI/tb8JM5L0pk4F cVQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772659834; x=1773264634; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mSYjaX5A2f3fgxWLqUioHt5Z6vX3IWJb5py3eGwR73M=; b=eMNUeCuxg+rpM5vUBQec0ynFzpY3oDPvn7dXBbdCdGyF2oChoKTtzV/tEcY4BvTVHR CXIglZ7FHsSgiMWm2hfP+mDn7B5msExtPbrUlicSrOiG4xnuDwSIWQCm40bvin7rP1/+ tVY2GU35WW/Bk9MPOpyROtFZpWps8jfsBWv1vk9wN/XhQgQJI41emN2pQ2oLKK+iA8xC SeR2umjWORHTLBv2E1SUtYjLkfGsM9AKV9kXT62Kk2ozqWHm1BU6h5jOirSdVW65Te8K 53IYGptvmq7hSf1RFIXQdwUkVFp/X5h4v7mATwWa22cPtBp4f/JTFEHyEJBzTEfgeFJt B5CA== X-Forwarded-Encrypted: i=1; AJvYcCVdU070rAXPeKkpMmRzVq0SeAYte3rv2gxB6+imavbHVWQPAFZCSSpxPrd+w3Y3EbBqbpYnr9+5UJAGZ8Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7dc7h2QNCA/mLWuu+gGvF9QsprHqEUVzEVdq47YsOGQq9z1/2 zZJ5PVAxx7n0FRsYnCr+mY7aKLcxdW1EY995/PLpAeUf/cBcVHR7xMXvD6jYISA7lqI= X-Gm-Gg: ATEYQzzQtXKtMhx9z6efbOAj6gNYd2SNOAxXCl7V5qvzK8Ox3DsNPjOLLswX1fLnezl 27MEWMqQaGnucumCc/zfYSDd9kNn+QPJrzls18eSX+FH6IKObaKKwEa/WuvqgPFXofOgwJES79/ Gtlf90Kl5Hup58p7B8TxYlkTKyl+VCh7sRyfmfWaO3rssBnePWl1N9AADJ9R3DAMzJAfEEmMEJs feA4I8meT33hkBRXpfF/Osha0/wX0mYPs9x2SDkzeEAB4Pi7IOrUJjUIXHMtqCNR/oT8d9qEeyK GwOVd7V6LbUUsij8j0QsVYhSYd4nUZ+RzehHarD/pvEf33V5YFIqoowPb3j+vWpZD8RRwTOnZlf 2ybyGMVAoBofPaMZHhxrgvczMEtBtvWEUj1Q8SqAuMkTt0Kve3oQq8ufAYIA+nmTqOIIsZsfD9U OU2FbDjHEF7AZ2liPK57VozyPQtn3yHgBufUqZ X-Received: by 2002:a05:620a:370a:b0:8cb:baea:89c4 with SMTP id af79cd13be357-8cd5aef2c3bmr477281285a.24.1772659834084; Wed, 04 Mar 2026 13:30:34 -0800 (PST) Received: from localhost ([2603:6080:7702:ce00:96ef:dc7e:bb84:bc5a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cbbf6869f5sm1998144785a.20.2026.03.04.13.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 13:30:33 -0800 (PST) From: Josef Bacik To: joro@8bytes.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH] amd/iommu: do not split domain flushes when flushing the entire range Date: Wed, 4 Mar 2026 16:30:03 -0500 Message-ID: X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We are hitting the following soft lockup in production on v6.6 and v6.12, but the bug exists in all versions watchdog: BUG: soft lockup - CPU#24 stuck for 31s! [tokio-runtime-w:1274919] CPU: 24 PID: 1274919 Comm: tokio-runtime-w Not tainted 6.6.105+ #1 Hardware name: Google Google Compute Engine/Google Comput Engine, BIOS Goog= le 10/25/2025 RIP: 0010:__raw_spin_unlock_irqrestore+0x21/0x30 Call Trace: amd_iommu_attach_device+0x69/0x450 __iommu_device_set_domain+0x7b/0x190 __iommu_group_set_core_domain+0x61/0xd0 iommu_detatch_group+0x27/0x40 vfio_iommu_type1_detach_group+0x157/0x780 [vfio_iommu_type1] vfio_group_detach_container+0x59/0x160 [vfio] vfio_group_fops_release+0x4d/0x90 [vfio] __fput+0x95/0x2a0 task_work_run+0x93/0xc0 do_exit+0x321/0x950 do_group_exit+0x7f/0xa0 get_signal_0x77d/0x780 This occurs because we're a VM and we're splitting up the size CMD_INV_IOMMU_ALL_PAGES_ADDRESS we get from amd_iommu_domain_flush_tlb_pde() into a bunch of smaller flushes. These trap into the host on each flush, all while holding the domain lock with IRQs disabled. Fix this by not splitting up this special size amount and sending the whole command in, so perhaps the host will decide to be gracious and not spend 7 business years to do a flush. cc: stable@vger.kernel.org Fixes: a270be1b3fdf ("iommu/amd: Use only natural aligned flushes in a VM") Signed-off-by: Josef Bacik --- drivers/iommu/amd/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 81c4d7733872..f0d3e06734ef 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -1769,7 +1769,8 @@ void amd_iommu_domain_flush_pages(struct protection_d= omain *domain, { lockdep_assert_held(&domain->lock); =20 - if (likely(!amd_iommu_np_cache)) { + if (likely(!amd_iommu_np_cache) || + size =3D=3D CMD_INV_IOMMU_ALL_PAGES_ADDRESS) { __domain_flush_pages(domain, address, size); =20 /* Wait until IOMMU TLB and all device IOTLB flushes are complete */ --=20 2.53.0