Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 391FACD5BAF for ; Fri, 22 May 2026 00:21:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1BB610E20F; Fri, 22 May 2026 00:21:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="L75E6lr/"; dkim-atps=neutral Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013040.outbound.protection.outlook.com [40.107.201.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 76F7710E1EE for ; Fri, 22 May 2026 00:21:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hz6BWqrXoPONxLtxizVNm3shkrG5X19PrBzQQuyaCa7xQzk9Irf/hTjcTpnC2MRR/VFk3XP0Fh2DfQ8MoT+NWVNQNu1/KyQcypHMwjfGZnSjzpio71ock8rj9Nf2XrNYB9m0HGLSRJJ3Bie2y9/CpQTGX9PWuJq273lP/pOxgv/8cY5uilygtWVOzX029kRn6oZhyTbF54PAEj5DHmTAxiUBESnKS8plcZHCdD3qcZ0lGUDFTVU4imq8fM6mRpyctWrpKexVE0AB3arQ6Vr6+Gdf3vsIyD1ereYC184DpgkoSDVDTgTw3vQqUspAMAfgAG2mBe74HrXDveBIIhriCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fTaVIaVNUpLV2MmGRCjeQrk4sCTdurCWWMfdPqRNA00=; b=ejgNpD4umwve8gHHt+YsQMa4qeaQo+HHhV/S+7T7d56pzbaLuomrc9sO1ZBoJ1l3T0yHFNDxkmLpeXm28jQzgTbj7JkKqhN9PAVQ+33ZI389qpU7xIqT6eXn6jjf18mDzZvywUjchm7diJ4JFeRMb/ARnpLMKYrpKajiEJpRctAbyI2lawnJ1j07ogm0opN+vmiFkxu30yPzqAhODZUg1yYTiYo9aA57OWCMqrLD8d2oR8ewJxYcP/qVxFx8fO2KoR8zw3eue1julzpTiWaZ2MQQdMYCE2/Zf90+4V+Dr2udV0Vc3ujw5aX3G2KQQiAl2yHn6fwTKm/x/RNPhyo7vQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fTaVIaVNUpLV2MmGRCjeQrk4sCTdurCWWMfdPqRNA00=; b=L75E6lr/4J0WjlurrdwirKZVCH+3T/ZJMquhukMiSvb0/M7sionfPdvXjJ26a1yHwaY8vEeZ6Vjy3W3Okek2WlJqdcE4BKQgIZGGdKaSXXMdz8eeie4mpOp6T5iOgpUttiHug695tplM/zPRCzwOEA1Z9liyVnXe+ADpyk9pvH8= Received: from MW4P222CA0008.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::13) by DS7PR12MB5958.namprd12.prod.outlook.com (2603:10b6:8:7d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.48.14; Fri, 22 May 2026 00:21:12 +0000 Received: from SJ1PEPF00002319.namprd03.prod.outlook.com (2603:10b6:303:114:cafe::c7) by MW4P222CA0008.outlook.office365.com (2603:10b6:303:114::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.48.17 via Frontend Transport; Fri, 22 May 2026 00:21:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by SJ1PEPF00002319.mail.protection.outlook.com (10.167.242.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.71.7 via Frontend Transport; Fri, 22 May 2026 00:21:12 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.41; Thu, 21 May 2026 19:21:10 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 21 May 2026 19:21:10 -0500 Received: from p8.amd.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.41 via Frontend Transport; Thu, 21 May 2026 19:21:09 -0500 From: Alex Deucher To: , , , , , CC: Alex Deucher Subject: [PATCH 02/42] drm/amdgpu: don't reemit if there is nothing to reemit Date: Thu, 21 May 2026 20:20:08 -0400 Message-ID: <20260522002048.98506-3-alexander.deucher@amd.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260522002048.98506-1-alexander.deucher@amd.com> References: <20260522002048.98506-1-alexander.deucher@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Received-SPF: None (SATLEXMB04.amd.com: alexander.deucher@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002319:EE_|DS7PR12MB5958:EE_ X-MS-Office365-Filtering-Correlation-Id: 34db9036-7a47-46a9-f975-08deb798078e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700016|376014|82310400026|18002099003|56012099003|22082099003|6133799003|5023799004|11063799006; X-Microsoft-Antispam-Message-Info: X5BLuAlZsYQlvpTWbTIprB8THtLfNIBOW93rm3C7h2sCL1qRv0NdifDgQpOVMetaicQJ7d+WUaWSG9O/5wPIyUsB6vPVb8eLfN90fGFt9BZdA77RzaA2nJRL5wI1Vj84YSjfXKDXFxazvjdaLqQBl94Gy8duU82rNVP0dPxAMXJycPFUUJF42sD/kvGnCVCXFPu19mMIz8Kp+HydLGm5A1h5knZ1lTqloqI5zEFEfmC0+TB8BFCrGZTkdbecHuFZvn1811Oy/h5bQamplpC+r4IFOt/tIU5kt46yrUvkp5skgIM99OcPw/a+ZJMeDiA6ZhqOlQh/4Wxt8ig8L6MJXbv5uxs2tAyrbo0x/MHDXJSgcgFhswcBZ7uMuHvCTmz+/20Kb4waCRN6TkYBO3KjjC5aLHoXqs42uHgsfrAzyCIbNijO4NKDvGnVLLS605fhHguc4o8n1dCF2NY9bwUdOnBP1rjrqOJ5tWh8sIQ+3DfekcsShbjiWWXM9euuz22HN/Vt0BxXJM0SDvWXFVYUxdzezN2eUI1Z7Anz6DmUekEHLb5+KZRr5AfzxdKM2XCIHN+5cRFdnaQ3kGg9rK1kZ8iSC0VuHzk+9Yf6QTuu/lYkI7qPSfurbmLJ8iTyNGGAWOZu2JAVL04pplzMPZ8c1+7Zey5ozCBgHJhVmOsDiBai0PYjRkFVkDxBdZnE5Onu3nNyO3HW0yFadjYQXD7UT/VR7woSbjMmfDtYrXNHwck= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb08.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700016)(376014)(82310400026)(18002099003)(56012099003)(22082099003)(6133799003)(5023799004)(11063799006); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E6OcfT18XMVJM5Sma0IU5o71pMFroxnG2rTVIuY7Do6YCRpbkfVH/m0da87BVsiM0dIoiaz/4bcWcEt0OovM3THRxWMVlMM/1P7quZvWT80wQACJiBFKSKqB7jtiQPvwMmCmOjT1ruyJtQ/m8QrxLbwlcqhVi/23rLyhRqF+GI7/Fr/Zfp8HN4YSGDnPaFY5TTZyXbI9juYkI00Rz+iHnZn0W8rLPbx9ep8G0Gyqjv9rmx8j9yeF4MIMnt+UWov5eRX7Oin7f4hlVTLTuesCMbTKnSgzP/2z0hJUMc8tQbj6YemnkXUjlS190qKvBclzvKC/EbTIOsSisGKEJnhzjvF2NzFm6KeGuOvodjKFY6R9/r8JHQ628rgI+j/flud1FO1DXpb2HVngpV8SleR5Xqet+siTAzgdVGF4lghLFB2P7OvLdgpL4WtEBcl9ju8q X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2026 00:21:12.1524 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34db9036-7a47-46a9-f975-08deb798078e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002319.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5958 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" Return early in amdgpu_ring_set_fence_errors_and_reemit() if ring_backup_entries_to_copy is 0. That means that either the ring is idle and there is nothing to reemit, or there some reason why we should reemit, so return early and signal the fences (if applicable). Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index ea69b1bac7c6e..6a43c8494fa8c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c @@ -727,6 +727,15 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring, last_seq = amdgpu_fence_read(ring) & ring->fence_drv.num_fences_mask; seq = ring->fence_drv.sync_seq & ring->fence_drv.num_fences_mask; + /* If there is nothing to reemit, return early and set an error on the fence + * if applicable. If all of the fences are siganlled, this will be a nop. + * if there are still fences and ring_backup_entries_to_copy is 0, then + * we are skipping it on purpose. + */ + if (!ring->ring_backup_entries_to_copy) { + amdgpu_fence_driver_force_completion(ring, &guilty_fence->base); + return; + } ring->reemit = true; amdgpu_ring_alloc(ring, ring->ring_backup_entries_to_copy); spin_lock_irqsave(&ring->fence_drv.lock, flags); -- 2.54.0