[Intel-xe] [PATCH] drm/xe: Fix lockdep warning from xe_vm_madvise
Matthew Brost
matthew.brost at intel.com
Thu Jul 13 05:09:59 UTC 2023
On Wed, Jul 12, 2023 at 07:01:05PM -0700, Brian Welty wrote:
> We need to hold vm->lock before the xe_vm_is_closed_or_banned().
>
> Else we get this splat:
> [ 802.555227] ------------[ cut here ]------------
> [ 802.555234] WARNING: CPU: 33 PID: 3122 at drivers/gpu/drm/xe/xe_vm.h:60 xe_vm_madvise_ioctl+0x2de/0x440 [xe]
> [ 802.555515] CPU: 33 PID: 3122 Comm: xe_exec_fault_m Tainted: G W 6.4.0-xe+ #16
> ...
> [ 802.555709] Call Trace:
> [ 802.555714] <TASK>
> [ 802.555720] ? __warn+0x81/0x170
> [ 802.555737] ? xe_vm_madvise_ioctl+0x2de/0x440 [xe]
>
> Fixes: 627d78b9d038 ("drm/xe: Ban a VM if rebind worker hits an error")
> Signed-off-by: Brian Welty <brian.welty at intel.com>
Thanks for the fix. LGTM.
Reviewed-by: Matthew Brost <matthew.brost at intel.com>
> ---
> drivers/gpu/drm/xe/xe_vm_madvise.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c
> index d6e3b76bf590..7532a60a24f0 100644
> --- a/drivers/gpu/drm/xe/xe_vm_madvise.c
> +++ b/drivers/gpu/drm/xe/xe_vm_madvise.c
> @@ -267,11 +267,6 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data,
> if (XE_IOCTL_ERR(xe, !vm))
> return -EINVAL;
>
> - if (XE_IOCTL_ERR(xe, xe_vm_is_closed_or_banned(vm))) {
> - err = -ENOENT;
> - goto put_vm;
> - }
> -
> if (XE_IOCTL_ERR(xe, !xe_vm_in_fault_mode(vm))) {
> err = -EINVAL;
> goto put_vm;
> @@ -279,6 +274,11 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data,
>
> down_read(&vm->lock);
>
> + if (XE_IOCTL_ERR(xe, xe_vm_is_closed_or_banned(vm))) {
> + err = -ENOENT;
> + goto unlock_vm;
> + }
> +
> vmas = get_vmas(vm, &num_vmas, args->addr, args->range);
> if (XE_IOCTL_ERR(xe, err))
> goto unlock_vm;
> --
> 2.38.0
>
More information about the Intel-xe
mailing list