drm/amdgpu: use spin_lock_irqsave to protect vm_manager.pasid_idr
authorPhilip Yang <Philip.Yang@amd.com>
Wed, 30 Jan 2019 20:21:16 +0000 (15:21 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 5 Feb 2019 23:10:24 +0000 (18:10 -0500)
amdgpu_vm_get_task_info is called from interrupt handler and sched timeout
workqueue, we should use irq version spin_lock to avoid deadlock.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index d2ea5ce2cefbee26506e4eeeeb3ed2ac24663cab..7c108e687683489fa5d247a1d42177bb225bdb99 100644 (file)
@@ -3363,14 +3363,15 @@ void amdgpu_vm_get_task_info(struct amdgpu_device *adev, unsigned int pasid,
                         struct amdgpu_task_info *task_info)
 {
        struct amdgpu_vm *vm;
+       unsigned long flags;
 
-       spin_lock(&adev->vm_manager.pasid_lock);
+       spin_lock_irqsave(&adev->vm_manager.pasid_lock, flags);
 
        vm = idr_find(&adev->vm_manager.pasid_idr, pasid);
        if (vm)
                *task_info = vm->task_info;
 
-       spin_unlock(&adev->vm_manager.pasid_lock);
+       spin_unlock_irqrestore(&adev->vm_manager.pasid_lock, flags);
 }
 
 /**