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 C7320606A31A for ; Wed, 2 Dec 2026 00:09:33 +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=NEkAu5zs Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 368BD10EAAC; Wed, 2 Dec 2026 00:09:28 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1936010E473; Wed, 2 Dec 2026 00:09:22 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 2DD93609D0; Wed, 2 Dec 2026 00:09:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3BE31F00899; Wed, 2 Dec 2026 00:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796170160; bh=y1iD7jDUILWxUqYOjSMo5bfk8/Xg1OVXGgWCFwHdWFc=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=NEkAu5zssMA/hmrwGOTPTp76mkypRb94S92GYz1bYsJNVeHiptC6ArL3x5FAG0kXW HQ8rbu0IfBa2QE0dlLyyg60rdcgEjvkz8KtPeU6o8Ikx9CF0VHtM17RyNCTqukU+dM AmAxwD8Mo9lcLIFU8htEmrPv15kd9WK7IY+tqz72RvlttquAFJbLQZkKo7ziwG7eJw 4hgpPcidWgcbuE5HHUfkECaDfSd+pzZ5K0gOYt5IrOxWViFcqCwowLlEiuZHhVM/eh JF+cgAgkr9ElV2sEy3MZaeG6oVMeGwCEotcxDLnFQVcSS1pKIvzM80tJ3N+FGKRr58 MJa6bHOBQQJ2g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 22/33] drm/xe: Add defrag profiling tracepoints To: "Matthew Brost" , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org In-Reply-To: <20261201234915.3305331-23-matthew.brost@intel.com> References: <20261201234915.3305331-1-matthew.brost@intel.com> <20261201234915.3305331-23-matthew.brost@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 00:09:20 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" 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=unavailable 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 3 potential issues to consider: - [Low] drm/xe: unrecorded prealloc_ns on prealloc failure in xe_bo_defrag_one() - [Low] drm/xe: pp.used reported as prealloc_got in xe_bo_defrag_one() - [Low] drm/xe: stale defrag list count in commit message for xe_bo_defrag_worker -- commit f97722e4a0d752cd989b7efdb616666e3ebcab5f Author: Matthew Brost drm/xe: Add defrag profiling tracepoints This commit adds the xe_bo_defrag_worker and xe_bo_defrag_one tracepoints to profile the page defragmentation worker and per-BO defragmentation stages. > - xe_bo_defrag_worker: emitted on worker entry and exit with the > current defrag list count and the bytes processed in the run. [Severity: Low] This isn't a bug, but the commit description still mentions the defrag list count, which was dropped from xe_bo_defrag_worker in v4. > diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c > index 3ea90cfb27e41..0697d395d2ba3 100644 > --- a/drivers/gpu/drm/xe/xe_bo.c > +++ b/drivers/gpu/drm/xe/xe_bo.c [ ... ] > @@ -1504,6 +1508,7 @@ static int xe_bo_defrag_one(struct xe_device *xe, s= truct xe_bo *bo, > =20 > /* Phase 2: preallocate outside the lock; */ > if (want) { > + t0 =3D ktime_get(); > ret =3D ttm_pool_prealloc_fill(pool, tt_caching, &pp, want); > if (ret || !pp.count) { > ret =3D ret ?: -ENOMEM; > @@ -1511,12 +1516,16 @@ static int xe_bo_defrag_one(struct xe_device *xe,= struct xe_bo *bo, > XE_GT_STATS_ID_DEFRAG_FAILED_COUNT, 1); > goto out_err; > } > + prealloc_ns =3D ktime_to_ns(ktime_sub(ktime_get(), t0)); > } [Severity: Low] Should prealloc_ns be recorded before checking ret || !pp.count? When ttm_pool_prealloc_fill() fails to allocate any beneficial-order pages, jumping to out_err skips the timestamp calculation and trace_xe_bo_defrag_one() reports prealloc_us=3D0, hiding the time spent in failed allocation attempts. [ ... ] > @@ -1572,9 +1581,13 @@ static int xe_bo_defrag_one(struct xe_device *xe, = struct xe_bo *bo, > =20 > unlock: > xe_bo_unlock(bo); > + lock_ns =3D ktime_to_ns(ktime_sub(ktime_get(), t0)); > + got =3D pp.used; > out_err: > ttm_pool_prealloc_fini(pool, &pp); > out: > + trace_xe_bo_defrag_one(bo, budget, want, got, lock_ns, prealloc_ns, > + lockwait_ns, *consumed, ret); > return ret; > } [Severity: Low] Should got be assigned pp.count rather than pp.used? pp.count holds the number of chunks preallocated by ttm_pool_prealloc_fill(), whereas pp.used is the number of chunks consumed during ttm_bo_validate(). If the Phase 3 xe_bo_needs_defrag(bo) re-check jumps to unlock or ttm_bo_validate() fails before consuming all preallocated pages, trace_xe_bo_defrag_one() reports 0/want (or the partially consumed count) as the prealloc fill ratio even though preallocation succeeded. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201234915.3305= 331-1-matthew.brost@intel.com?part=3D22