All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm/xe: drop unused force_alloc flag
@ 2025-04-23  2:29 Dave Airlie
  2025-04-23  3:05 ` Matthew Brost
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dave Airlie @ 2025-04-23  2:29 UTC (permalink / raw)
  To: dri-devel; +Cc: matthew.brost, christian.koenig

From: Dave Airlie <airlied@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@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/ttm/xe: drop unused force_alloc flag
  2025-04-23  2:29 [PATCH] drm/ttm/xe: drop unused force_alloc flag Dave Airlie
@ 2025-04-23  3:05 ` Matthew Brost
  2025-04-28  1:40 ` Matthew Brost
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Matthew Brost @ 2025-04-23  3:05 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel, christian.koenig

On Wed, Apr 23, 2025 at 12:29:20PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@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@redhat.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/ttm/xe: drop unused force_alloc flag
  2025-04-23  2:29 [PATCH] drm/ttm/xe: drop unused force_alloc flag Dave Airlie
  2025-04-23  3:05 ` Matthew Brost
@ 2025-04-28  1:40 ` Matthew Brost
  2025-04-28  7:47 ` Christian König
  2025-05-07 11:00 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: Matthew Brost @ 2025-04-28  1:40 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel, christian.koenig

On Wed, Apr 23, 2025 at 12:29:20PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@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@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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/ttm/xe: drop unused force_alloc flag
  2025-04-23  2:29 [PATCH] drm/ttm/xe: drop unused force_alloc flag Dave Airlie
  2025-04-23  3:05 ` Matthew Brost
  2025-04-28  1:40 ` Matthew Brost
