Skip to content

Commit

Permalink
drm/xe: Fix lockdep warning from xe_vm_madvise
Browse files Browse the repository at this point in the history
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
[  802.555515] CPU: 33 PID: 3122 Comm: xe_exec_fault_m Tainted:
...
[  802.555709] Call Trace:
[  802.555714]  <TASK>
[  802.555720]  ? __warn+0x81/0x170
[  802.555737]  ? xe_vm_madvise_ioctl+0x2de/0x440 [xe]

Fixes: 9d858b6 ("drm/xe: Ban a VM if rebind worker hits an error")
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Brian Welty <brian.welty@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
  • Loading branch information
Brian Welty authored and Rodrigo Vivi committed Dec 21, 2023
1 parent b1f8f4b commit 04194a4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/gpu/drm/xe/xe_vm_madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,18 @@ 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;
}

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;
Expand Down

0 comments on commit 04194a4

Please sign in to comment.