public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Jonathan Derrick <jonathan.derrick@linux.dev>
To: Christoph Hellwig <hch@infradead.org>, Keith Busch <kbusch@kernel.org>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [bug report]nvme0: Admin Cmd(0x6), I/O Error (sct 0x0 / sc 0x2) MORE DNR observed during blktests
Date: Tue, 5 Apr 2022 12:21:54 -0600	[thread overview]
Message-ID: <3e96e81f-8650-800a-ba35-1e89c7e82e43@linux.dev> (raw)
In-Reply-To: <YkveT9/oBMoykEsy@infradead.org>



On 4/5/2022 12:14 AM, Christoph Hellwig wrote:
> On Mon, Apr 04, 2022 at 02:30:12PM -0600, Keith Busch wrote:
>>> Eg, nvme0: blah blah command set not supported
>>
>> The new print in the completion handler is pretty generic. I don't think it can
>> readily tell the difference from a harmless error. Maybe pr_err is too high?
>>
>> Or maybe since enough people have been concerned about *this* specific
>> identify, maybe it should be restricted to 2.0 devices where it's mandatory. I
>> was reluctant to do that at first since the initial device I tested was 1.4,
>> but it was a prototype and we should be fine without the non-mdts limits
>> anyway.
> 
> What SCSI does is to add RQF_QUIET to all internal passthrough commands,
> and then skips printing the SCSI specific error messages in addition
> if that flag is set.
> 
> This would be the nvme version of that:
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 7e07dd69262a7..9346cd4cf5820 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -366,7 +366,8 @@ static inline void nvme_end_req(struct request *req)
>  {
>  	blk_status_t status = nvme_error_status(nvme_req(req)->status);
>  
> -	if (unlikely(nvme_req(req)->status != NVME_SC_SUCCESS))
> +	if (unlikely(nvme_req(req)->status != NVME_SC_SUCCESS &&
> +		     !(req->rq_flags & RQF_QUIET)))
>  		nvme_log_error(req);
>  	nvme_end_req_zoned(req);
>  	nvme_trace_bio_complete(req);
> @@ -648,6 +649,7 @@ void nvme_init_request(struct request *req, struct nvme_command *cmd)
>  	cmd->common.flags &= ~NVME_CMD_SGL_ALL;
>  
>  	req->cmd_flags |= REQ_FAILFAST_DRIVER;
> +	req->rq_flags |= RQF_QUIET;
>  	if (req->mq_hctx->type == HCTX_TYPE_POLL)
>  		req->cmd_flags |= REQ_POLLED;
>  	nvme_clear_nvme_request(req);


That's good too.
How about this so it's limited to debug loglevels:

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f204c6f78b5b..871ad2421284 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -303,9 +303,10 @@ static void nvme_log_error(struct request *req)
 {
        struct nvme_ns *ns = req->q->queuedata;
        struct nvme_request *nr = nvme_req(req);
+       int level = req->rq_flags & RQF_QUIET ? KERN_DEBUG : KERN_ERR;

        if (ns) {
-               pr_err_ratelimited("%s: %s(0x%x) @ LBA %llu, %llu blocks, %s (sct 0x%x / sc 0x%x) %s%s\n",
+               printk_ratelimited(level "%s: %s(0x%x) @ LBA %llu, %llu blocks, %s (sct 0x%x / sc 0x%x) %s%s\n",
                       ns->disk ? ns->disk->disk_name : "?",
                       nvme_get_opcode_str(nr->cmd->common.opcode),
                       nr->cmd->common.opcode,
@@ -319,7 +320,7 @@ static void nvme_log_error(struct request *req)
                return;
        }

-       pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s\n",
+       printk_ratelimited(level "%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s\n",
                           dev_name(nr->ctrl->device),
                           nvme_get_admin_opcode_str(nr->cmd->common.opcode),
                           nr->cmd->common.opcode,
@@ -651,6 +652,7 @@ void nvme_init_request(struct request *req, struct nvme_command *cmd)
        cmd->common.flags &= ~NVME_CMD_SGL_ALL;

        req->cmd_flags |= REQ_FAILFAST_DRIVER;
+       req->rq_flags |= RQF_QUIET;
        if (req->mq_hctx->type == HCTX_TYPE_POLL)
                req->cmd_flags |= REQ_POLLED;
        nvme_clear_nvme_request(req);


  reply	other threads:[~2022-04-05 18:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-03 14:28 [bug report]nvme0: Admin Cmd(0x6), I/O Error (sct 0x0 / sc 0x2) MORE DNR observed during blktests Yi Zhang
2022-04-04 16:39 ` Alan Adamson
2022-04-04 17:02   ` Keith Busch
2022-04-04 19:34     ` Jonathan Derrick
2022-04-04 20:30       ` Keith Busch
2022-04-05  0:43         ` Jonathan Derrick
2022-04-06 17:34           ` Keith Busch
2022-04-05  6:14         ` Christoph Hellwig
2022-04-05 18:21           ` Jonathan Derrick [this message]
2022-04-05 20:51             ` Alan Adamson
2022-04-05 21:56               ` Jonathan Derrick
2022-04-05 19:09           ` Alan Adamson
2022-04-05 20:00 ` Jason A. Donenfeld
2022-04-05 20:48   ` Alan Adamson
2022-06-09  8:20   ` 2 second nvme initialization delay regression in 5.18 [Was: Re: [bug report]nvme0: Admin Cmd(0x6), I/O Error (sct 0x0 / sc 0x2) MORE DNR observed during blktests] Jason A. Donenfeld
2022-06-09  8:34     ` Jason A. Donenfeld
2022-06-09  8:40       ` [PATCH] Revert "nvme-pci: add quirks for Samsung X5 SSDs" Jason A. Donenfeld
2022-06-09  9:32       ` 2 second nvme initialization delay regression in 5.18 [Was: Re: [bug report]nvme0: Admin Cmd(0x6), I/O Error (sct 0x0 / sc 0x2) MORE DNR observed during blktests] R, Monish Kumar
2022-06-09  9:38         ` Jason A. Donenfeld
2022-06-10  6:14           ` Christoph Hellwig
2022-06-10  9:19             ` Jason A. Donenfeld
2022-06-13  6:36               ` R, Monish Kumar
2022-06-13 12:20                 ` Jason A. Donenfeld
2022-06-13 13:02                   ` R, Monish Kumar
2022-06-13 13:55               ` Christoph Hellwig
2022-06-15 10:27                 ` Pankaj Raghav
2022-06-15 11:31                   ` Christoph Hellwig
2022-06-20  3:36                     ` onenowy
2022-06-20  7:09                       ` Christoph Hellwig
2022-06-20  4:34                     ` SungHwan Jung
2022-06-10 12:05             ` Pankaj Raghav

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=3e96e81f-8650-800a-ba35-1e89c7e82e43@linux.dev \
    --to=jonathan.derrick@linux.dev \
    --cc=hch@infradead.org \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    /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