Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67BC82472A6 for ; Sun, 1 Mar 2026 01:17:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772327852; cv=none; b=J5tWVxTEpN7jMMzn0QHDmkTwPrz1Gcf/vKY+Gam7hRqLXesP3ykh1a+T+B9lY2aYT8jGPH1vTG25x0Itor95BWDDPBK9RNMkmzlIQYvalhIoJuSZvE48IktMMAc3DUPGzIMPcKcnp2q45JQvSZWAz2tN3wXj1JOrkI0+Ph9Ae/4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772327852; c=relaxed/simple; bh=Zs+lV6WzByO5DOJKciAmQwlU/O+C9Rh/JqGQ0kowbLM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iSbuXa+2qOJVRO03HsMXn8dEE3mRpYALKjJJdgXJ+/UNSAofzegb6F7f6tKmQgih1LsSgyWNpwMRaI31/6eMsP3fFA1JRFgpRQgWF57J68rB612DcMrdBJCO2P5+8wZQdN2Ei0OzGQzPWdeBskDvh2Bd83/InOiBAq0mY5EvIPU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dachz+Xt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dachz+Xt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 513BCC19421; Sun, 1 Mar 2026 01:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772327852; bh=Zs+lV6WzByO5DOJKciAmQwlU/O+C9Rh/JqGQ0kowbLM=; h=From:To:Cc:Subject:Date:From; b=Dachz+XtA43wnzWAEs4jaSoxnIyNEUGxStL48gZi14KteLwJ5C20n987kVQDSpUK/ IB3ij7Y3PYOmLkO5egId0PGyLR6DbPHKPEBqjqSbQYh9pXtL5jXECn9WBxn4sLX+Sf VSYs302S3ayfnsAI8l3XrJ8rRPi6B7Iu+y0xdQHTnS/eh30Kiryu/WWM7k8n2rHFMo xnYYb7BZNWMUw3zkliwChUnHSHEBLIMFZHayl9i5uZ1Qy0z6S2+CjkFS+H3OkyaXMl PVmGNjxW3v5k9TeEFAgVVE4ixmHyKYlb798jHBpxq8mEX2/B+tHwv+QgejFCu/Tkl4 ZJjY9/7XhyU1g== From: Sasha Levin To: stable@vger.kernel.org, mario.limonciello@amd.com Cc: Cal Peake , Alex Deucher , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: FAILED: Patch "drm/amd: Fix hang on amdgpu unload by using pci_dev_is_disconnected()" failed to apply to 6.18-stable tree Date: Sat, 28 Feb 2026 20:17:29 -0500 Message-ID: <20260301011730.1671451-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha ------------------ original commit in Linus's tree ------------------ From f7afda7fcd169a9168695247d07ad94cf7b9798f Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Thu, 5 Feb 2026 10:42:54 -0600 Subject: [PATCH] drm/amd: Fix hang on amdgpu unload by using pci_dev_is_disconnected() The commit 6a23e7b4332c ("drm/amd: Clean up kfd node on surprise disconnect") introduced early KFD cleanup when drm_dev_is_unplugged() returns true. However, this causes hangs during normal module unload (rmmod amdgpu). The issue occurs because drm_dev_unplug() is called in amdgpu_pci_remove() for all removal scenarios, not just surprise disconnects. This was done intentionally in commit 39934d3ed572 ("Revert "drm/amdgpu: TA unload messages are not actually sent to psp when amdgpu is uninstalled"") to fix IGT PCI software unplug test failures. As a result, drm_dev_is_unplugged() returns true even during normal module unload, triggering the early KFD cleanup inappropriately. The correct check should distinguish between: - Actual surprise disconnect (eGPU unplugged): pci_dev_is_disconnected() returns true - Normal module unload (rmmod): pci_dev_is_disconnected() returns false Replace drm_dev_is_unplugged() with pci_dev_is_disconnected() to ensure the early cleanup only happens during true hardware disconnect events. Cc: stable@vger.kernel.org Reported-by: Cal Peake Closes: https://lore.kernel.org/all/b0c22deb-c0fa-3343-33cf-fd9a77d7db99@absolutedigital.net/ Fixes: 6a23e7b4332c ("drm/amd: Clean up kfd node on surprise disconnect") Acked-by: Alex Deucher Signed-off-by: Mario Limonciello Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 528990a595ec9..9758221413814 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4924,7 +4924,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) * before ip_fini_early to prevent kfd locking refcount issues by calling * amdgpu_amdkfd_suspend() */ - if (drm_dev_is_unplugged(adev_to_drm(adev))) + if (pci_dev_is_disconnected(adev->pdev)) amdgpu_amdkfd_device_fini_sw(adev); amdgpu_device_ip_fini_early(adev); @@ -4936,7 +4936,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) amdgpu_gart_dummy_page_fini(adev); - if (drm_dev_is_unplugged(adev_to_drm(adev))) + if (pci_dev_is_disconnected(adev->pdev)) amdgpu_device_unmap_mmio(adev); } -- 2.51.0