@ 2025-04-28  7:47 ` Christian König
  2025-05-07 11:00 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2025-04-28  7:47 UTC (permalink / raw)
  To: Dave Airlie, dri-devel; +Cc: matthew.brost

On 4/23/25 04:29, Dave Airlie wrote:
> From: Dave Airlie <airlied@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@redhat.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>  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;
>  };


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/ttm/xe: drop unused force_alloc flag
  2025-04-23  2:29 [PATCH] drm/ttm/xe: drop unused force_alloc flag Dave Airlie
                   ` (2 preceding siblings ...)
  2025-04-28  7:47 ` Christian König
@ 2025-05-07 11:00 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-05-07 11:00 UTC (permalink / raw)
  To: Dave Airlie; +Cc: oe-kbuild-all

Hi Dave,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-xe/drm-xe-next]
[also build test ERROR on drm-exynos/exynos-drm-next linus/master v6.15-rc5]
[cannot apply to drm/drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip next-20250507]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie/drm-ttm-xe-drop-unused-force_alloc-flag/20250423-103716
base:   https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next
patch link:    https://lore.kernel.org/r/20250423022920.27701-1-airlied%40gmail.com
patch subject: [PATCH] drm/ttm/xe: drop unused force_alloc flag
config: i386-randconfig-005-20250426 (https://download.01.org/0day-ci/archive/20250507/202505071848.39m0TUuR-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250507/202505071848.39m0TUuR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505071848.39m0TUuR-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/xe/xe_dma_buf.c:319:
   drivers/gpu/drm/xe/tests/xe_dma_buf.c: In function 'check_residency':
>> drivers/gpu/drm/xe/tests/xe_dma_buf.c:68:15: error: too many arguments to function 'xe_bo_evict'
      68 |         ret = xe_bo_evict(exported, true);
         |               ^~~~~~~~~~~
   In file included from drivers/gpu/drm/xe/xe_dma_buf.c:17:
   drivers/gpu/drm/xe/xe_bo.h:277:5: note: declared here
     277 | int xe_bo_evict(struct xe_bo *bo);
         |     ^~~~~~~~~~~
--
   In file included from drivers/gpu/drm/xe/xe_bo.c:3022:
   drivers/gpu/drm/xe/tests/xe_bo.c: In function 'ccs_test_migrate':
>> drivers/gpu/drm/xe/tests/xe_bo.c:63:15: error: too many arguments to function 'xe_bo_evict'
      63 |         ret = xe_bo_evict(bo, true);
         |               ^~~~~~~~~~~
   drivers/gpu/drm/xe/xe_bo.c:2843:5: note: declared here
    2843 | int xe_bo_evict(struct xe_bo *bo)
         |     ^~~~~~~~~~~
--
   In file included from drivers/gpu/drm/xe/xe_migrate.c:1729:
   drivers/gpu/drm/xe/tests/xe_migrate.c: In function 'test_migrate':
>> drivers/gpu/drm/xe/tests/xe_migrate.c:512:15: error: too many arguments to function 'xe_bo_evict'
     512 |         ret = xe_bo_evict(vram_bo, true);
         |               ^~~~~~~~~~~
   In file included from drivers/gpu/drm/xe/xe_migrate.c:23:
   drivers/gpu/drm/xe/xe_bo.h:277:5: note: declared here
     277 | int xe_bo_evict(struct xe_bo *bo);
         |     ^~~~~~~~~~~


vim +/xe_bo_evict +68 drivers/gpu/drm/xe/tests/xe_dma_buf.c

dd08ebf6c3525a Matthew Brost    2023-03-30   28  
dd08ebf6c3525a Matthew Brost    2023-03-30   29  static void check_residency(struct kunit *test, struct xe_bo *exported,
dd08ebf6c3525a Matthew Brost    2023-03-30   30  			    struct xe_bo *imported, struct dma_buf *dmabuf)
dd08ebf6c3525a Matthew Brost    2023-03-30   31  {
dd08ebf6c3525a Matthew Brost    2023-03-30   32  	struct dma_buf_test_params *params = to_dma_buf_test_params(test->priv);
dd08ebf6c3525a Matthew Brost    2023-03-30   33  	u32 mem_type;
dd08ebf6c3525a Matthew Brost    2023-03-30   34  	int ret;
dd08ebf6c3525a Matthew Brost    2023-03-30   35  
dd08ebf6c3525a Matthew Brost    2023-03-30   36  	xe_bo_assert_held(exported);
dd08ebf6c3525a Matthew Brost    2023-03-30   37  	xe_bo_assert_held(imported);
dd08ebf6c3525a Matthew Brost    2023-03-30   38  
dd08ebf6c3525a Matthew Brost    2023-03-30   39  	mem_type = XE_PL_VRAM0;
62742d12663145 Lucas De Marchi  2024-03-22   40  	if (!(params->mem_mask & XE_BO_FLAG_VRAM0))
dd08ebf6c3525a Matthew Brost    2023-03-30   41  		/* No VRAM allowed */
dd08ebf6c3525a Matthew Brost    2023-03-30   42  		mem_type = XE_PL_TT;
dd08ebf6c3525a Matthew Brost    2023-03-30   43  	else if (params->force_different_devices && !p2p_enabled(params))
dd08ebf6c3525a Matthew Brost    2023-03-30   44  		/* No P2P */
dd08ebf6c3525a Matthew Brost    2023-03-30   45  		mem_type = XE_PL_TT;
dd08ebf6c3525a Matthew Brost    2023-03-30   46  	else if (params->force_different_devices && !is_dynamic(params) &&
62742d12663145 Lucas De Marchi  2024-03-22   47  		 (params->mem_mask & XE_BO_FLAG_SYSTEM))
dd08ebf6c3525a Matthew Brost    2023-03-30   48  		/* Pin migrated to TT */
dd08ebf6c3525a Matthew Brost    2023-03-30   49  		mem_type = XE_PL_TT;
dd08ebf6c3525a Matthew Brost    2023-03-30   50  
dd08ebf6c3525a Matthew Brost    2023-03-30   51  	if (!xe_bo_is_mem_type(exported, mem_type)) {
dd08ebf6c3525a Matthew Brost    2023-03-30   52  		KUNIT_FAIL(test, "Exported bo was not in expected memory type.\n");
dd08ebf6c3525a Matthew Brost    2023-03-30   53  		return;
dd08ebf6c3525a Matthew Brost    2023-03-30   54  	}
dd08ebf6c3525a Matthew Brost    2023-03-30   55  
dd08ebf6c3525a Matthew Brost    2023-03-30   56  	if (xe_bo_is_pinned(exported))
dd08ebf6c3525a Matthew Brost    2023-03-30   57  		return;
dd08ebf6c3525a Matthew Brost    2023-03-30   58  
dd08ebf6c3525a Matthew Brost    2023-03-30   59  	/*
dd08ebf6c3525a Matthew Brost    2023-03-30   60  	 * Evict exporter. Note that the gem object dma_buf member isn't
dd08ebf6c3525a Matthew Brost    2023-03-30   61  	 * set from xe_gem_prime_export(), and it's needed for the move_notify()
dd08ebf6c3525a Matthew Brost    2023-03-30   62  	 * functionality, so hack that up here. Evicting the exported bo will
dd08ebf6c3525a Matthew Brost    2023-03-30   63  	 * evict also the imported bo through the move_notify() functionality if
dd08ebf6c3525a Matthew Brost    2023-03-30   64  	 * importer is on a different device. If they're on the same device,
dd08ebf6c3525a Matthew Brost    2023-03-30   65  	 * the exporter and the importer should be the same bo.
dd08ebf6c3525a Matthew Brost    2023-03-30   66  	 */
dd08ebf6c3525a Matthew Brost    2023-03-30   67  	swap(exported->ttm.base.dma_buf, dmabuf);
dd08ebf6c3525a Matthew Brost    2023-03-30  @68  	ret = xe_bo_evict(exported, true);
dd08ebf6c3525a Matthew Brost    2023-03-30   69  	swap(exported->ttm.base.dma_buf, dmabuf);
dd08ebf6c3525a Matthew Brost    2023-03-30   70  	if (ret) {
dd08ebf6c3525a Matthew Brost    2023-03-30   71  		if (ret != -EINTR && ret != -ERESTARTSYS)
dd08ebf6c3525a Matthew Brost    2023-03-30   72  			KUNIT_FAIL(test, "Evicting exporter failed with err=%d.\n",
dd08ebf6c3525a Matthew Brost    2023-03-30   73  				   ret);
dd08ebf6c3525a Matthew Brost    2023-03-30   74  		return;
dd08ebf6c3525a Matthew Brost    2023-03-30   75  	}
dd08ebf6c3525a Matthew Brost    2023-03-30   76  
dd08ebf6c3525a Matthew Brost    2023-03-30   77  	/* Verify that also importer has been evicted to SYSTEM */
a201c6ee37d63e Thomas Hellström 2023-06-26   78  	if (exported != imported && !xe_bo_is_mem_type(imported, XE_PL_SYSTEM)) {
dd08ebf6c3525a Matthew Brost    2023-03-30   79  		KUNIT_FAIL(test, "Importer wasn't properly evicted.\n");
dd08ebf6c3525a Matthew Brost    2023-03-30   80  		return;
dd08ebf6c3525a Matthew Brost    2023-03-30   81  	}
dd08ebf6c3525a Matthew Brost    2023-03-30   82  
dd08ebf6c3525a Matthew Brost    2023-03-30   83  	/* Re-validate the importer. This should move also exporter in. */
dd08ebf6c3525a Matthew Brost    2023-03-30   84  	ret = xe_bo_validate(imported, NULL, false);
dd08ebf6c3525a Matthew Brost    2023-03-30   85  	if (ret) {
dd08ebf6c3525a Matthew Brost    2023-03-30   86  		if (ret != -EINTR && ret != -ERESTARTSYS)
dd08ebf6c3525a Matthew Brost    2023-03-30   87  			KUNIT_FAIL(test, "Validating importer failed with err=%d.\n",
dd08ebf6c3525a Matthew Brost    2023-03-30   88  				   ret);
dd08ebf6c3525a Matthew Brost    2023-03-30   89  		return;
dd08ebf6c3525a Matthew Brost    2023-03-30   90  	}
dd08ebf6c3525a Matthew Brost    2023-03-30   91  
dd08ebf6c3525a Matthew Brost    2023-03-30   92  	/*
dd08ebf6c3525a Matthew Brost    2023-03-30   93  	 * If on different devices, the exporter is kept in system  if
dd08ebf6c3525a Matthew Brost    2023-03-30   94  	 * possible, saving a migration step as the transfer is just
dd08ebf6c3525a Matthew Brost    2023-03-30   95  	 * likely as fast from system memory.
dd08ebf6c3525a Matthew Brost    2023-03-30   96  	 */
62742d12663145 Lucas De Marchi  2024-03-22   97  	if (params->mem_mask & XE_BO_FLAG_SYSTEM)
dd08ebf6c3525a Matthew Brost    2023-03-30   98  		KUNIT_EXPECT_TRUE(test, xe_bo_is_mem_type(exported, XE_PL_TT));
dd08ebf6c3525a Matthew Brost    2023-03-30   99  	else
dd08ebf6c3525a Matthew Brost    2023-03-30  100  		KUNIT_EXPECT_TRUE(test, xe_bo_is_mem_type(exported, mem_type));
dd08ebf6c3525a Matthew Brost    2023-03-30  101  
dd08ebf6c3525a Matthew Brost    2023-03-30  102  	if (params->force_different_devices)
dd08ebf6c3525a Matthew Brost    2023-03-30  103  		KUNIT_EXPECT_TRUE(test, xe_bo_is_mem_type(imported, XE_PL_TT));
dd08ebf6c3525a Matthew Brost    2023-03-30  104  	else
dd08ebf6c3525a Matthew Brost    2023-03-30  105  		KUNIT_EXPECT_TRUE(test, exported == imported);
dd08ebf6c3525a Matthew Brost    2023-03-30  106  }
dd08ebf6c3525a Matthew Brost    2023-03-30  107  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-07 11:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23  2:29 [PATCH] drm/ttm/xe: drop unused force_alloc flag Dave Airlie
2025-04-23  3:05 ` Matthew Brost
2025-04-28  1:40 ` Matthew Brost
2025-04-28  7:47 ` Christian König
2025-05-07 11:00 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.