Skip to content

Commit

Permalink
habanalabs: cannot sleep while holding spinlock
Browse files Browse the repository at this point in the history
Fix 2 areas in the code where it's possible the code will
go to sleep while holding a spinlock.

Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: farah kassabri <[email protected]>
Reviewed-by: Oded Gabbay <[email protected]>
Signed-off-by: Oded Gabbay <[email protected]>
  • Loading branch information
Farah-kassabri authored and ogabbay committed Sep 1, 2021
1 parent 698f744 commit 607b146
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions drivers/misc/habanalabs/common/command_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/habanalabs/common/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,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) {
Expand Down

0 comments on commit 607b146

Please sign in to comment.