From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C038606A31C for ; Mon, 30 Nov 2026 16:57:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q8KEzizR Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD70D10E93A; Mon, 30 Nov 2026 16:57:48 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E2EF10F2AD for ; Mon, 30 Nov 2026 16:57:42 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 74B13620A8; Mon, 30 Nov 2026 16:57:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6E9D1F00896; Mon, 30 Nov 2026 16:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796057861; bh=90BefHL2yNmOXz1Fx9cpF5RAVqUEj1tDAQxXnvqkQQQ=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=Q8KEzizRhW16K2M4+MwWRsGAru3AXuPNwNbbwN9E3MXHAJJU32FqdJmnHB5+MiZ+n jfDBZIfZHBpANTGoN2IMzVDsl0+AfRovoGz8ZJivR3q4EOxQhdS5m3nVEJp4X3DfDM BNR2NerM0yFqQAOTGYhTgGDELwacMBHlTsRLuGMMXpAeN0S7wB2eq3QXR27vUc+v7l b5JdbKdiv7sONSuY5NjevvrrLkuOEGbKKkJkoYFzi7yXVFk3w/KAtqMfRiLxUCTIj3 9kX0M3mPtF2Jhf4zR/vTHnOE+YtRdZLuQw+7qHnYVsDBP7Q3Nt/0hzw/NPUik5P0pC Yc2Tj3BopeQKQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/amdgpu: allow sparse UALink accelerator IDs in pPod validation To: "Mukul Joshi" , amd-gfx@lists.freedesktop.org In-Reply-To: <20261130164746.479120-1-mukul.joshi@amd.com> References: <20261130164746.479120-1-mukul.joshi@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 16:57:40 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "amd-gfx" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/amdgpu: missing Fixes: trailer for sparse UALink accel_id validation fix It also noticed 1 related pre-existing issue this patch does not introduce: - [High] drm/amdgpu: missing error-state check in __check_local_vpod_integrity() [1] -- commit 96f45a4c14545b259b124ee1e846265658479441 Author: Mukul Joshi > drm/amdgpu: allow sparse UALink accelerator IDs in pPod validation > > The pPod size reported by PSP is the number of GPUs in the physical > pod, not an upper bound on accelerator IDs. Accelerator IDs can be > sparse, e.g. a 1-plane/2-GPU-per-node AFM config reports a pPod size > of 4 for accelerator IDs 0, 1, 4 and 5. > > Both __check_ppod_info() and check_ppod_state() rejected any > accelerator ID >=3D pPod size, leaving accelerators 4 and 5 stuck in > the unconfigured state. Bound the accelerator ID by > AMDGPU_UALINK_ACCEL_MAX instead, which matches the size of the > per-accelerator bitmaps. > > Signed-off-by: Mukul Joshi [Severity: Low] This fixes a bug where sparse accelerator IDs remain stuck in the unconfigured state. Should it include Fixes: tags for the commits that introduced the ppod.size bounds checks in __check_ppod_info() and check_ppod_state()? Fixes: 0e8eb0dcea51 ("drm/amdgpu: Assign accel state based on ASP config") Fixes: 61273d11eee2 ("drm/amdgpu: Add sysfs API for UALink physical pod s= etup") > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm= /amd/amdgpu/amdgpu_ualink.c > index fa4c3d27d2720..46e93c4f6236b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c > @@ -112,10 +112,11 @@ static bool __check_ppod_info(struct amdgpu_device = *adev, > ppod->size, AMDGPU_UALINK_ACCEL_MAX); > return false; > } > - if (ppod->accel_id >=3D ppod->size) { > + /* pPod size is a GPU count; accelerator IDs may be sparse. */ > + if (ppod->accel_id >=3D AMDGPU_UALINK_ACCEL_MAX) { > dev_dbg(adev->dev, > - "Accelerator ID %u greater or equal pPod size %u\n", > - ppod->accel_id, ppod->size); > + "Accelerator ID %u out of range [0..%u)\n", > + ppod->accel_id, AMDGPU_UALINK_ACCEL_MAX); > return false; > } [Severity: High] This problem wasn't introduced by this patch, but can __check_local_vpod_integrity() [1] read out of bounds on info->vpod.active_accel_bits when a peer is in AMDGPU_UALINK_ACCEL_STATE_ERROR? drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c:__check_local_vpod_integrity() { ... if (peer_info->accel_state < AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) { ... return -EAGAIN; } accel_id =3D peer_info->ppod.accel_id; if (!test_bit(accel_id, info->vpod.active_accel_bits)) continue; ... } In enum amdgpu_ualink_accel_state, AMDGPU_UALINK_ACCEL_STATE_ERROR (5) is greater than AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED (1). If a peer enters AMDGPU_UALINK_ACCEL_STATE_ERROR before its pPod configuration is validated (for example, when psp_ual_query_info() fails in amdgpu_ualink_config_update_handler()), peer_info->ppod.accel_id stays at its initial value of 0xffffffff, which __check_local_vpod_integrity() then passes to test_bit() on the 256-bit active_accel_bits bitmap. [1] https://sashiko.dev/#/bug/linux-70b01f66-1fb6-4cfd-b1b5-9e69e35e868d --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130164746.4791= 20-1-mukul.joshi@amd.com?part=3D1