From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>
Cc: Kanchan Joshi <joshi.k@samsung.com>, linux-nvme@lists.infradead.org
Subject: [PATCH 4/6] nvmet: don't defer passthrough commands with trivial effects to the workqueue
Date: Fri, 23 Dec 2022 08:18:12 +0100 [thread overview]
Message-ID: <20221223071814.43564-5-hch@lst.de> (raw)
In-Reply-To: <20221223071814.43564-1-hch@lst.de>
Mask out the "Command Supported" and "Logical Block Content Change" bits
and only defer execution of commands that have non-trivial effects to
the workqueue for synchronous execution. This allows to execture admin
commands asynchronously on controllers that provide a Command Supported
and Effects log page, and will keep allowing to execute Write commands
asynchronously once command effects on I/O commands are taken into
account.
Fixes: c1fef73f793b ("nvmet: add passthru code to process commands")
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/nvme/target/passthru.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
index 79af5140af8bfe..adc0958755d66f 100644
--- a/drivers/nvme/target/passthru.c
+++ b/drivers/nvme/target/passthru.c
@@ -334,14 +334,13 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
}
/*
- * If there are effects for the command we are about to execute, or
- * an end_req function we need to use nvme_execute_passthru_rq()
- * synchronously in a work item seeing the end_req function and
- * nvme_passthru_end() can't be called in the request done callback
- * which is typically in interrupt context.
+ * If a command needs post-execution fixups, or there are any
+ * non-trivial effects, make sure to execute the command synchronously
+ * in a workqueue so that nvme_passthru_end gets called.
*/
effects = nvme_command_effects(ctrl, ns, req->cmd->common.opcode);
- if (req->p.use_workqueue || effects) {
+ if (req->p.use_workqueue ||
+ (effects & ~(NVME_CMD_EFFECTS_CSUPP | NVME_CMD_EFFECTS_LBCC))) {
INIT_WORK(&req->p.work, nvmet_passthru_execute_cmd_work);
req->p.rq = rq;
queue_work(nvmet_wq, &req->p.work);
--
2.35.1
next prev parent reply other threads:[~2022-12-23 7:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-23 7:18 only allow unprivileged passthrough for commands without effects v4 Christoph Hellwig
2022-12-23 7:18 ` [PATCH 1/6] nvme: fix the NVME_CMD_EFFECTS_CSE_MASK definition Christoph Hellwig
2022-12-25 10:06 ` Sagi Grimberg
2022-12-23 7:18 ` [PATCH 2/6] nvmet: use NVME_CMD_EFFECTS_CSUPP instead of open coding it Christoph Hellwig
2022-12-25 10:06 ` Sagi Grimberg
2022-12-23 7:18 ` [PATCH 3/6] nvmet: set the LBCC bit for commands that modify data Christoph Hellwig
2022-12-25 10:06 ` Sagi Grimberg
2022-12-23 7:18 ` Christoph Hellwig [this message]
2022-12-25 10:14 ` [PATCH 4/6] nvmet: don't defer passthrough commands with trivial effects to the workqueue Sagi Grimberg
2022-12-23 7:18 ` [PATCH 5/6] nvme: also return I/O command effects from nvme_command_effects Christoph Hellwig
2022-12-25 10:26 ` Sagi Grimberg
2022-12-27 16:57 ` Christoph Hellwig
2022-12-28 13:49 ` Sagi Grimberg
2022-12-28 15:12 ` Christoph Hellwig
2022-12-29 5:35 ` Kanchan Joshi
2022-12-23 7:18 ` [PATCH 6/6] nvme: consult the CSE log page for unprivileged passthrough Christoph Hellwig
2022-12-25 10:27 ` Sagi Grimberg
2022-12-28 16:04 ` only allow unprivileged passthrough for commands without effects v4 Keith Busch
2022-12-28 16:05 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2022-12-21 10:10 only allow unprivileged passthrough for commands without effects v3 Christoph Hellwig
2022-12-21 10:10 ` [PATCH 4/6] nvmet: don't defer passthrough commands with trivial effects to the workqueue Christoph Hellwig
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=20221223071814.43564-5-hch@lst.de \
--to=hch@lst.de \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--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