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 A5ED2606A32C for ; Wed, 2 Dec 2026 23:55:56 +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=Qbg7Lz+j Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EAF7112696; Wed, 2 Dec 2026 23:55:51 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id E4021112696; Wed, 2 Dec 2026 23:55:44 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id AF0854576F; Wed, 2 Dec 2026 23:55:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 773FB1F00893; Wed, 2 Dec 2026 23:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796255744; bh=pWQNe/B7XHoloGemwFClIKINgjPgJPms8b9EWBVGbcI=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=Qbg7Lz+j2xy9spQuDJ8A+YREwexW7JBGfANXv3bK+EfTng6s37t513JaLGLtF3Foq NPtdiBQeAst0EzrddWi5jqsb9xpgV+O6bRiYDRfTgIrk6xYVkDgkBfF/EH/z7GgMxX elLMZ7zI5+ZR8MA4VXQLHVtiGUq7aPgTMR0qJoJR1qaP2kUDTYUZiCNR7iXFd5J583 3J55cPyUXfCBL6ISNb99+b2yhnUD+H7ooylTqVCBTT8PKty+7a9lTkNDtdiPBCgRkk dX0MSju8j5P6vWbR3B+7iwUd11HOa3eotNCfGJmB4zLrRij+4bU7OPcSRd3MZQDRPK lDXGoeaDSQxRw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 16/36] drm/xe: Handle defrag moves in xe_bo_move() To: "Matthew Brost" , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org In-Reply-To: <20261202233323.3743190-17-matthew.brost@intel.com> References: <20261202233323.3743190-1-matthew.brost@intel.com> <20261202233323.3743190-17-matthew.brost@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 23:55:44 +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 1 potential issue to consider: - [High] drm/xe: loss of FlatCCS extra TT pages on DGFX defrag in xe_bo_move() -- commit fb1ace888ac8c6157078a250c431da6e90c2457a Author: Matthew Brost drm/xe: Handle defrag moves in xe_bo_move() This commit updates xe_bo_move() to handle defragmentation moves by copying data from the BO's stashed defrag_old_tt to the newly allocated backing via xe_migrate_copy_defrag(). > diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c > index 98c0b32e95439..4c735ec8754ea 100644 > --- a/drivers/gpu/drm/xe/xe_bo.c > +++ b/drivers/gpu/drm/xe/xe_bo.c > @@ -1291,6 +1291,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm= _bo, bool evict, > bool move_lacks_source; > bool tt_has_data; > bool needs_clear; > + bool has_defrag_old_tt =3D !!ttm_bo->defrag_old_tt; > bool handle_system_ccs =3D (!IS_DGFX(xe) && xe_bo_needs_ccs_pages(bo) && > ttm && ttm_tt_is_populated(ttm)) ? true : false; > int ret =3D 0; [ ... ] > @@ -1463,6 +1474,12 @@ static int xe_bo_move(struct ttm_buffer_object *tt= m_bo, bool evict, > =20 > fence =3D xe_migrate_clear(migrate, bo, new_mem, flags, > ctx->interruptible); > + } else if (has_defrag_old_tt) { > + struct xe_ttm_tt *old_xe_tt =3D > + container_of(ttm_bo->defrag_old_tt, struct xe_ttm_tt, ttm); > + > + fence =3D xe_migrate_copy_defrag(migrate, bo, old_mem, new_mem, > + old_xe_tt->sg, handle_system_ccs); > } else { > fence =3D xe_migrate_copy(migrate, bo, bo, old_mem, new_mem, > handle_system_ccs, ctx->interruptible); [Severity: High] Does this lose the saved FlatCCS pages when defragmenting an evicted VRAM BO on DG2? On discrete GPUs with FlatCCS and GRAPHICS_VER(xe) < 20 (DG2), a compressible VRAM-only BO evicted to XE_PL_TT stores its saved FlatCCS state in extra TT pages starting at xe_bo_ccs_pages_start(bo), and xe_bo_needs_defrag() admits that evicted BO for defragmentation when ttm_tt_is_beneficial_order_failed(tt) is set. During the defrag move, handle_system_ccs is false because IS_DGFX(xe) is true, and xe_migrate_copy_defrag() only copies [0, xe_bo_size(bo)), leaving any newly reallocated 2 MB chunk overlapping the trailing extra CCS pages in bo->ttm uninitialized. When the BO is later validated back to VRAM, corrupted FlatCCS metadata is restored. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202233323.3743= 190-1-matthew.brost@intel.com?part=3D16