From: Kanchan Joshi <joshi.k@samsung.com>
To: Hari Mishal <harimishal1@gmail.com>,
Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
Cc: Hannes Reinecke <hare@suse.de>,
Nitesh Shetty <nj.shetty@samsung.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] nvme: fix racy access to FDP placement ID array
Date: Mon, 27 Jul 2026 19:01:15 +0530 [thread overview]
Message-ID: <7c3e3243-0c9a-436b-b5c2-e6092e181435@samsung.com> (raw)
In-Reply-To: <20260725135111.14041-2-harimishal1@gmail.com>
On 7/25/2026 7:21 PM, Hari Mishal wrote:
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1018,15 +1018,19 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
> if (req->cmd_flags & REQ_RAHEAD)
> dsmgmt |= NVME_RW_DSM_FREQ_PREFETCH;
>
> - if (op == nvme_cmd_write && ns->head->nr_plids) {
> - u16 write_stream = req->bio->bi_write_stream;
> -
> - if (WARN_ON_ONCE(write_stream > ns->head->nr_plids))
> - return BLK_STS_INVAL;
> -
> - if (write_stream) {
> - dsmgmt |= ns->head->plids[write_stream - 1] << 16;
> - control |= NVME_RW_DTYPE_DPLCMT;
> + if (op == nvme_cmd_write) {
> + scoped_guard(spinlock, &ns->head->fdp_lock) {
> + u16 write_stream = req->bio->bi_write_stream;
> +
> + if (ns->head->nr_plids) {
> + if (WARN_ON_ONCE(write_stream > ns->head->nr_plids))
> + return BLK_STS_INVAL;
> +
> + if (write_stream) {
> + dsmgmt |= ns->head->plids[write_stream - 1] << 16;
> + control |= NVME_RW_DTYPE_DPLCMT;
> + }
> + }
It will be nice not to have the impact on the fast-path performance.
The spin-lock is being taken for each write, regardless of FDP-enabled
config. And for fdp-enabled config also, bi_write_stream may just be 0.
next prev parent reply other threads:[~2026-07-27 13:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 13:51 [PATCH 0/2] " Hari Mishal
2026-07-25 13:51 ` [PATCH 1/2] " Hari Mishal
2026-07-27 13:31 ` Kanchan Joshi [this message]
2026-07-27 14:22 ` Kanchan Joshi
2026-07-29 11:47 ` Hari Mishal
2026-07-30 5:11 ` Kanchan Joshi
2026-08-03 13:58 ` Hari Mishal
2026-07-25 13:51 ` [PATCH 2/2] nvme: drop WARN_ON_ONCE on write_stream bounds check Hari Mishal
2026-07-27 14:24 ` Keith Busch
2026-07-27 19:19 ` Greg Kroah-Hartman
2026-07-27 22:51 ` Keith Busch
2026-07-28 5:15 ` Greg Kroah-Hartman
2026-07-28 5:18 ` Christoph Hellwig
2026-07-28 6:58 ` Greg Kroah-Hartman
2026-07-28 9:46 ` Keith Busch
2026-07-28 10:34 ` Greg Kroah-Hartman
2026-07-30 11:41 ` Christoph Hellwig
2026-07-30 13:18 ` Greg Kroah-Hartman
2026-07-30 13:37 ` Christoph Hellwig
2026-07-30 14:04 ` Greg Kroah-Hartman
2026-07-30 14:27 ` Keith Busch
2026-07-30 15:02 ` Greg Kroah-Hartman
2026-07-30 19:33 ` Keith Busch
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=7c3e3243-0c9a-436b-b5c2-e6092e181435@samsung.com \
--to=joshi.k@samsung.com \
--cc=axboe@kernel.dk \
--cc=gregkh@linuxfoundation.org \
--cc=hare@suse.de \
--cc=harimishal1@gmail.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nj.shetty@samsung.com \
--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
all inboxes | Powered by JetHome®