From: Oded Gabbay <ogabbay@kernel.org>
To: dri-devel@lists.freedesktop.org
Cc: Tomer Tayar <ttayar@habana.ai>
Subject: [PATCH 04/12] accel/habanalabs: print task name and request code upon ioctl failure
Date: Thu, 8 Jun 2023 16:38:41 +0300 [thread overview]
Message-ID: <20230608133849.2739411-4-ogabbay@kernel.org> (raw)
In-Reply-To: <20230608133849.2739411-1-ogabbay@kernel.org>
From: Tomer Tayar <ttayar@habana.ai>
When an ioctl fails, it is useful to know what is the task command name
and the full ioctl request code, in addition to the task pid and the
ioctl number.
Add the additional information to the relevant debug error prints.
Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
.../habanalabs/common/habanalabs_ioctl.c | 24 +++++++++++++------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/accel/habanalabs/common/habanalabs_ioctl.c b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
index 6a45a92344e9..549b2518fae0 100644
--- a/drivers/accel/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
@@ -1194,9 +1194,13 @@ static long _hl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg,
retcode = -EFAULT;
out_err:
- if (retcode)
- dev_dbg_ratelimited(dev, "error in ioctl: pid=%d, cmd=0x%02x, nr=0x%02x\n",
- task_pid_nr(current), cmd, nr);
+ if (retcode) {
+ char task_comm[TASK_COMM_LEN];
+
+ dev_dbg_ratelimited(dev,
+ "error in ioctl: pid=%d, comm=\"%s\", cmd=%#010x, nr=%#04x\n",
+ task_pid_nr(current), get_task_comm(task_comm, current), cmd, nr);
+ }
if (kdata != stack_kdata)
kfree(kdata);
@@ -1219,8 +1223,11 @@ long hl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if ((nr >= HL_COMMAND_START) && (nr < HL_COMMAND_END)) {
ioctl = &hl_ioctls[nr];
} else {
- dev_dbg_ratelimited(hdev->dev, "invalid ioctl: pid=%d, nr=0x%02x\n",
- task_pid_nr(current), nr);
+ char task_comm[TASK_COMM_LEN];
+
+ dev_dbg_ratelimited(hdev->dev,
+ "invalid ioctl: pid=%d, comm=\"%s\", cmd=%#010x, nr=%#04x\n",
+ task_pid_nr(current), get_task_comm(task_comm, current), cmd, nr);
return -ENOTTY;
}
@@ -1242,8 +1249,11 @@ long hl_ioctl_control(struct file *filep, unsigned int cmd, unsigned long arg)
if (nr == _IOC_NR(HL_IOCTL_INFO)) {
ioctl = &hl_ioctls_control[nr];
} else {
- dev_dbg_ratelimited(hdev->dev_ctrl, "invalid ioctl: pid=%d, nr=0x%02x\n",
- task_pid_nr(current), nr);
+ char task_comm[TASK_COMM_LEN];
+
+ dev_dbg_ratelimited(hdev->dev_ctrl,
+ "invalid ioctl: pid=%d, comm=\"%s\", cmd=%#010x, nr=%#04x\n",
+ task_pid_nr(current), get_task_comm(task_comm, current), cmd, nr);
return -ENOTTY;
}
--
2.40.1
next prev parent reply other threads:[~2023-06-08 13:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 13:38 [PATCH 01/12] accel/habanalabs: prevent immediate hard reset due to 2 adjacent H/W events Oded Gabbay
2023-06-08 13:38 ` [PATCH 02/12] accel/habanalabs: update pending reset flags with new reset requests Oded Gabbay
2023-06-08 13:38 ` [PATCH 03/12] accel/habanalabs: notify user about undefined opcode event Oded Gabbay
2023-06-08 13:38 ` Oded Gabbay [this message]
2023-06-08 13:38 ` [PATCH 05/12] accel/habanalabs: print task name upon creation of a user context Oded Gabbay
2023-06-08 13:38 ` [PATCH 06/12] accel/habanalabs: set device status 'malfunction' while in rmmod Oded Gabbay
2023-06-08 13:38 ` [PATCH 07/12] accel/habanalabs: stop fetching MME SBTE error cause Oded Gabbay
2023-06-08 13:38 ` [PATCH 08/12] accel/habanalabs: handle arc farm razwi Oded Gabbay
2023-06-08 13:38 ` [PATCH 09/12] accel/habanalabs: fix standalone preboot descriptor request Oded Gabbay
2023-06-08 13:38 ` [PATCH 10/12] accel/habanalabs: print return code when process termination fails Oded Gabbay
2023-06-08 13:38 ` [PATCH 11/12] accel/habanalabs: call put_pid after hpriv list is updated Oded Gabbay
2023-06-08 13:38 ` [PATCH 12/12] accel/habanalabs: rename fd_list to hpriv_list Oded Gabbay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230608133849.2739411-4-ogabbay@kernel.org \
--to=ogabbay@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ttayar@habana.ai \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox