summaryrefslogtreecommitdiff
path: root/drivers/accel/habanalabs/common/command_submission.c
diff options
context:
space:
mode:
authorOfir Bitton <obitton@habana.ai>2023-01-18 10:46:16 +0300
committerOded Gabbay <ogabbay@kernel.org>2023-03-15 14:29:11 +0300
commit6168a83788855107437127c5c1ea4d49dea9049c (patch)
tree8692535d1c1c8a242f53831b2c76664557ad0458 /drivers/accel/habanalabs/common/command_submission.c
parent8bf6e20253b2d2b614f2c0b491f840e956fa6b05 (diff)
downloadlinux-6168a83788855107437127c5c1ea4d49dea9049c.tar.xz
accel/habanalabs: increase user interrupt grace time
Currently we support scenarios where a timestamp registration request of a certain offset is received during the interrupt handling of the same offset. In this case we give a grace period of up to 100us for the interrupt handler to finish. It seems that sometimes the interrupt handling takes more than expected, and therefore this path should be optimized. Until that happens, let's increase the grace period in order not to reach timeout which will cause user call to be rejected. Signed-off-by: Ofir Bitton <obitton@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Diffstat (limited to 'drivers/accel/habanalabs/common/command_submission.c')
-rw-r--r--drivers/accel/habanalabs/common/command_submission.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/accel/habanalabs/common/command_submission.c b/drivers/accel/habanalabs/common/command_submission.c
index 8270db0a72a2..2b8a027f7d09 100644
--- a/drivers/accel/habanalabs/common/command_submission.c
+++ b/drivers/accel/habanalabs/common/command_submission.c
@@ -17,7 +17,7 @@
HL_CS_FLAGS_FLUSH_PCI_HBW_WRITES)
-#define MAX_TS_ITER_NUM 10
+#define MAX_TS_ITER_NUM 100
/**
* enum hl_cs_wait_status - cs wait status
@@ -3145,6 +3145,7 @@ static int ts_buff_get_kernel_ts_record(struct hl_mmap_mem_buf *buf,
(ts_buff->kernel_buff_size / sizeof(struct hl_user_pending_interrupt));
unsigned long flags, iter_counter = 0;
u64 current_cq_counter;
+ ktime_t timestamp;
/* Validate ts_offset not exceeding last max */
if (requested_offset_record >= cb_last) {
@@ -3153,6 +3154,8 @@ static int ts_buff_get_kernel_ts_record(struct hl_mmap_mem_buf *buf,
return -EINVAL;
}
+ timestamp = ktime_get();
+
start_over:
spin_lock_irqsave(wait_list_lock, flags);
@@ -3178,11 +3181,12 @@ start_over:
/* irq handling in the middle give it time to finish */
spin_unlock_irqrestore(wait_list_lock, flags);
- usleep_range(1, 10);
+ usleep_range(100, 1000);
if (++iter_counter == MAX_TS_ITER_NUM) {
dev_err(buf->mmg->dev,
- "handling registration interrupt took too long!!\n");
- return -EINVAL;
+ "Timestamp offset processing reached timeout of %lld ms\n",
+ ktime_ms_delta(ktime_get(), timestamp));
+ return -EAGAIN;
}
goto start_over;