Skip to contentSkip to conversation

habanalabs: cannot sleep while holding spinlock

PATCH New Oded Gabbay 1 participant 1 message Aug 22, 2021 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 habanalabs: cannot sleep while holding spinlock

From: farah kassabri <[email protected]>

Fix 2 areas in the code where it's possible the code will go to sleep while holding a spinlock.

---
 drivers/misc/habanalabs/common/command_buffer.c | 2 --
 drivers/misc/habanalabs/common/memory.c         | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/misc/habanalabs/common/command_buffer.c +0 -2
index 58afefcd74f3..8132a84698d5 100644
@@ -314,8 +314,6 @@ int hl_cb_create(struct hl_device *hdev, struct hl_cb_mgr *mgr,
 
 	spin_lock(&mgr->cb_lock);
 	rc = idr_alloc(&mgr->cb_handles, cb, 1, 0, GFP_ATOMIC);
-	if (rc < 0)
-		rc = idr_alloc(&mgr->cb_handles, cb, 1, 0, GFP_KERNEL);
 	spin_unlock(&mgr->cb_lock);
 
 	if (rc < 0) {
drivers/misc/habanalabs/common/memory.c +1 -1
index 72954abf20fe..8cf5437c0390 100644
@@ -126,7 +126,7 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
 
 	spin_lock(&vm->idr_lock);
 	handle = idr_alloc(&vm->phys_pg_pack_handles, phys_pg_pack, 1, 0,
-				GFP_KERNEL);
+				GFP_ATOMIC);
 	spin_unlock(&vm->idr_lock);
 
 	if (handle < 0) {
Signature · 1 line
2.17.1