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 D9B1B606A323 for ; Wed, 2 Dec 2026 11:40:53 +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=g1BeXH9Q Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 75259112141; Wed, 2 Dec 2026 11:40: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 8BFD5112142 for ; Wed, 2 Dec 2026 11:40: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 1166A6245C; Wed, 2 Dec 2026 11:40:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A40591F00896; Wed, 2 Dec 2026 11:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796211641; bh=zk+ysXfCnUl/Q7xcOkAOJcQo2fpV7EHL22taIv2fUD0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=g1BeXH9QNHBi0QxHhKle/Wime+2T9DAPkFDl+MDVlgwR6hYw4PhvRxQIfADzDMp3k MtXY2VBzynpCE1nP/1EeHucyrat7bZhGyQJY9cbcKSjMcAMmUf0uSQbPhjHmcHnZhu 07/6dHK6y6YTY1BabJsD6hh8l4BbkvWizFq0vaEpHszjPpVoTBmd/HrJlj6Yg8JFQq 4AB8fqW1m2yuzhgHOslo8inJ7l2qKpL6DksU1g3DbbY6JfX/lhPkLjR5VbGJjAlz1g 9ReUnhKbeJgsILKvp40y60lTbtqO10jJPzSgJugEWvR7z+y7VOz9EfrSWsd8UAknzk zZeImGSYchz6g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/amdgpu: Check errors before releasing the SPM VMID To: "Srinivasan Shanmugam" Cc: amd-gfx@lists.freedesktop.org In-Reply-To: <20261202113037.1806655-2-srinivasan.shanmugam@amd.com> References: <20261202113037.1806655-1-srinivasan.shanmugam@amd.com> <20261202113037.1806655-2-srinivasan.shanmugam@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 11:40:39 +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=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, 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: - [Medium] drm/amdgpu: dead error checks on uninterruptible waits in amdgpu_vm_ioctl() -- commit 1c20d0b2a4030e6c94419ccf8d5459e64734db54 Author: Srinivasan Shanmugam drm/amdgpu: Check errors before releasing the SPM VMID This commit checks the return values of amdgpu_bo_reserve() and dma_resv_wait_timeout() in the AMDGPU_VM_OP_UNRESERVE_VMID path of amdgpu_vm_ioctl() before releasing the SPM VMID. > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd= /amdgpu/amdgpu_vm.c > index 94b1cfe05e3e0..8031d3072bcdf 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c > @@ -3027,13 +3027,24 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void = *data, struct drm_file *filp) > } > case AMDGPU_VM_OP_UNRESERVE_VMID: { > struct amdgpu_bo *root =3D vm->root.bo; > + long wait; > + int r; > + > + r =3D amdgpu_bo_reserve(root, true); > + if (r) > + return r; > =20 > - amdgpu_bo_reserve(root, true); > /* Wait for the jobs which might still use the reserved VMID */ > - if (vm->reserved_vmid[AMDGPU_GFXHUB(0)]) > - dma_resv_wait_timeout(root->tbo.base.resv, > - DMA_RESV_USAGE_READ, false, > - MAX_SCHEDULE_TIMEOUT); > + if (vm->reserved_vmid[AMDGPU_GFXHUB(0)]) { > + wait =3D dma_resv_wait_timeout(root->tbo.base.resv, > + DMA_RESV_USAGE_READ, false, > + MAX_SCHEDULE_TIMEOUT); > + if (wait <=3D 0) { > + amdgpu_bo_unreserve(root); > + return wait < 0 ? (int)wait : -ETIME; > + } > + } [Severity: Medium] Can either of these error checks ever trigger while both calls use uninterruptible waits? amdgpu_bo_reserve(root, true) passes no_intr =3D true to ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL), which calls dma_resv_lock() with no ticket and always returns 0. Likewise, dma_resv_wait_timeout(..., false, MAX_SCHEDULE_TIMEOUT) sleeps uninterruptibly with no timeout and always returns MAX_SCHEDULE_TIMEOUT. If this ioctl should abort on a signal so userspace can retry, amdgpu_bo_reserve(root, false) and dma_resv_wait_timeout(..., true, MAX_SCHEDULE_TIMEOUT) would be needed. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202113037.1806= 655-2-srinivasan.shanmugam@amd.com?part=3D1