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
1107 * @type: user interrupt type1107 * @type: user interrupt type
1108 * @wait_list_head: head to the list of user threads pending on this interrupt1108 * @wait_list_head: head to the list of user threads pending on this interrupt
1109 * @wait_list_lock: protects wait_list_head1109 * @wait_list_lock: protects wait_list_head
1110 * @timestamp: last timestamp taken upon interrupt
1110 * @interrupt_id: msix interrupt id1111 * @interrupt_id: msix interrupt id
1111 */1112 */
1112struct hl_user_interrupt {1113struct hl_user_interrupt {
@@ -1114,6 +1115,7 @@ struct hl_user_interrupt { · 1 unmodified line
1114 enum hl_user_interrupt_type type;1115 enum hl_user_interrupt_type type;
1115 struct list_head wait_list_head;1116 struct list_head wait_list_head;
1116 spinlock_t wait_list_lock;1117 spinlock_t wait_list_lock;
1118 ktime_t timestamp;
1117 u32 interrupt_id;1119 u32 interrupt_id;
1118};1120};
1119 1121
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
280 struct list_head *ts_reg_free_list_head = NULL;280 struct list_head *ts_reg_free_list_head = NULL;
281 struct timestamp_reg_work_obj *job;281 struct timestamp_reg_work_obj *job;
282 bool reg_node_handle_fail = false;282 bool reg_node_handle_fail = false;
283 ktime_t now = ktime_get();
284 int rc;283 int rc;
285 284
286 /* For registration nodes:285 /* For registration nodes:
@@ -303,13 +302,13 @@ static void handle_user_interrupt(struct hl_device *hdev, struct hl_user_interru · 16 unmodified lines
303 if (pend->ts_reg_info.buf) {302 if (pend->ts_reg_info.buf) {
304 if (!reg_node_handle_fail) {303 if (!reg_node_handle_fail) {
305 rc = handle_registration_node(hdev, pend,304 rc = handle_registration_node(hdev, pend,
306 &ts_reg_free_list_head, now);305 &ts_reg_free_list_head, intr->timestamp);
307 if (rc)306 if (rc)
308 reg_node_handle_fail = true;307 reg_node_handle_fail = true;
309 }308 }
310 } else {309 } else {
311 /* Handle wait target value node */310 /* Handle wait target value node */
312 pend->fence.timestamp = now;311 pend->fence.timestamp = intr->timestamp;
313 complete_all(&pend->fence.completion);312 complete_all(&pend->fence.completion);
314 }313 }
315 }314 }
@@ -335,6 +334,10 @@ static void handle_user_interrupt(struct hl_device *hdev, struct hl_user_interru · 19 unmodified lines
335 */334 */
336irqreturn_t hl_irq_handler_user_interrupt(int irq, void *arg)335irqreturn_t hl_irq_handler_user_interrupt(int irq, void *arg)
337{336{
337 struct hl_user_interrupt *user_int = arg;
338
339 user_int->timestamp = ktime_get();
340
338 return IRQ_WAKE_THREAD;341 return IRQ_WAKE_THREAD;
339}342}
340 343

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