Linux-NVME Archive mirror
 help / color / mirror / Atom feed
From: Maurizio Lombardi <mlombard@redhat.com>
To: kbusch@meta.com
Cc: hare@kernel.org, sagi@grimberg.me, emilne@redhat.com,
	jmeneghi@redhat.com, linux-nvme@lists.infradead.org
Subject: [PATCH 0/5] Support for Cancel commands for host (TCP and RDMA)
Date: Fri, 10 May 2024 18:30:21 +0200	[thread overview]
Message-ID: <20240510163026.786898-1-mlombard@redhat.com> (raw)

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 really required to perform any meaningful work
(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 yes,
it will use it to try to abort the command that timed out.
If Cancel isn't supported or if the abort operation fails,
the host will perform a controller reset.

Tests were carried out both against a modified nvmet driver
(see PATCH 5) and against real hardware devices.

example of output in dmesg:
nvme nvme4: I/O tag 73 (4049) type 4 opcode 0x1 (Write) QID 8 timeout
nvme nvme4: Cancel status: 0x0 imm abrts = 0 def abrts = 1


John Meneghini (1):
  nvme: add definitions for cancel command

Maurizio Lombardi (4):
  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: target support for cancel commands

 drivers/nvme/host/constants.c       |  1 +
 drivers/nvme/host/core.c            | 55 ++++++++++++++++++++
 drivers/nvme/host/nvme.h            |  2 +
 drivers/nvme/host/rdma.c            | 28 ++++++++--
 drivers/nvme/host/tcp.c             | 19 +++++++
 drivers/nvme/target/Makefile        |  2 +-
 drivers/nvme/target/admin-cmd.c     | 36 +++++++++++++
 drivers/nvme/target/core.c          | 45 ++++++++++++++++
 drivers/nvme/target/io-cmd-cancel.c | 81 +++++++++++++++++++++++++++++
 drivers/nvme/target/io-cmd-file.c   | 19 +++++++
 drivers/nvme/target/nvmet.h         | 10 ++++
 include/linux/nvme.h                | 19 +++++++
 12 files changed, 312 insertions(+), 5 deletions(-)
 create mode 100644 drivers/nvme/target/io-cmd-cancel.c

-- 
2.39.3



             reply	other threads:[~2024-05-10 16:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 16:30 Maurizio Lombardi [this message]
2024-05-10 16:30 ` [PATCH 1/5] nvme: add definitions for cancel command Maurizio Lombardi
2024-05-10 16:30 ` [PATCH 2/5] nvme-core: add a function to submit a " Maurizio Lombardi
2024-05-12 14:06   ` Sagi Grimberg
2024-05-10 16:30 ` [PATCH 3/5] nvme-tcp: use the cancel command to perform an abort if target supports it Maurizio Lombardi
2024-05-10 16:30 ` [PATCH 4/5] nvme-rdma: " Maurizio Lombardi
2024-05-10 16:30 ` [donotmerge PATCH 5/5] nvmet: target support for cancel commands Maurizio Lombardi

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=20240510163026.786898-1-mlombard@redhat.com \
    --to=mlombard@redhat.com \
    --cc=emilne@redhat.com \
    --cc=hare@kernel.org \
    --cc=jmeneghi@redhat.com \
    --cc=kbusch@meta.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).