From nobody Sun May 24 20:34:04 2026 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 0ADDD3D9686 for ; Thu, 21 May 2026 13:35:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779370544; cv=none; b=fxS3tr9mr9dp/kZjKJIQdwQaAjW2b4xAhSOGn/Hb8sVckF39iKDXsSOuFrSuN7Pf/XaZmh0WtNidXKUOFxI6GIkTbuXR8gZ44wBFziQLGL+yo9qreyGMO36jfazS0C/M1BvTBljesWkIAge0dNiO6KqZmFnFkfZnz7j7iN8loew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779370544; c=relaxed/simple; bh=0QQ1tf/5iZrILPHSQ6O/g0AyZrpTOK+hj0YghnnObYA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=ho+59/g71tTpUntNnqc25/2bYXzNyrRn1rCH7nsqybkqhhSZaYoHCjW2D0F8z39nO54qNQI+E1KZfM2KnQ5haLFH5YG8B7d4o1gd7PEVwppF4haCUG8ncyy1ZEjbBrP1LLlqvHAuViecGa0HR0UGJ3UMSi38GAPv8wiLLl9lQak= 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=Ixbx/jbV; arc=none smtp.client-ip=209.85.210.179 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="Ixbx/jbV" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-83ea84df1d0so1973115b3a.2 for ; Thu, 21 May 2026 06:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779370542; x=1779975342; 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=BIK/4TSUzg+Gt9duY3olQGpqAgCO2S6UZFsGeUBiZ8Q=; b=Ixbx/jbVwtymOX0lf0qkgA4B/Y+jYUrwgG+sv3fwGen53TXqXoMXxTSgv2qXzA2P/w PDAe/HoAbZjGYR9FxvvYg/y+nhe10o9m2cxsJplDjLFFl+tt+3mHESObTc8qSpyR3A/1 npDYbT1U79kEZQ3arnduTU2+PcnX8TdWbNG+CvZKeX6TU5Rg1JohH+arq9FXCGCqOT99 tcqQGtXR1F4LUBjqyUwr2uOSReYOfZnC4UYT6s47cXnjMQ2X4hkkf9AcnFj0De0VlB3Y W0VAo3czotoZLEVq+Q0rC89yu32nbV1PRDORI/J4ncEB24v9BsCpqGXfZlcsjFvZJlGU ymqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779370542; x=1779975342; 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=BIK/4TSUzg+Gt9duY3olQGpqAgCO2S6UZFsGeUBiZ8Q=; b=DEoI9YGTucV/DVh9n/lMhaqP+8fDD4ywurxGpbsUshfF2OwpNZEfehUybqceKQbrSh ov/7AV7dQS1/XQPYXQnC67kyF+F06cv+D9xDY4Geve2eHAsVBviVHYXBArwumBeupcpG OvwjRopDKZRWxQTXxzEWri9GIdqUXTOf0YXyOMvnqrf8RyaJRhEaIpGtWohqlyXXWuLR y9ac0Js+sbhJBvaeUjyVGrpfc9Rx2KIyP/0nW1ro6cc3207BP2HCLdgO4dzDQkB1iyYS KeLUPqCprIHFEwLOjuNis/lAxhFYG26B2RSi+h1Mp1vAu6Bz4OQ12XPrsSaJVFSle5d1 2Row== X-Forwarded-Encrypted: i=1; AFNElJ+34urLOrqJTt01V/vEkoSPkdeR1q81pNscZd4QcRrJHzZnfDEf3oRf8RcG26BrypmZPT7Q3RyM0cJrikQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyqArZc+GXQkHKmhMSIPdfi8jzsq8QaTJNzRfnvpj207fEAOBt6 Ek+LD1bBm2M0ibvfaha7QQxkh38DGJAkD1Z9GI6WFrm44H+Iv0Z+NuOd X-Gm-Gg: Acq92OHjFVesYukT+pE0Sh3L6m4UzZa0HylvqygtzAUOD5ZWqU92hgJCnzZJsSC9GNO YQhT7BrWSaVS+5eDjui9m0fVuJ6q+VAud+BwQs/94/T5PSah9G2A47CNrzbQwHXAnkRhWtlX0S3 7b2T7IbHswbcP/55uH55QQGbnKf7a1kZZ2lGy27eJN2jv/ov+hrOIr5OPTa4qCnyAu7sgnGx9Tw YTtDfKzhwnNSlzSv3oOMIbqa8E4XdkzHwp7cRxeAAnzVuZqnhPIC5bJN/LnDF706VjaoKXO0eIA DZw3NficbDU+ok36x3KP9VTbPkFnGLRNa9JDdgz3OcsJeX0R2FymcXSsb4h1VvaFu2+TOUuTOsF Viec3IUGmKohLlOR4WsOU0ZRY9UVlz/1sxiP5dP9Z/ZS2TUeIgySUlzV/cm2WP4B7LJFFD8QJvZ oZgUSKQ77tjbgSwWvamLba8ggPykCj/jktFis6/5keWFZWryBs8+sGrXmW+h0= X-Received: by 2002:a05:6a00:950e:b0:835:3f51:72fb with SMTP id d2e1a72fcca58-8414ac893c1mr3157356b3a.12.1779370542273; Thu, 21 May 2026 06:35:42 -0700 (PDT) Received: from csl-conti-dell7858.ntu.edu.sg ([155.69.195.57]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84154b1bfc1sm1286174b3a.26.2026.05.21.06.35.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 06:35:41 -0700 (PDT) From: Maoyi Xie To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: David Airlie , Simona Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amdgpu: remove dead empty checks in ring_mux ib_mark_offset and end_ib Date: Thu, 21 May 2026 21:35:37 +0800 Message-Id: <20260521133537.3438468-1-maoyixie.tju@gmail.com> X-Mailer: git-send-email 2.34.1 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="utf-8" Content-Transfer-Encoding: quoted-printable amdgpu_ring_mux_ib_mark_offset() and amdgpu_ring_mux_end_ib() read e->list with list_last_entry() and then test the returned pointer against NULL. list_last_entry() never returns NULL. On an empty list it returns container_of(&e->list, struct amdgpu_mux_chunk, entry), which is an aliased pointer derived from the list head. The "cannot find chunk!" error path is dead code. These callsites run on the software ring submission path, after amdgpu_ring_mux_start_ib() has linked a fresh chunk into e->list. By the IB API contract, mark_offset and end_ib only execute between start_ib and the chunk's removal in scan_and_remove_signaled_chunk(), so e->list is non-empty at the read. The defensive check is misleading and never fires. Drop the dead block on both sites. The list_last_entry() read stays. If a future change broke the precondition, callers would crash on the aliased pointer, which is louder than the current silent error log and easier to debug. Suggested-by: Christian K=C3=B6nig Signed-off-by: Maoyi Xie --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c b/drivers/gpu/drm= /amd/amdgpu/amdgpu_ring_mux.c index 6e64a96fa285..83d62d9f76d4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c @@ -495,10 +495,6 @@ void amdgpu_ring_mux_ib_mark_offset(struct amdgpu_ring= _mux *mux, } =20 chunk =3D list_last_entry(&e->list, struct amdgpu_mux_chunk, entry); - if (!chunk) { - DRM_ERROR("cannot find chunk!\n"); - return; - } =20 switch (type) { case AMDGPU_MUX_OFFSET_TYPE_CONTROL: @@ -528,10 +524,6 @@ void amdgpu_ring_mux_end_ib(struct amdgpu_ring_mux *mu= x, struct amdgpu_ring *rin } =20 chunk =3D list_last_entry(&e->list, struct amdgpu_mux_chunk, entry); - if (!chunk) { - DRM_ERROR("cannot find chunk!\n"); - return; - } =20 chunk->end =3D ring->wptr; chunk->sync_seq =3D READ_ONCE(ring->fence_drv.sync_seq); --=20 2.34.1