Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2CDACD6E4A for ; Thu, 4 Jun 2026 16:07:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E4B511A161; Thu, 4 Jun 2026 16:07:00 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="nE3JVt9I"; dkim-atps=neutral Received: from lankhorst.se (unknown [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F51C11A15B for ; Thu, 4 Jun 2026 16:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1780589217; bh=3MrApgZ57FjRh3lnoNV+xerQ7wOMAlFqXNTv6oWhkc0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nE3JVt9IuKhrsLtF35Cq2MO57RcGmSn98qcR/fN9zinaSnzr6QBYJTlGcJacp3vKg G+f/O6/iVvOAIG8AFnJEhOAAzho8Ns6gyz8VV9AxBKqOrqQ291QpBonCpRU3jFZoIi lws+JlSv+kgmsY1BRl+4zVDWtgap7lhOexBUhiUXzOKFh+mmEeNAI8yYrtjt4Pta8Q 6mR0aw4B/ZuIRiCG8Y28RJ9ACu/QdVhV/oAGeXaIl7KdnqvU8PX1D4PjyxKYdKg3mT guN/WyIJQYzx0Xnw/yaBfbcd/WAiDOH9IzJHq0WWTcHR7OqXv7A+qnrqBdPyYUYX0X bgkr9v7TZML2Q== From: Maarten Lankhorst To: intel-xe@lists.freedesktop.org Subject: [CI 05/24] drm/xe: Update xe_bo_put_deferred arguments to include writeback flag Date: Thu, 4 Jun 2026 18:06:34 +0200 Message-ID: <20260604160655.50036-6-dev@lankhorst.se> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260604160655.50036-1-dev@lankhorst.se> References: <20260604160655.50036-1-dev@lankhorst.se> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" From: Matthew Brost Update the xe_bo_put_deferred arguments to include a writeback flag, which indicates whether the BO was added to the deferred list. This is useful when the caller needs to take additional actions after the BO has been queued for deferred release. Signed-off-by: Matthew Brost Reviewed-by: Francois Dugast Link: https://patch.msgid.link/20260228013501.106680-6-matthew.brost@intel.com Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/xe/xe_bo.h | 10 ++++++++-- drivers/gpu/drm/xe/xe_drm_client.c | 2 +- drivers/gpu/drm/xe/xe_pt.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h index 6340317f7d2e6..dee2a5524039c 100644 --- a/drivers/gpu/drm/xe/xe_bo.h +++ b/drivers/gpu/drm/xe/xe_bo.h @@ -492,6 +492,8 @@ void __xe_bo_release_dummy(struct kref *kref); * @bo: The bo to put. * @deferred: List to which to add the buffer object if we cannot put, or * NULL if the function is to put unconditionally. + * @added: BO was added to deferred list, written back to caller, can be NULL if + * writeback is not needed. * * Since the final freeing of an object includes both sleeping and (!) * memory allocation in the dma_resv individualization, it's not ok @@ -511,7 +513,8 @@ void __xe_bo_release_dummy(struct kref *kref); * false otherwise. */ static inline bool -xe_bo_put_deferred(struct xe_bo *bo, struct llist_head *deferred) +xe_bo_put_deferred(struct xe_bo *bo, struct llist_head *deferred, + bool *added) { if (!deferred) { xe_bo_put(bo); @@ -521,6 +524,9 @@ xe_bo_put_deferred(struct xe_bo *bo, struct llist_head *deferred) if (!kref_put(&bo->ttm.base.refcount, __xe_bo_release_dummy)) return false; + if (added) + *added = true; + return llist_add(&bo->freed, deferred); } @@ -537,7 +543,7 @@ xe_bo_put_async(struct xe_bo *bo) { struct xe_bo_dev *bo_device = &xe_bo_device(bo)->bo_device; - if (xe_bo_put_deferred(bo, &bo_device->async_list)) + if (xe_bo_put_deferred(bo, &bo_device->async_list, NULL)) schedule_work(&bo_device->async_free); } diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c index 84b66147bf494..45efe7a554276 100644 --- a/drivers/gpu/drm/xe/xe_drm_client.c +++ b/drivers/gpu/drm/xe/xe_drm_client.c @@ -246,7 +246,7 @@ static void show_meminfo(struct drm_printer *p, struct drm_file *file) xe_assert(xef->xe, !list_empty(&bo->client_link)); } - xe_bo_put_deferred(bo, &deferred); + xe_bo_put_deferred(bo, &deferred, NULL); } spin_unlock(&client->bos_lock); diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c index 37970124386cd..a627b1aaeb856 100644 --- a/drivers/gpu/drm/xe/xe_pt.c +++ b/drivers/gpu/drm/xe/xe_pt.c @@ -213,7 +213,7 @@ void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred) XE_WARN_ON(!list_empty(&pt->bo->ttm.base.gpuva.list)); xe_bo_unpin(pt->bo); - xe_bo_put_deferred(pt->bo, deferred); + xe_bo_put_deferred(pt->bo, deferred, NULL); if (pt->level > 0 && pt->num_live) { struct xe_pt_dir *pt_dir = as_xe_pt_dir(pt); -- 2.53.0