Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] nvme: set passthrough command gendisk
@ 2020-10-14 20:38 Keith Busch
  2020-10-15  7:42 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2020-10-14 20:38 UTC (permalink / raw)
  To: linux-nvme, sagi, hch; +Cc: Keith Busch

The nvme event traces for IO commands are reporting the wrong QID
because we never set the request's gendisk. Set this parameter if the
passthrough command is being sent through an IO queue.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/nvme/host/core.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 95ef4943d8bd..ab5921e824d5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -894,9 +894,14 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 		unsigned timeout, int qid, int at_head,
 		blk_mq_req_flags_t flags, bool poll)
 {
+	struct nvme_ns *ns = q->queuedata;
+	struct gendisk *disk = NULL;
 	struct request *req;
 	int ret;
 
+	if (ns)
+		disk = ns->disk;
+
 	req = nvme_alloc_request(q, cmd, flags, qid);
 	if (IS_ERR(req))
 		return PTR_ERR(req);
@@ -910,9 +915,9 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
 	}
 
 	if (poll)
-		nvme_execute_rq_polled(req->q, NULL, req, at_head);
+		nvme_execute_rq_polled(req->q, disk, req, at_head);
 	else
-		blk_execute_rq(req->q, NULL, req, at_head);
+		blk_execute_rq(req->q, disk, req, at_head);
 	if (result)
 		*result = nvme_req(req)->result;
 	if (nvme_req(req)->flags & NVME_REQ_CANCELLED)
-- 
2.24.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: set passthrough command gendisk
  2020-10-14 20:38 [PATCH] nvme: set passthrough command gendisk Keith Busch
@ 2020-10-15  7:42 ` Christoph Hellwig
  2020-10-15 14:45   ` Keith Busch
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2020-10-15  7:42 UTC (permalink / raw)
  To: Keith Busch; +Cc: sagi, linux-nvme, hch

On Wed, Oct 14, 2020 at 01:38:45PM -0700, Keith Busch wrote:
> The nvme event traces for IO commands are reporting the wrong QID
> because we never set the request's gendisk. Set this parameter if the
> passthrough command is being sent through an IO queue.

Why do we event need the check for a non-NULL disk in nvme_req_qid?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: set passthrough command gendisk
  2020-10-15  7:42 ` Christoph Hellwig
@ 2020-10-15 14:45   ` Keith Busch
  2020-10-15 17:59     ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2020-10-15 14:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: sagi, linux-nvme

On Thu, Oct 15, 2020 at 09:42:22AM +0200, Christoph Hellwig wrote:
> On Wed, Oct 14, 2020 at 01:38:45PM -0700, Keith Busch wrote:
> > The nvme event traces for IO commands are reporting the wrong QID
> > because we never set the request's gendisk. Set this parameter if the
> > passthrough command is being sent through an IO queue.
> 
> Why do we event need the check for a non-NULL disk in nvme_req_qid?

It's the criteria we use to know if we're tracing an Admin vs IO
command. I suppose we could change the criteria we check rather than set
the disk parameter. Maybe rq->queue->queuedata instead of rq->bd_disk.
Would you prefer that?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nvme: set passthrough command gendisk
  2020-10-15 14:45   ` Keith Busch
@ 2020-10-15 17:59     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2020-10-15 17:59 UTC (permalink / raw)
  To: Keith Busch; +Cc: Christoph Hellwig, linux-nvme, sagi

On Thu, Oct 15, 2020 at 07:45:48AM -0700, Keith Busch wrote:
> On Thu, Oct 15, 2020 at 09:42:22AM +0200, Christoph Hellwig wrote:
> > On Wed, Oct 14, 2020 at 01:38:45PM -0700, Keith Busch wrote:
> > > The nvme event traces for IO commands are reporting the wrong QID
> > > because we never set the request's gendisk. Set this parameter if the
> > > passthrough command is being sent through an IO queue.
> > 
> > Why do we event need the check for a non-NULL disk in nvme_req_qid?
> 
> It's the criteria we use to know if we're tracing an Admin vs IO
> command. I suppose we could change the criteria we check rather than set
> the disk parameter. Maybe rq->queue->queuedata instead of rq->bd_disk.
> Would you prefer that?

Yes, I think that makes much more sense.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 20:38 [PATCH] nvme: set passthrough command gendisk Keith Busch
2020-10-15  7:42 ` Christoph Hellwig
2020-10-15 14:45   ` Keith Busch
2020-10-15 17:59     ` Christoph Hellwig

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git