[PATCH] drm/xe: get rid of MAX_BINDS

Matthew Brost matthew.brost at intel.com
Fri Feb 23 18:34:18 UTC 2024


On Wed, Feb 14, 2024 at 04:53:53PM -0800, Paulo Zanoni wrote:
> Mesa has been issuing a single bind operation per ioctl since xe.ko
> changed to GPUVA due xe.ko bug #746. If I change Mesa to try again to
> issue every single bind operation it can in the same ioctl, it hits
> the MAX_BINDS assertion when running Vulkan conformance tests.
> 
> Test dEQP-VK.sparse_resources.transfer_queue.3d.rgba32i.1024_128_8
> issues 960 bind operations in a single ioctl, it's the most I could
> find in the conformance suite.
> 
> I don't see a reason to keep the MAX_BINDS restriction: it doesn't
> seem to be preventing any specific issue. If the number is too big for
> the memory allocations, then those will fail. Nothing related to
> num_binds seems to be using the stack. Let's just get rid of it.
> 
> Testcase: dEQP-VK.sparse_resources.transfer_queue.3d.rgba32i.1024_128_8
> References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/746
> Cc: Matthew Brost <matthew.brost at intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>

After reviewing a few other DRM drivers there does not appear to be
similar limit in place.

I think we need a fixes tag for this so can be included in 6.8 too. We
can add this during merging.

Also I believe the kcalloc tied to user input should be replaced with
kvcalloc. I can post this in a follow up a bit later today once my dev
machine comes back online.

With that:
Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_vm.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 836a6e849cda..63340cf4d587 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -2720,8 +2720,6 @@ static int vm_bind_ioctl_ops_execute(struct xe_vm *vm,
>  #define XE_64K_PAGE_MASK 0xffffull
>  #define ALL_DRM_XE_SYNCS_FLAGS (DRM_XE_SYNCS_FLAG_WAIT_FOR_OP)
>  
> -#define MAX_BINDS	512	/* FIXME: Picking random upper limit */
> -
>  static int vm_bind_ioctl_check_args(struct xe_device *xe,
>  				    struct drm_xe_vm_bind *args,
>  				    struct drm_xe_vm_bind_op **bind_ops)
> @@ -2733,8 +2731,7 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe,
>  	    XE_IOCTL_DBG(xe, args->reserved[0] || args->reserved[1]))
>  		return -EINVAL;
>  
> -	if (XE_IOCTL_DBG(xe, args->extensions) ||
> -	    XE_IOCTL_DBG(xe, args->num_binds > MAX_BINDS))
> +	if (XE_IOCTL_DBG(xe, args->extensions))
>  		return -EINVAL;
>  
>  	if (args->num_binds > 1) {
> -- 
> 2.39.2
> 


More information about the Intel-xe mailing list