[PATCH] drm/ttm/xe: drop unused force_alloc flag

Matthew Brost matthew.brost at intel.com
Mon Apr 28 01:40:22 UTC 2025


On Wed, Apr 23, 2025 at 12:29:20PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This flag used to be used in the old memory tracking code, that
> code got migrated into the vmwgfx driver[1], and then got removed
> from the tree[2], but this piece got left behind.
> 
> [1] f07069da6b4c ("drm/ttm: move memory accounting into vmwgfx v4")
> [2] 8aadeb8ad874 ("drm/vmwgfx: Remove the dedicated memory accounting")
> 
> Cleanup the dead code.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>

Opps, this broke Xe's selftests [3] - see the kunit failure. My bad on
the RB, always forget about those. Anyways, easy fix which I posted but
maybe going forward CC intel-xe list to trigger our CI.

Matt

[3] https://patchwork.freedesktop.org/series/148313/

> ---
>  drivers/gpu/drm/ttm/ttm_bo_vm.c    | 1 -
>  drivers/gpu/drm/ttm/ttm_resource.c | 1 -
>  drivers/gpu/drm/xe/xe_bo.c         | 4 +---
>  drivers/gpu/drm/xe/xe_bo.h         | 2 +-
>  drivers/gpu/drm/xe/xe_dma_buf.c    | 2 +-
>  include/drm/ttm/ttm_bo.h           | 2 --
>  6 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> index a194db83421d..bdfa6ecfef05 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> @@ -220,7 +220,6 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
>  		struct ttm_operation_ctx ctx = {
>  			.interruptible = true,
>  			.no_wait_gpu = false,
> -			.force_alloc = true
>  		};
>  
>  		ttm = bo->ttm;
> diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c
> index 7e5a60c55813..769b0ca9be47 100644
> --- a/drivers/gpu/drm/ttm/ttm_resource.c
> +++ b/drivers/gpu/drm/ttm/ttm_resource.c
> @@ -548,7 +548,6 @@ int ttm_resource_manager_evict_all(struct ttm_device *bdev,
>  	struct ttm_operation_ctx ctx = {
>  		.interruptible = false,
>  		.no_wait_gpu = false,
> -		.force_alloc = true
>  	};
>  	struct dma_fence *fence;
>  	int ret;
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 64f9c936eea0..32a5a6390f62 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -2759,19 +2759,17 @@ int xe_bo_migrate(struct xe_bo *bo, u32 mem_type)
>  /**
>   * xe_bo_evict - Evict an object to evict placement
>   * @bo: The buffer object to migrate.
> - * @force_alloc: Set force_alloc in ttm_operation_ctx
>   *
>   * On successful completion, the object memory will be moved to evict
>   * placement. This function blocks until the object has been fully moved.
>   *
>   * Return: 0 on success. Negative error code on failure.
>   */
> -int xe_bo_evict(struct xe_bo *bo, bool force_alloc)
> +int xe_bo_evict(struct xe_bo *bo)
>  {
>  	struct ttm_operation_ctx ctx = {
>  		.interruptible = false,
>  		.no_wait_gpu = false,
> -		.force_alloc = force_alloc,
>  		.gfp_retry_mayfail = true,
>  	};
>  	struct ttm_placement placement;
> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
> index ec3e4446d027..1a3734d9f8be 100644
> --- a/drivers/gpu/drm/xe/xe_bo.h
> +++ b/drivers/gpu/drm/xe/xe_bo.h
> @@ -271,7 +271,7 @@ uint64_t vram_region_gpu_offset(struct ttm_resource *res);
>  bool xe_bo_can_migrate(struct xe_bo *bo, u32 mem_type);
>  
>  int xe_bo_migrate(struct xe_bo *bo, u32 mem_type);
> -int xe_bo_evict(struct xe_bo *bo, bool force_alloc);
> +int xe_bo_evict(struct xe_bo *bo);
>  
>  int xe_bo_evict_pinned(struct xe_bo *bo);
>  int xe_bo_restore_pinned(struct xe_bo *bo);
> diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c b/drivers/gpu/drm/xe/xe_dma_buf.c
> index f67803e15a0e..f06961575d8a 100644
> --- a/drivers/gpu/drm/xe/xe_dma_buf.c
> +++ b/drivers/gpu/drm/xe/xe_dma_buf.c
> @@ -236,7 +236,7 @@ static void xe_dma_buf_move_notify(struct dma_buf_attachment *attach)
>  	struct drm_gem_object *obj = attach->importer_priv;
>  	struct xe_bo *bo = gem_to_xe_bo(obj);
>  
> -	XE_WARN_ON(xe_bo_evict(bo, false));
> +	XE_WARN_ON(xe_bo_evict(bo));
>  }
>  
>  static const struct dma_buf_attach_ops xe_dma_buf_attach_ops = {
> diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
> index 903cd1030110..cf027558b6db 100644
> --- a/include/drm/ttm/ttm_bo.h
> +++ b/include/drm/ttm/ttm_bo.h
> @@ -172,7 +172,6 @@ struct ttm_bo_kmap_obj {
>   * @gfp_retry_mayfail: Set the __GFP_RETRY_MAYFAIL when allocation pages.
>   * @allow_res_evict: Allow eviction of reserved BOs. Can be used when multiple
>   * BOs share the same reservation object.
> - * @force_alloc: Don't check the memory account during suspend or CPU page
>   * faults. Should only be used by TTM internally.
>   * @resv: Reservation object to allow reserved evictions with.
>   * @bytes_moved: Statistics on how many bytes have been moved.
> @@ -185,7 +184,6 @@ struct ttm_operation_ctx {
>  	bool no_wait_gpu;
>  	bool gfp_retry_mayfail;
>  	bool allow_res_evict;
> -	bool force_alloc;
>  	struct dma_resv *resv;
>  	uint64_t bytes_moved;
>  };
> -- 
> 2.48.1
> 


More information about the dri-devel mailing list