History

accel/habanalabs: capture interrupt timestamp in handler

In order for interrupt timestamp to be more accurate we should capture it during the interrupt handling rather than in threaded irq context.

Ofir Bitton committed 3 years ago

Commit bcfcd081 parent 60122352 files · +8 −3Browse files

Unified · Split

2 files
  1. drivers/accel/habanalabs/common/habanalabs.h +2 −0
  2. drivers/accel/habanalabs/common/irq.c +6 −3
drivers/accel/habanalabs/common/habanalabs.h+2−0
@@ -1107,6 +1107,7 @@ enum hl_user_interrupt_type { · 1106 unmodified lines
11071107 * @type: user interrupt type
11081108 * @wait_list_head: head to the list of user threads pending on this interrupt
11091109 * @wait_list_lock: protects wait_list_head
1110+ * @timestamp: last timestamp taken upon interrupt
11101111 * @interrupt_id: msix interrupt id
11111112 */
11121113 struct hl_user_interrupt {
@@ -1114,6 +1115,7 @@ struct hl_user_interrupt { · 1 unmodified line
11141115 enum hl_user_interrupt_type type;
11151116 struct list_head wait_list_head;
11161117 spinlock_t wait_list_lock;
1118+ ktime_t timestamp;
11171119 u32 interrupt_id;
11181120 };
11191121
drivers/accel/habanalabs/common/irq.c+6−3
@@ -280,7 +280,6 @@ static void handle_user_interrupt(struct hl_device *hdev, struct hl_user_interru · 279 unmodified lines
280280 struct list_head *ts_reg_free_list_head = NULL;
281281 struct timestamp_reg_work_obj *job;
282282 bool reg_node_handle_fail = false;
283− ktime_t now = ktime_get();
284283 int rc;
285284
286285 /* For registration nodes:
@@ -303,13 +302,13 @@ static void handle_user_interrupt(struct hl_device *hdev, struct hl_user_interru · 16 unmodified lines
303302 if (pend->ts_reg_info.buf) {
304303 if (!reg_node_handle_fail) {
305304 rc = handle_registration_node(hdev, pend,
306− &ts_reg_free_list_head, now);
305+ &ts_reg_free_list_head, intr->timestamp);
307306 if (rc)
308307 reg_node_handle_fail = true;
309308 }
310309 } else {
311310 /* Handle wait target value node */
312− pend->fence.timestamp = now;
311+ pend->fence.timestamp = intr->timestamp;
313312 complete_all(&pend->fence.completion);
314313 }
315314 }
@@ -335,6 +334,10 @@ static void handle_user_interrupt(struct hl_device *hdev, struct hl_user_interru · 19 unmodified lines
335334 */
336335 irqreturn_t hl_irq_handler_user_interrupt(int irq, void *arg)
337336 {
337+ struct hl_user_interrupt *user_int = arg;
338+
339+ user_int->timestamp = ktime_get();
340+
338341 return IRQ_WAKE_THREAD;
339342 }
340343

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t