Skip to contentSkip to conversation

nvme: quiet user passthrough command errors

PATCH Superseded Keith Busch 7 participants 10 messages Oct 26, 2022 – Oct 27, 2022 NVMe

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: quiet user passthrough command errors

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>
---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
index 686c55cb5d1a..da874172a31d 100644
@@ -1156,6 +1156,7 @@ int nvme_execute_passthru_rq(struct request *rq, u32 *effects)
 	struct nvme_ns *ns = rq->q->queuedata;
 
 	*effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
+	rq->rq_flags |= RQF_QUIET;
 	return nvme_execute_rq(rq, false);
 }
 EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU);
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---

This should do the trick, however it will be great if reporter can provide tested-by.

-ck

#2 lore raw
Quoted 18 lines · Chaitanya Kulkarni
Quoted 11 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---

Quoted 8 lines

This should do the trick, however it will be great if reporter can provide tested-by.

-ck

I’ll be testing it today.

Alan

maintainer
#3 lore raw
In reply to Chaitanya Kulkarni
Quoted 8 lines · Chaitanya Kulkarni
Quoted 7 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Quoted 8 lines
Quoted 4 lines
Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---

This should do the trick, however it will be great if reporter can provide tested-by.

Pretty easy to test. Just send an invalid command from user space:

  # nvme admin-passthru /dev/nvme0 --opcode=0xff
  nvme0: Admin Cmd(0xff), I/O Error (sct 0x0 / sc 0x1) DNR

With the patch applied, the kernel message is suppressed.

Tested-by on v1 1/1
#4 lore raw
In reply to Keith Busch
Quoted 33 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---
drivers/nvme/host/core.c | 1 +

1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
index 686c55cb5d1a..da874172a31d 100644
@@ -1156,6 +1156,7 @@ int nvme_execute_passthru_rq(struct request *rq, u32 *effects)
 	struct nvme_ns *ns = rq->q->queuedata;
 
 	*effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
+	rq->rq_flags |= RQF_QUIET;
 	return nvme_execute_rq(rq, false);
 }
 EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU);
Signature · 1 line
2.30.2

I tested the change with blktests which uses user passthrough:

Before patch:

[   69.041515] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unrecovered Read Error (sct 0x2 / sc 0x81) DNR
[   69.041557] critical medium error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   69.055721] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unknown (sct 0x3 / sc 0x75) DNR
[   69.055754] I/O error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[   69.067335] nvme0n1: Write(0x1) @ LBA 0, 1 blocks, Write Fault (sct 0x2 / sc 0x80) DNR
[   69.067385] critical medium error, dev nvme0n1, sector 0 op 0x1:(WRITE) flags 0x8800 phys_seg 1 prio class 2
[   69.085449] nvme0: Identify(0x6), Access Denied (sct 0x2 / sc 0x86) DNR
[   69.103265] nvme0: Unknown(0x96), Invalid Command Opcode (sct 0x0 / sc 0x1) DNR

After patch:

[  167.375311] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unrecovered Read Error (sct 0x2 / sc 0x81) DNR
[  167.375362] critical medium error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[  167.388812] nvme0n1: Read(0x2) @ LBA 0, 1 blocks, Unknown (sct 0x3 / sc 0x75) DNR
[  167.388839] I/O error, dev nvme0n1, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 2
[  167.399907] nvme0n1: Write(0x1) @ LBA 0, 1 blocks, Write Fault (sct 0x2 / sc 0x80) DNR
[  167.399928] critical medium error, dev nvme0n1, sector 0 op 0x1:(WRITE) flags 0x8800 phys_seg 1 prio class 2

The messages that are due to passthrough are no longer present as expcted.

blktests will need to updated, specifically blktests/tests/nvme/039.out.

Alan

Reviewed-by on v1 1/1
#5 lore raw
In reply to Keith Busch
Quoted 19 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---
drivers/nvme/host/core.c | 1 +

1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +0 -0
index 686c55cb5d1a..da874172a31d 100644

drivers/nvme/host/core.c int nvme_execute_passthru_rq(struct request *rq, u32 *effects) · line 1161

Quoted 6 lines
drivers/nvme/host/core.c +1 -0
@@ -1156,6 +1156,7 @@ int nvme_execute_passthru_rq(struct request *rq, u32 *effects)
 	struct nvme_ns *ns = rq->q->queuedata;
 
 	*effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
+	rq->rq_flags |= RQF_QUIET;
 	return nvme_execute_rq(rq, false);
 }

Can we do this for uring-passthrough path too? Like below patch -

drivers/nvme/host/ioctl.c +1 -0
index 81f5550b670d..a91cefc38506 100644
@@ -556,6 +556,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
       } else {
               req->end_io = nvme_uring_cmd_end_io;
       }
+       req->rq_flags |= RQF_QUIET;
       blk_execute_rq_nowait(req, false);
       return -EIOCBQUEUED;

}

