* [PATCH] nvme: do not update kato from a dsm io command
@ 2022-08-11 19:26 Keith Busch
2022-08-11 20:01 ` Keith Busch
0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2022-08-11 19:26 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Keith Busch
From: Keith Busch <kbusch@kernel.org>
The Set Features Admin command shares the same opcode as the DSM IO
command (0x9). If the DSM's 'nr' field happens to match the KATO feature
ID (0xf), the driver will use a bogus keep-alive frequency.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index af367b22871b..7d49ca115cc5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1111,7 +1111,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
return effects;
}
-static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
+static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, bool admin,
struct nvme_command *cmd, int status)
{
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
@@ -1128,6 +1128,9 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
flush_work(&ctrl->scan_work);
}
+ if (!admin)
+ return;
+
switch (cmd->common.opcode) {
case nvme_admin_set_features:
switch (le32_to_cpu(cmd->common.cdw10) & 0xFF) {
@@ -1160,7 +1163,7 @@ int nvme_execute_passthru_rq(struct request *rq)
effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
ret = nvme_execute_rq(rq, false);
if (effects) /* nothing to be done for zero cmd effects */
- nvme_passthru_end(ctrl, effects, cmd, ret);
+ nvme_passthru_end(ctrl, effects, ns == NULL, cmd, ret);
return ret;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] nvme: do not update kato from a dsm io command
2022-08-11 19:26 [PATCH] nvme: do not update kato from a dsm io command Keith Busch
@ 2022-08-11 20:01 ` Keith Busch
2022-08-12 5:33 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2022-08-11 20:01 UTC (permalink / raw)
To: Keith Busch; +Cc: linux-nvme, hch, sagi
Actually please disregard this. We don't reach the effects_end on io commands
as it is already.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme: do not update kato from a dsm io command
2022-08-11 20:01 ` Keith Busch
@ 2022-08-12 5:33 ` Christoph Hellwig
2022-08-12 14:46 ` Keith Busch
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-08-12 5:33 UTC (permalink / raw)
To: Keith Busch; +Cc: Keith Busch, linux-nvme, hch, sagi
On Thu, Aug 11, 2022 at 02:01:39PM -0600, Keith Busch wrote:
> Actually please disregard this. We don't reach the effects_end on io commands
> as it is already.
I thought we do, what prevents them from ending up there?
And we really should be more careful on admin vs I/O commands here
anyway.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nvme: do not update kato from a dsm io command
2022-08-12 5:33 ` Christoph Hellwig
@ 2022-08-12 14:46 ` Keith Busch
0 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2022-08-12 14:46 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Keith Busch, linux-nvme, sagi
On Fri, Aug 12, 2022 at 07:33:30AM +0200, Christoph Hellwig wrote:
> On Thu, Aug 11, 2022 at 02:01:39PM -0600, Keith Busch wrote:
> > Actually please disregard this. We don't reach the effects_end on io commands
> > as it is already.
>
> I thought we do, what prevents them from ending up there?
It's pretty subtle: the driver always returns '0' for IO commands, and the
passthrough end handling isn't called in that case. We're not expecting IO
commands to have effects that need special handling.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-12 14:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-11 19:26 [PATCH] nvme: do not update kato from a dsm io command Keith Busch
2022-08-11 20:01 ` Keith Busch
2022-08-12 5:33 ` Christoph Hellwig
2022-08-12 14:46 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox