drm/amdgpu: fix locking in vega10_ih_prescreen_iv
Subsystems (2)
PATCH 1/2 drm/amdgpu: fix locking in vega10_ih_prescreen_iv
The vm pointer can become invalid as soon as the lock is released.
--- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +3 -1
@@ -278,9 +278,9 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev)/* Track retry faults in per-VM fault FIFO. */ spin_lock (&adev->vm_manager.pasid_lock); vm =idr_find (&adev->vm_manager.pasid_idr, pasid); -spin_unlock (&adev->vm_manager.pasid_lock);if (WARN_ON_ONCE (!vm)) {/* VM not found, process it normally */ +spin_unlock (&adev->vm_manager.pasid_lock);amdgpu_ih_clear_fault (adev, key);return true; }
@@ -288,9 +288,11 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev) r =kfifo_put (&vm->faults, key);if (!r) {/* FIFO is full. Ignore it until there is space */ +spin_unlock (&adev->vm_manager.pasid_lock);amdgpu_ih_clear_fault (adev, key); goto ignore_iv; } +spin_unlock (&adev->vm_manager.pasid_lock);/* It's the first fault for this address, process it normally */ return true;
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180124123938.4792-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: remove WARN_ON when VM isn't found
It can easily be that the VM is already destroyed when this runs.
--- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +1 -1
@@ -278,7 +278,7 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev)/* Track retry faults in per-VM fault FIFO. */ spin_lock (&adev->vm_manager.pasid_lock); vm =idr_find (&adev->vm_manager.pasid_idr, pasid); -if (WARN_ON_ONCE (!vm)) { +if (vm) {/* VM not found, process it normally */ spin_unlock (&adev->vm_manager.pasid_lock);amdgpu_ih_clear_fault (adev, key);
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180124123938.4792-2-christian.koenig-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Acked-byRe: [PATCH 2/2] drm/amdgpu: remove WARN_ON when VM isn't found
Quoted 12 lines · Christian König
It can easily be that the VM is already destroyed when this runs.
Signed-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/vega10_ih.c +0
-0
drivers/gpu/drm/amd/amdgpu/vega10_ih.c static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev) · line 281
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +1
-1@@ -278,7 +278,7 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev)/* Track retry faults in per-VM fault FIFO. */ spin_lock (&adev->vm_manager.pasid_lock); vm =idr_find (&adev->vm_manager.pasid_idr, pasid); -if (WARN_ON_ONCE (!vm)) { +if (vm) {
Should be !vm. With that fixed:
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +0
-1/* VM not found, process it normally */ spin_unlock (&adev->vm_manager.pasid_lock);amdgpu_ih_clear_fault (adev, key); --2.14.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Acked-byQuoted 3 lines · Christian König
The vm pointer can become invalid as soon as the lock is released.
Signed-off-by Christian König <[email protected]>
Quoted 34 lines
--- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/vega10_ih.c +3
-2@@ -278,9 +278,9 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev)/* Track retry faults in per-VM fault FIFO. */ spin_lock (&adev->vm_manager.pasid_lock); vm =idr_find (&adev->vm_manager.pasid_idr, pasid); -spin_unlock (&adev->vm_manager.pasid_lock);if (WARN_ON_ONCE (!vm)) {/* VM not found, process it normally */ +spin_unlock (&adev->vm_manager.pasid_lock);amdgpu_ih_clear_fault (adev, key);return true; }@@ -288,9 +288,11 @@ static bool vega10_ih_prescreen_iv(struct amdgpu_device *adev) r =kfifo_put (&vm->faults, key);if (!r) {/* FIFO is full. Ignore it until there is space */ +spin_unlock (&adev->vm_manager.pasid_lock);amdgpu_ih_clear_fault (adev, key); goto ignore_iv; } +spin_unlock (&adev->vm_manager.pasid_lock);/* It's the first fault for this address, process it normally */ return true; --2.14.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx