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 6879DCD6E7C for ; Thu, 4 Jun 2026 17:15:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 177D011A1E0; Thu, 4 Jun 2026 17:15:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=lankhorst.se header.i=@lankhorst.se header.b="Ccz3+q85"; dkim-atps=neutral Received: from lankhorst.se (unknown [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1309711A1DE for ; Thu, 4 Jun 2026 17:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lankhorst.se; s=default; t=1780593303; bh=8BawDQl2DiE3EM3kNjVM/GrjzjOlFKpDNvf2O2IB5sM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ccz3+q85KB0QhfwHC0f4icc/HJ2WZFCl+KAHh/mgbLZ7+jycZArou+HHqQjD3qRRI bUKUW4WJFqgs2LBSfzaZn9Ph9UZxjXWKaA3DMn0Gu6jHyF9FdMs3bDxrSyp1ejMW1w B/eQRZCYo5HrI9RkpNcZmvpVspUiHHqj8s6EoPMremuX2TKgNOZ+eNYxWMdndBzmQ4 xTdNB9BNs/vJS7Ld5ZS7Jjb1wz8B2daFqLG22LPJ2lg1cTZpuLEctTlwO9GqqqgtOP IK5XD6UVVyYVz4UfRwNvOWWMTNcBNOykhQF10ZPNYNTL0smoaC8M2Wqu9XGDQYMciL eGreW9hVIRGPw== From: Maarten Lankhorst To: intel-xe@lists.freedesktop.org Subject: [CI v2 05/24] drm/xe: Update xe_bo_put_deferred arguments to include writeback flag Date: Thu, 4 Jun 2026 19:14:41 +0200 Message-ID: <20260604171502.84047-6-dev@lankhorst.se> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260604171502.84047-1-dev@lankhorst.se> References: <20260604171502.84047-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 dc7d74c889a1d..86b9b8e164fc6 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