Commit 429d77ca authored by Oded Gabbay's avatar Oded Gabbay
Browse files

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: default avatarOded Gabbay <ogabbay@kernel.org>
parent b07e6c7e
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -2102,6 +2102,12 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
			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,6 +2165,7 @@ static int hl_interrupt_wait_ioctl(struct hl_fpriv *hpriv, void *data)
	memset(args, 0, sizeof(*args));

	if (rc) {
		if (rc != -EINTR)
			dev_err_ratelimited(hdev->dev,
				"interrupt_wait_ioctl failed (%d)\n", rc);