From mboxrd@z Thu Jan 1 00:00:00 1970 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 6DB35C98330 for ; Fri, 25 Sep 2026 20:15:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 97CE810FC46; Fri, 25 Sep 2026 20:15:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Bk0VZ7md"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5AECE10FC43 for ; Fri, 25 Sep 2026 20:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1790367333; x=1821903333; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9aGDtrgGgLK6ycIX2cQKjkW/eBxuFBKh/DAoY2IhYjQ=; b=Bk0VZ7mdP2iNOCyYQV45bCDQ82N26lODb3khG/gL0kN6XEtfCEKKUhCn 3BwJLvnf1Dg/CzVDy+aMRczowm6XaF7WQiBYQkOaZr1mWBYEnX4JG3Fu5 E5w6aSvTSvIzqfw5ksNAPR3S8k/yB6o7PltBjtpInXzHFZNFVXxyQzegu 7R4gAA57cRnms2JtYj0zpvPfMRRkv2unhJByyubLksguWxXoGiESF5C+o yHB1g8PF9hCttFWdiwcRkSz5yv10c3vVcWD7P8MTUcax9cspzbcqwpwWe xrUo8sFVId3YjzV6aGpYeAuwG8HaoSO0iXp4u8mm4BwDZkYP32gNTNB5C w==; X-CSE-ConnectionGUID: 21llu6+0SGGJKbDu/aSlPQ== X-CSE-MsgGUID: VF5z5IcOS8Oxq6c79Kw+RQ== X-IronPort-AV: E=McAfee;i="6800,10657,11916"; a="90377944" X-IronPort-AV: E=Sophos;i="6.27,123,1787036400"; d="scan'208";a="90377944" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2026 13:15:32 -0700 X-CSE-ConnectionGUID: aIZDw+ZxS8meyOei/hQp/w== X-CSE-MsgGUID: Y0fN9WjWT/SKHmh/G8C+uQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,123,1787036400"; d="scan'208";a="274509855" Received: from gsse-cloud1.jf.intel.com ([10.54.39.91]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2026 13:15:31 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org Cc: Francois Dugast , Maarten Lankhorst Subject: [PATCH v8 06/24] drm/xe: Update xe_bo_put_deferred arguments to include writeback flag Date: Fri, 25 Sep 2026 13:15:08 -0700 Message-Id: <20260925201526.1355279-7-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260925201526.1355279-1-matthew.brost@intel.com> References: <20260925201526.1355279-1-matthew.brost@intel.com> 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" 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 Reviewed-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 341fa93a71e4..861b1be231de 100644 --- a/drivers/gpu/drm/xe/xe_bo.h +++ b/drivers/gpu/drm/xe/xe_bo.h @@ -496,6 +496,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. Only set to true when added, never set to false. * * Since the final freeing of an object includes both sleeping and (!) * memory allocation in the dma_resv individualization, it's not ok @@ -515,7 +517,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); @@ -525,6 +528,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); } @@ -541,7 +547,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 e116fb562c4c..4c424d1c6721 100644 --- a/drivers/gpu/drm/xe/xe_drm_client.c +++ b/drivers/gpu/drm/xe/xe_drm_client.c @@ -256,7 +256,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 dd007e3bc40e..42a37e40a6c0 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.34.1