On 30-04-2026 09:14, Matthew Brost wrote: > On Thu, Apr 16, 2026 at 01:19:54PM +0530, Tejas Upadhyay wrote: >> Recent driver update introduce support for purgeable buffer >> objects (BOs), extending the API to include VRAM pages to >> better manage memory pressure and enable memory offlining. >> >> Signed-off-by: Tejas Upadhyay >> --- >> drivers/gpu/drm/xe/xe_bo.c | 5 +---- >> drivers/gpu/drm/xe/xe_bo.h | 1 + >> 2 files changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c >> index 5ce60d161e09..04d3b25c7c8e 100644 >> --- a/drivers/gpu/drm/xe/xe_bo.c >> +++ b/drivers/gpu/drm/xe/xe_bo.c >> @@ -903,7 +903,7 @@ void xe_bo_set_purgeable_state(struct xe_bo *bo, >> * >> * Return: 0 on success, negative error code on failure >> */ >> -static int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx) >> +int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx) >> { >> struct xe_bo *bo = ttm_to_xe_bo(ttm_bo); >> struct ttm_placement place = {}; >> @@ -911,9 +911,6 @@ static int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operatio >> >> xe_bo_assert_held(bo); >> >> - if (!ttm_bo->ttm) >> - return 0; >> - > I think blindly deleting this is fine but I'd run this by Arvind to make > sure in normal purge flow this won't do anything bad but afiak in normal > purge flows ttm_bo->ttm will never be NULL. The purge paths (|xe_bo_move(evict=true, DONTNEED)| and |swap_notify|), |ttm_bo->ttm| is always non‑NULL. TTM allocates |ttm_tt| before invoking |->move| on a populated BO. So removing this check is safe. ~Arvind > > If not then adjust the existing call... > > @@ -978,7 +978,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, > * The move_notify callback will handle invalidation asynchronously. > */ > if (evict && xe_bo_madv_is_dontneed(bo)) { > - ret = xe_ttm_bo_purge(ttm_bo, ctx); > + if (ttm_bo->ttm) > + ret = xe_ttm_bo_purge(ttm_bo, ctx); > if (ret) > return ret; > > Matt > >> if (!xe_bo_madv_is_dontneed(bo)) >> return 0; >> >> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h >> index 68dea7d25a6b..9f55b3589caf 100644 >> --- a/drivers/gpu/drm/xe/xe_bo.h >> +++ b/drivers/gpu/drm/xe/xe_bo.h >> @@ -500,6 +500,7 @@ struct xe_bo_shrink_flags { >> long xe_bo_shrink(struct ttm_operation_ctx *ctx, struct ttm_buffer_object *bo, >> const struct xe_bo_shrink_flags flags, >> unsigned long *scanned); >> +int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx); >> >> /** >> * xe_bo_is_mem_type - Whether the bo currently resides in the given >> -- >> 2.52.0 >>