[PATCH RFC V2 0/7] Support for Cancel commands for host (TCP and RDMA)
Maurizio Lombardi
mlombard at redhat.com
Thu Sep 12 01:15:03 PDT 2024
The nvme host driver could take advantage of Cancel (defined by TP 4097a)
to abort a command that timed out instead of resetting the controller.
The abort command's implementation is mandated by the specs but
the target isn't necessarily required to perform any meaningful action
(as it happens, for example, with the Linux nvmet implementation, where the
abort command does nothing at all).
On the other hand, the Cancel command is optional, therefore if the target
claims to support it, it's reasonable to expect its implementation to
perform something useful.
This patchset modifies the tcp and rdma host drivers' timeout
handlers to check if the target supports the Cancel command; if so,
it will use it to try to abort the command that timed out.
If the number of reserved commands runs low, use the "multiple
commands" action to abort all the commands on the specificied queue
as a last resort to avoid a controller reset.
If Cancel isn't supported, if the allocation of the command fails, or
if the pool of reserved commands is completely exhausted,
the host will fall back to the normal controller reset.
example of output in dmesg where a command gets canceled and
the target performed 1 immediate abort:
nvme nvme7: I/O tag 105 (1069) type 4 opcode 0x1 (I/O Cmd) QID 13 timeout
nvme nvme7: Cancel status: 0x0 imm abrts = 1 def abrts = 0
Patch 7 is a modified nvmet drivers with a module parameter that enables
an extremely basic emulation of cancel command (it does nothing, it just
reports that no aborts were executed). it could be useful for
testing Cancel with blktests.
V2: Reserve 2 commands per queue for cancel commands (the number is fixed
but in future it can be made configurable with trivial changes to the code).
John Meneghini (1):
nvme: add definitions for cancel command
Maurizio Lombardi (6):
nvme-core: function to check if a controller supports a specific I/O
cmd
nvme-core: reserve tags for cancel commands
nvme-core: add a function to submit a cancel command
nvme-tcp: use the cancel command to perform an abort if target
supports it
nvme-rdma: use the cancel command to perform an abort if target
supports it
nvmet: emulate basic support for cancel commands
drivers/nvme/host/constants.c | 1 +
drivers/nvme/host/core.c | 77 ++++++++++++++++++++++++++++-
drivers/nvme/host/nvme.h | 3 ++
drivers/nvme/host/rdma.c | 43 ++++++++++++++--
drivers/nvme/host/tcp.c | 58 ++++++++++++++++++++--
drivers/nvme/target/Makefile | 2 +-
drivers/nvme/target/admin-cmd.c | 4 ++
drivers/nvme/target/core.c | 11 +++++
drivers/nvme/target/io-cmd-cancel.c | 52 +++++++++++++++++++
drivers/nvme/target/nvmet.h | 4 ++
include/linux/nvme.h | 22 +++++++++
11 files changed, 266 insertions(+), 11 deletions(-)
create mode 100644 drivers/nvme/target/io-cmd-cancel.c
--
2.43.5
More information about the Linux-nvme
mailing list