Looks good otherwise.

maintainer
#6 lore raw
Quoted 42 lines · Kanchan Joshi
Quoted 19 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---
drivers/nvme/host/core.c | 1 +

1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +0 -0
index 686c55cb5d1a..da874172a31d 100644

drivers/nvme/host/core.c int nvme_execute_passthru_rq(struct request *rq, u32 *effects) · line 1161

Quoted 6 lines
drivers/nvme/host/core.c +1 -0
@@ -1156,6 +1156,7 @@ int nvme_execute_passthru_rq(struct request *rq, u32 *effects)
     struct nvme_ns *ns = rq->q->queuedata;
 
     *effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
+    rq->rq_flags |= RQF_QUIET;
     return nvme_execute_rq(rq, false);
 }

Can we do this for uring-passthrough path too? Like below patch -

drivers/nvme/host/ioctl.c +1 -0
index 81f5550b670d..a91cefc38506 100644
@@ -556,6 +556,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
        } else {
                req->end_io = nvme_uring_cmd_end_io;
        }
+       req->rq_flags |= RQF_QUIET;
        blk_execute_rq_nowait(req, false);
        return -EIOCBQUEUED;
 }
Quoted 2 lines

Looks good otherwise.

Agree, we should do it for this path too.

Signature · 1 line
Jens Axboe
maintainer
#7 lore raw
Quoted 43 lines · Jens Axboe
Quoted 42 lines · Kanchan Joshi
Quoted 19 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---
drivers/nvme/host/core.c | 1 +

1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +0 -0
index 686c55cb5d1a..da874172a31d 100644

drivers/nvme/host/core.c int nvme_execute_passthru_rq(struct request *rq, u32 *effects) · line 1161

Quoted 6 lines
drivers/nvme/host/core.c +1 -0
@@ -1156,6 +1156,7 @@ int nvme_execute_passthru_rq(struct request *rq, u32 *effects)
     struct nvme_ns *ns = rq->q->queuedata;
 
     *effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
+    rq->rq_flags |= RQF_QUIET;
     return nvme_execute_rq(rq, false);
 }

Can we do this for uring-passthrough path too? Like below patch -

drivers/nvme/host/ioctl.c +1 -0
index 81f5550b670d..a91cefc38506 100644
@@ -556,6 +556,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
        } else {
                req->end_io = nvme_uring_cmd_end_io;
        }
+       req->rq_flags |= RQF_QUIET;
        blk_execute_rq_nowait(req, false);
        return -EIOCBQUEUED;
 }
Quoted 4 lines
Quoted 2 lines

Looks good otherwise.

Agree, we should do it for this path too.

Okay, that would make 4 places the driver is setting the QUIET flag, which is all of the passthrough requests. Instead of doing them individually, I'll just move the setting to their common helper:
nvme_init_command().

#8 lore raw
Quoted 54 lines · Keith Busch
Quoted 43 lines · Jens Axboe
Quoted 43 lines · Kanchan Joshi
Quoted 19 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

---
drivers/nvme/host/core.c | 1 +

1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +0 -0
index 686c55cb5d1a..da874172a31d 100644

drivers/nvme/host/core.c int nvme_execute_passthru_rq(struct request *rq, u32 *effects) · line 1161

Quoted 6 lines
drivers/nvme/host/core.c +1 -0
@@ -1156,6 +1156,7 @@ int nvme_execute_passthru_rq(struct request *rq, u32 *effects)
    struct nvme_ns *ns = rq->q->queuedata;
 
    *effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
+    rq->rq_flags |= RQF_QUIET;
    return nvme_execute_rq(rq, false);
 }

Can we do this for uring-passthrough path too? Like below patch -

drivers/nvme/host/ioctl.c +1 -0
index 81f5550b670d..a91cefc38506 100644
@@ -556,6 +556,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
       } else {
               req->end_io = nvme_uring_cmd_end_io;
       }
+       req->rq_flags |= RQF_QUIET;
       blk_execute_rq_nowait(req, false);
       return -EIOCBQUEUED;
 }
Quoted 4 lines
Quoted 2 lines

Looks good otherwise.

Agree, we should do it for this path too.

Quoted 5 lines

Okay, that would make 4 places the driver is setting the QUIET flag, which is all of the passthrough requests. Instead of doing them individually, I'll just move the setting to their common helper:
nvme_init_command().

Yes please.

-ck

#9 lore raw
In reply to Keith Busch
Quoted 11 lines · Keith Busch

From: Keith Busch <[email protected]>

The driver is spamming the kernel logs for entirely harmless errors from user space submitting unsupported commmands. Just silence the errors. The application has direct access to command status, so there's no need to log these.

Cc Daniel Wagner <[email protected]>
Cc Alan Adamson <[email protected]>

Shouldn't we also add a Fixes tag here?