Skip to content

Commit d760895

Browse files
fxkamdalexdeucher
authored andcommitted
drm/amdgpu: Use spinlock_irqsave for pasid_lock
This should fix a kernel LOCKDEP warning on Vega10: [ 149.416604] ================================ [ 149.420877] WARNING: inconsistent lock state [ 149.425152] 5.11.0-kfd-fkuehlin #517 Not tainted [ 149.429770] -------------------------------- [ 149.434053] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. [ 149.440059] swapper/3/0 [HC1[1]:SC0[0]:HE0:SE1] takes: [ 149.445198] ffff9ac80e005d68 (&adev->vm_manager.pasid_lock){?.+.}-{2:2}, at: amdgpu_vm_get_task_info+0x25/0x90 [amdgpu] [ 149.456252] {HARDIRQ-ON-W} state was registered at: [ 149.461136] lock_acquire+0x242/0x390 [ 149.464895] _raw_spin_lock+0x2c/0x40 [ 149.468647] amdgpu_vm_handle_fault+0x44/0x380 [amdgpu] [ 149.474187] gmc_v9_0_process_interrupt+0xa8/0x410 [amdgpu] ... Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Oak Zeng <Oak.Zeng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1ba7b24 commit d760895

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3385,19 +3385,20 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
33853385
{
33863386
bool is_compute_context = false;
33873387
struct amdgpu_bo *root;
3388+
unsigned long irqflags;
33883389
uint64_t value, flags;
33893390
struct amdgpu_vm *vm;
33903391
int r;
33913392

3392-
spin_lock(&adev->vm_manager.pasid_lock);
3393+
spin_lock_irqsave(&adev->vm_manager.pasid_lock, irqflags);
33933394
vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
33943395
if (vm) {
33953396
root = amdgpu_bo_ref(vm->root.bo);
33963397
is_compute_context = vm->is_compute_context;
33973398
} else {
33983399
root = NULL;
33993400
}
3400-
spin_unlock(&adev->vm_manager.pasid_lock);
3401+
spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, irqflags);
34013402

34023403
if (!root)
34033404
return false;
@@ -3415,11 +3416,11 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
34153416
goto error_unref;
34163417

34173418
/* Double check that the VM still exists */
3418-
spin_lock(&adev->vm_manager.pasid_lock);
3419+
spin_lock_irqsave(&adev->vm_manager.pasid_lock, irqflags);
34193420
vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
34203421
if (vm && vm->root.bo != root)
34213422
vm = NULL;
3422-
spin_unlock(&adev->vm_manager.pasid_lock);
3423+
spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, irqflags);
34233424
if (!vm)
34243425
goto error_unlock;
34253426

0 commit comments

Comments
 (0)