Skip to content

Commit 9a4e44a

Browse files
KobyElbazogabbay
authored andcommitted
accel/habanalabs: refactor abort of completions and waits
Aborting CS completions should be in command_submission.c but aborting waiting for user interrupts should be in device.c. This separation is also for adding more abort operations in the future. Signed-off-by: Koby Elbaz <kelbaz@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
1 parent ad8bfd3 commit 9a4e44a

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

drivers/accel/habanalabs/common/command_submission.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,11 +1139,10 @@ static void force_complete_cs(struct hl_device *hdev)
11391139
spin_unlock(&hdev->cs_mirror_lock);
11401140
}
11411141

1142-
void hl_abort_waitings_for_completion(struct hl_device *hdev)
1142+
void hl_abort_waiting_for_cs_completions(struct hl_device *hdev)
11431143
{
11441144
force_complete_cs(hdev);
11451145
force_complete_multi_cs(hdev);
1146-
hl_release_pending_user_interrupts(hdev);
11471146
}
11481147

11491148
static void job_wq_completion(struct work_struct *work)

drivers/accel/habanalabs/common/device.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,16 @@ static void take_release_locks(struct hl_device *hdev)
11571157
mutex_unlock(&hdev->fpriv_ctrl_list_lock);
11581158
}
11591159

1160+
static void hl_abort_waiting_for_completions(struct hl_device *hdev)
1161+
{
1162+
hl_abort_waiting_for_cs_completions(hdev);
1163+
1164+
/* Release all pending user interrupts, each pending user interrupt
1165+
* holds a reference to a user context.
1166+
*/
1167+
hl_release_pending_user_interrupts(hdev);
1168+
}
1169+
11601170
static void cleanup_resources(struct hl_device *hdev, bool hard_reset, bool fw_reset,
11611171
bool skip_wq_flush)
11621172
{
@@ -1176,10 +1186,7 @@ static void cleanup_resources(struct hl_device *hdev, bool hard_reset, bool fw_r
11761186
/* flush the MMU prefetch workqueue */
11771187
flush_workqueue(hdev->prefetch_wq);
11781188

1179-
/* Release all pending user interrupts, each pending user interrupt
1180-
* holds a reference to user context
1181-
*/
1182-
hl_release_pending_user_interrupts(hdev);
1189+
hl_abort_waiting_for_completions(hdev);
11831190
}
11841191

11851192
/*
@@ -1921,7 +1928,7 @@ int hl_device_cond_reset(struct hl_device *hdev, u32 flags, u64 event_mask)
19211928

19221929
hl_ctx_put(ctx);
19231930

1924-
hl_abort_waitings_for_completion(hdev);
1931+
hl_abort_waiting_for_completions(hdev);
19251932

19261933
return 0;
19271934

drivers/accel/habanalabs/common/habanalabs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3934,7 +3934,7 @@ void hl_dec_fini(struct hl_device *hdev);
39343934
void hl_dec_ctx_fini(struct hl_ctx *ctx);
39353935

39363936
void hl_release_pending_user_interrupts(struct hl_device *hdev);
3937-
void hl_abort_waitings_for_completion(struct hl_device *hdev);
3937+
void hl_abort_waiting_for_cs_completions(struct hl_device *hdev);
39383938
int hl_cs_signal_sob_wraparound_handler(struct hl_device *hdev, u32 q_idx,
39393939
struct hl_hw_sob **hw_sob, u32 count, bool encaps_sig);
39403940

0 commit comments

Comments
 (0)