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 A8F7E606A322 for ; Wed, 2 Dec 2026 23:54:10 +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=XSm8ZB2C Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C845112660; Wed, 2 Dec 2026 23:54:05 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FFCC11264A; Wed, 2 Dec 2026 23:53:59 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id F0DB142B7C; Wed, 2 Dec 2026 23:53:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B86791F000C1; Wed, 2 Dec 2026 23:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796255638; bh=BiP+vxWgXqC2EVX/um9zj6Jnhp3ERy2ieBZGevSyTLo=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=XSm8ZB2CbPRo9I2PuoeERcJ3XAE4+YQmsJGpaD34QmZA0yYglJ4KtcnzUzy8b3DKO TAc7Qyd7AemNoEeF0v5gAWlcc72pz6NE7KYicXmHHvPLyYGq2Od1NcIv7qoO2ogeUQ B/H0CPugdfVH1PiExPi4ztBhPfgZWf9DwqwD+ExUggX2ZsihIMmGl7nOrZfPOk8Sxa KpA21qRi9OEaSsLC7gVrdhOnQzMgpwJ2rAw5cAIsV7haLr4j+9yzQjFN/M9cKjvm+K NYdx15QGuNrVslmCS+0ntlt7J1yZR4bhr9HdjP3YHZcbZIbeaRSUeZdUnu2+eGHuGi kbXk4pzWE7QeA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 14/36] drm/xe: Track BOs backed at a sub-optimal page order To: "Matthew Brost" , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org In-Reply-To: <20261202233323.3743190-15-matthew.brost@intel.com> References: <20261202233323.3743190-1-matthew.brost@intel.com> <20261202233323.3743190-15-matthew.brost@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 23:53:58 +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: no-op xe_bo_defrag_update() on CPU fault in xe_bo_fault_migrate() -- commit 22495e3a9f5a9f486e4a553586605bb281ab160e Author: Matthew Brost drm/xe: Track BOs backed at a sub-optimal page order This commit adds per-device tracking for buffer objects whose backing TT pages were allocated below the pool's beneficial order so they can be candidates for future defragmentation. > diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c > index ff5610ba4b740..98c0b32e95439 100644 > --- a/drivers/gpu/drm/xe/xe_bo.c > +++ b/drivers/gpu/drm/xe/xe_bo.c [ ... ] > +static bool xe_bo_needs_defrag(struct xe_bo *bo) > +{ > + struct ttm_buffer_object *ttm_bo =3D &bo->ttm; > + struct ttm_tt *tt =3D ttm_bo->ttm; > + > + xe_bo_assert_held(bo); > + > + return xe_bo_defrag_supported(xe_bo_device(bo)) && > + ttm_bo->type =3D=3D ttm_bo_type_device && tt && > + !xe_bo_madv_is_dontneed(bo) && > + ttm_tt_is_populated(tt) && > + ttm_tt_is_beneficial_order_failed(tt) && > + ttm_bo->resource && ttm_bo->resource->mem_type =3D=3D XE_PL_TT && > + !xe_bo_is_pinned(bo); > +} [ ... ] > @@ -2245,9 +2379,14 @@ static int xe_bo_fault_migrate(struct xe_bo *bo, s= truct ttm_operation_ctx *ctx, > int err =3D 0; > =20 > if (ttm_manager_type(tbo->bdev, tbo->resource->mem_type)->use_tt) { > + bool populated =3D tbo->ttm && ttm_tt_is_populated(tbo->ttm); > + > err =3D xe_bo_wait_usage_kernel(bo, ctx); > - if (!err) > + if (!err) { > err =3D ttm_bo_populate(&bo->ttm, ctx); > + if (!err && !populated) > + xe_bo_defrag_update(bo); > + } > } else if (should_migrate_to_smem(bo)) { [Severity: Medium] Can xe_bo_defrag_update(bo) ever add a BO to xe->mem.defrag.list from xe_bo_fault_migrate()? Any BO resident in XE_PL_TT is already populated before xe_bo_move() runs, and all shrink, swapout and deferred-backing paths leave unpopulated BOs in XE_PL_SYSTEM. When !populated is true here, tbo->resource->mem_type is always XE_PL_SYSTEM, and ttm_bo_populate() populates tbo->ttm in place without changing the resource's mem_type. Because xe_bo_needs_defrag() requires ttm_bo->resource->mem_type =3D=3D XE_PL_TT, BOs populated on a CPU page fault at a sub-optimal order will never be added to the defrag list. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202233323.3743= 190-1-matthew.brost@intel.com?part=3D14