linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Raghav <p.raghav@samsung.com>
To: <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
	Daniel Wagner <dwagner@suse.de>,
	Alan Adamson <alan.adamson@oracle.com>
Cc: <gost.dev@samsung.com>, <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH] nvme: ignore starting sector while error logging for passthrough requests
Date: Tue, 18 Oct 2022 15:48:57 +0200	[thread overview]
Message-ID: <3f6f41b5-c743-83f7-a8f4-ab3ee2f16b3a@samsung.com> (raw)
In-Reply-To: <20221006091053.36611-1-p.raghav@samsung.com>

The final consensus in Daniel's patch[1] seems to be adding an opt in to
log error only for admin commands, and logging error for user IO commands
will remain as is.

In that case, should we reconsider this patch to avoid printing a garbage
value ((sector_t)-1) while logging error for IO passthrough commands?

[1]
https://lore.kernel.org/all/79E937D0-58DA-4AE2-A0B8-A30185CE7FCE@oracle.com/

On 2022-10-06 11:10, Pankaj Raghav wrote:
> Error log will print a garbage value as the starting LBA for passthrough
> requests and requests with uninitialized starting sector that return an
> error. Print LBA as 0 instead for these requests. This behaviour is
> similar what tracing does for these type of requests.
> 
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> ---
>  drivers/nvme/host/core.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 059737c1a2c1..41e0a257f1c2 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -305,6 +305,13 @@ static void nvme_retry_req(struct request *req)
>  	blk_mq_delay_kick_requeue_list(req->q, delay);
>  }
>  
> +static inline u64 nvme_log_error_rq_lba(struct nvme_ns *ns, struct request *rq)
> +{
> +	if (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1)
> +		return 0;
> +	return nvme_sect_to_lba(ns, blk_rq_pos(rq));
> +}
> +
>  static void nvme_log_error(struct request *req)
>  {
>  	struct nvme_ns *ns = req->q->queuedata;
> @@ -315,7 +322,7 @@ static void nvme_log_error(struct request *req)
>  		       ns->disk ? ns->disk->disk_name : "?",
>  		       nvme_get_opcode_str(nr->cmd->common.opcode),
>  		       nr->cmd->common.opcode,
> -		       (unsigned long long)nvme_sect_to_lba(ns, blk_rq_pos(req)),
> +		       (unsigned long long)nvme_log_error_rq_lba(ns, req),
>  		       (unsigned long long)blk_rq_bytes(req) >> ns->lba_shift,
>  		       nvme_get_error_status_str(nr->status),
>  		       nr->status >> 8 & 7,	/* Status Code Type */


  reply	other threads:[~2022-10-18 13:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20221006091054eucas1p1e4113b6dfd108907c2cd5ba7127a3f92@eucas1p1.samsung.com>
2022-10-06  9:10 ` [PATCH] nvme: ignore starting sector while error logging for passthrough requests Pankaj Raghav
2022-10-18 13:48   ` Pankaj Raghav [this message]
2022-10-18 14:45     ` Christoph Hellwig
2022-10-18 15:23       ` Keith Busch
2022-10-18 15:26         ` Christoph Hellwig
2022-10-18 16:35       ` 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=3f6f41b5-c743-83f7-a8f4-ab3ee2f16b3a@samsung.com \
    --to=p.raghav@samsung.com \
    --cc=alan.adamson@oracle.com \
    --cc=dwagner@suse.de \
    --cc=gost.dev@samsung.com \
    --cc=hch@lst.de \
    --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;
as well as URLs for NNTP newsgroup(s).