Skip to content

Commit 975ab7b

Browse files
committed
habanalabs: count dropped CS because max CS in-flight
There is a case where the user reaches the maximum number of CS in-flight. In that case, the driver rejects the new CS of the user with EAGAIN. Count that event so the user can query the driver later to see if it happened. Reviewed-by: Tomer Tayar <ttayar@habana.ai> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
1 parent 0db5753 commit 975ab7b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎drivers/misc/habanalabs/common/command_submission.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ static void cs_counters_aggregate(struct hl_device *hdev, struct hl_ctx *ctx)
252252
ctx->cs_counters.parsing_drop_cnt;
253253
hdev->aggregated_cs_counters.queue_full_drop_cnt +=
254254
ctx->cs_counters.queue_full_drop_cnt;
255+
hdev->aggregated_cs_counters.max_cs_in_flight_drop_cnt +=
256+
ctx->cs_counters.max_cs_in_flight_drop_cnt;
255257
}
256258

257259
static void cs_do_release(struct kref *ref)
@@ -431,8 +433,9 @@ static int allocate_cs(struct hl_device *hdev, struct hl_ctx *ctx,
431433
(hdev->asic_prop.max_pending_cs - 1)];
432434

433435
if (other && !completion_done(&other->completion)) {
434-
dev_dbg(hdev->dev,
436+
dev_dbg_ratelimited(hdev->dev,
435437
"Rejecting CS because of too many in-flights CS\n");
438+
ctx->cs_counters.max_cs_in_flight_drop_cnt++;
436439
rc = -EAGAIN;
437440
goto free_fence;
438441
}

‎include/uapi/misc/habanalabs.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,14 @@ struct hl_info_sync_manager {
401401
* @parsing_drop_cnt: dropped due to error in packet parsing
402402
* @queue_full_drop_cnt: dropped due to queue full
403403
* @device_in_reset_drop_cnt: dropped due to device in reset
404+
* @max_cs_in_flight_drop_cnt: dropped due to maximum CS in-flight
404405
*/
405406
struct hl_cs_counters {
406407
__u64 out_of_mem_drop_cnt;
407408
__u64 parsing_drop_cnt;
408409
__u64 queue_full_drop_cnt;
409410
__u64 device_in_reset_drop_cnt;
411+
__u64 max_cs_in_flight_drop_cnt;
410412
};
411413

412414
struct hl_info_cs_counters {

0 commit comments

Comments
 (0)