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 AF136606A31A for ; Wed, 2 Dec 2026 00:12:18 +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=k55rma/C Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 75C6E10EA88; Wed, 2 Dec 2026 00:12:13 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id E8EEE10E47E; Wed, 2 Dec 2026 00:12:07 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 4AA306117E; Wed, 2 Dec 2026 00:12:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAE7C1F00896; Wed, 2 Dec 2026 00:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796170327; bh=zPN38W7Q04rizmKoJuu8pTlAHWGKUNqzDs3akHYXHdw=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=k55rma/CQnpzNG7t1m9F/FcFDSBjhww4ASFOMKccIj6KhXjzQQssMUGuPwRfJe1XO fJAOE5OsEqnayYSbvQjvA9FabMy3XGfzj4PsbcUSELdgRZFjSuZigLaAoH0LgYNJYy qMaHNkx+I87WutrLsquQ4IRCt0yGSBy1lBLtE94CLjc2Rtt7/EOua43CYTgIiuG6o3 e/F9/P0SuDGW8YcGURHc88/H0+vRZnB4o5j6tiu4WM51HhoNVJwJSV7uuch0DgHF+i e/dqUMtjmFlg+jpNNxZkzFAjEvhB5hyhdOYTR73G1H1w9S3S91TgtTIv+E8bJSAKpg v6wJYMQYa8ZxQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 20/33] drm/xe: Add Kconfig.profile options for BO defrag configuration To: "Matthew Brost" , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org In-Reply-To: <20261201234915.3305331-21-matthew.brost@intel.com> References: <20261201234915.3305331-1-matthew.brost@intel.com> <20261201234915.3305331-21-matthew.brost@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 00:12:06 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" 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/xe: infinite loop in xe_bo_defrag_worker() via xe_bo_defrag_remove() -- commit 93a4dcdfe58d2b5b08f059f81feab1aae6bf5286 Author: Matthew Brost drm/xe: Add Kconfig.profile options for BO defrag configuration This commit adds Kconfig.profile options for the BO defragmentation size limit and worker intervals, and disables defragmentation when XE_BO_DEFRAG_SIZE_LIMIT is configured below 2M. > diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c > index 417a94432458b..9725c79af5f1f 100644 > --- a/drivers/gpu/drm/xe/xe_bo.c > +++ b/drivers/gpu/drm/xe/xe_bo.c [ ... ] > @@ -1332,7 +1353,7 @@ void xe_bo_defrag_resume(struct xe_device *xe) > */ > static bool xe_bo_defrag_supported(struct xe_device *xe) > { > - return !IS_VF_CCS_READY(xe); > + return XE_BO_DEFRAG_SIZE_LIMIT >=3D SZ_2M && !IS_VF_CCS_READY(xe); > } [ ... ] > @@ -1393,6 +1415,9 @@ static void xe_bo_defrag_remove(struct xe_bo *bo) > { > xe_bo_assert_held(bo); > =20 > + if (!xe_bo_defrag_supported(xe_bo_device(bo))) > + return; > + > if (list_empty(&bo->defrag_link)) > return; > =20 > @@ -1412,6 +1437,9 @@ static void xe_bo_defrag_update(struct xe_bo *bo) > { > xe_bo_assert_held(bo); > =20 > + if (!xe_bo_defrag_supported(xe_bo_device(bo))) > + return; > + > if (xe_bo_needs_defrag(bo)) > xe_bo_defrag_add(bo); > else [Severity: Medium] Can the xe_bo_defrag_supported() early returns in xe_bo_defrag_remove() and xe_bo_defrag_update() trap a BO on xe->mem.defrag.list and cause xe_bo_defrag_worker() to spin forever? xe_bo_defrag_supported() also checks !IS_VF_CCS_READY(xe). During xe_device_probe(), drm_dev_register() and xe_display_register() run before xe_sriov_init_late() sets xe->sriov.vf.ccs.initialized =3D 1, so a BO can be queued onto xe->mem.defrag.list while IS_VF_CCS_READY(xe) is still false. Once IS_VF_CCS_READY(xe) becomes true, xe_bo_needs_defrag(bo) returns false in xe_bo_defrag_one(), which calls xe_bo_defrag_remove(bo) to unlink the he= ad BO and returns ret =3D 0, consumed =3D 0, and needs_more =3D false. Because xe_bo_defrag_remove() now returns early without unlinking bo->defrag_link, the while (defrag_bytes < XE_BO_DEFRAG_SIZE_LIMIT) loop in xe_bo_defrag_worker() repeats indefinitely on the same head BO. Since xe_bo_needs_defrag() already checks xe_bo_defrag_supported(), could these two early returns check XE_BO_DEFRAG_SIZE_LIMIT < SZ_2M directly (or = be dropped from xe_bo_defrag_remove()) so already-queued BOs can still be unlinked? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201234915.3305= 331-1-matthew.brost@intel.com?part=3D20