[PATCH 17/20] drm/amdgpu: GFP_NOIO while holding locks taken in MMU notifier

Felix Kuehling Felix.Kuehling at amd.com
Thu Mar 15 21:27:56 UTC 2018


When an MMU notifier runs in memory reclaim context, it can deadlock
trying to take locks that are already held in the thread causing the
memory reclaim. The solution is to avoid memory reclaim while holding
locks that are taken in MMU notifiers by using GFP_NOIO.

This commit fixes kmalloc while holding rmn->lock. The GFX MMU
notifier also locks reservation objects. I have no good solution for
avoiding reclaim while holding reservation objects. The HSA MMU
notifier will not lock any reservation objects.

Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index f2ed18e..b4a5c03 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -402,7 +402,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
 	}
 
 	if (!node) {
-		node = kmalloc(sizeof(struct amdgpu_mn_node), GFP_KERNEL);
+		node = kmalloc(sizeof(struct amdgpu_mn_node), GFP_NOIO);
 		if (!node) {
 			up_write(&rmn->lock);
 			return -ENOMEM;
-- 
2.7.4



More information about the amd-gfx mailing list