aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorOded Gabbay <ogabbay@kernel.org>2021-07-01 10:36:16 +0300
committerOded Gabbay <ogabbay@kernel.org>2021-08-29 09:47:45 +0300
commit429d77ca2760e0f42523fda72db59861c1b3aefc (patch)
tree5b9f195445c56dc1e4a02b97d113e529bf120c88 /drivers/misc
parenthabanalabs: release pending user interrupts on device fini (diff)
downloadlinux-dev-429d77ca2760e0f42523fda72db59861c1b3aefc.tar.xz
linux-dev-429d77ca2760e0f42523fda72db59861c1b3aefc.zip
habanalabs: handle case of interruptable wait
Same as we handle it in the regular wait for CS, we need to handle the case where the waiting for user interrupt was interrupted. In that case, we need to return correct error code to the user. Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/common/command_submission.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index 12f20446e99a..997a37e78241 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -2102,6 +2102,12 @@ wait_again:
spin_unlock(&interrupt->wait_list_lock);
goto wait_again;
}
+ } else if (completion_rc == -ERESTARTSYS) {
+ dev_err_ratelimited(hdev->dev,
+ "user process got signal while waiting for interrupt ID %d\n",
+ interrupt->interrupt_id);
+ *status = HL_WAIT_CS_STATUS_INTERRUPTED;
+ rc = -EINTR;
} else {
*status = CS_WAIT_STATUS_BUSY;
}
@@ -2159,8 +2165,9 @@ static int hl_interrupt_wait_ioctl(struct hl_fpriv *hpriv, void *data)
memset(args, 0, sizeof(*args));
if (rc) {
- dev_err_ratelimited(hdev->dev,
- "interrupt_wait_ioctl failed (%d)\n", rc);
+ if (rc != -EINTR)
+ dev_err_ratelimited(hdev->dev,
+ "interrupt_wait_ioctl failed (%d)\n", rc);
return rc;
}