From: Daniel Wagner <dwagner@suse.de>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: Keith Busch <kbusch@kernel.org>, Hannes Reinecke <hare@suse.de>,
"Ewan D. Milne" <emilne@redhat.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2] nvme-tcp: Check if request has started before processing it
Date: Mon, 17 May 2021 16:58:05 +0200 [thread overview]
Message-ID: <20210517145805.end32zjhqfjh6kga@beryllium.lan> (raw)
In-Reply-To: <7a45dd7f-842b-4282-909b-082b501abcdc@grimberg.me>
Hi Sagi,
On Fri, May 07, 2021 at 04:22:30PM -0700, Sagi Grimberg wrote:
> Yea, maybe something like this?
I did give this a spin with blktests (loopback device) and on real
hardware (FC). Seems to do work fine. Just two things.
> +/*
> + * nvme command_id is constructed as such:
> + * | xxxx | xxxxxxxxxxxx |
> + * gen request tag
> + */
> +#define nvme_cid_install_genctr(gen) ((gen & 0xf) << 12)
> +#define nvme_genctr_from_cid(cid) ((cid & 0xf000) >> 12)
> +#define nvme_tag_from_cid(cid) (cid & 0xfff)
> +
> +static inline u16 nvme_cid(struct request *rq)
> +{
> + return nvme_cid_install_genctr(nvme_req(rq)->genctr++) | rq->tag;
> +}
- return nvme_cid_install_genctr(nvme_req(rq)->genctr++) | rq->tag;
+ nvme_req(rq)->genctr = ++nvme_req(rq)->genctr & 0xf;
+ return nvme_cid_install_genctr(nvme_req(rq)->genctr) | rq->tag;
The first issue, it really needs prefix increment if you want to write
it in one line. And it should store only the first 4 bits.
nvme_find_rq() would complain with 0x0 != 0x10 after the first overflow.
> +static inline struct request *nvme_find_rq(struct blk_mq_tags *tags,
> + u16 command_id)
> +{
> + u8 genctr = nvme_genctr_from_cid(command_id);
> + u16 tag = nvme_tag_from_cid(command_id);
> + struct request *rq;
> +
> + rq = blk_mq_tag_to_rq(tags, tag);
> + if (unlikely(!rq)) {
> + pr_err("could not locate request for tag %#x\n",
> + tag);
> + return NULL;
> + }
> + if (unlikely(nvme_req(rq)->genctr != genctr)) {
> + dev_err(nvme_req(rq)->ctrl->device,
> + "request %#x genctr mismatch (got %#x expected
> %#x)\n",
> + tag, nvme_req(rq)->genctr, genctr);
- tag, nvme_req(rq)->genctr, genctr);
+ tag, genctr, nvme_req(rq)->genctr);
The arguments are in the wrong order. Got me a bit confused.
Are you going to send out a proper patch? I'd like to move things
forward and could offer to do some more testing if needed.
Thanks,
Daniel
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
prev parent reply other threads:[~2021-05-17 14:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 17:56 [PATCH v2] nvme-tcp: Check if request has started before processing it Daniel Wagner
2021-03-05 19:57 ` Sagi Grimberg
2021-03-11 9:43 ` Daniel Wagner
2021-03-15 17:16 ` Sagi Grimberg
2021-03-30 16:19 ` Ewan D. Milne
2021-03-30 17:34 ` Sagi Grimberg
2021-03-30 23:28 ` Keith Busch
2021-03-31 7:11 ` Hannes Reinecke
2021-03-31 21:01 ` Ewan D. Milne
2021-03-31 22:24 ` Sagi Grimberg
2021-04-01 6:20 ` Christoph Hellwig
2021-04-01 8:25 ` Sagi Grimberg
2021-03-31 22:37 ` Sagi Grimberg
2021-05-06 15:36 ` Hannes Reinecke
2021-05-07 20:26 ` Sagi Grimberg
2021-05-07 20:40 ` Keith Busch
2021-05-07 23:22 ` Sagi Grimberg
2021-05-08 0:03 ` Keith Busch
2021-05-09 11:30 ` Hannes Reinecke
2021-05-11 18:16 ` Sagi Grimberg
2021-05-17 14:58 ` Daniel Wagner [this message]
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=20210517145805.end32zjhqfjh6kga@beryllium.lan \
--to=dwagner@suse.de \
--cc=axboe@fb.com \
--cc=emilne@redhat.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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).