From: Jesse Taube <jtaubepe@redhat.com>
To: linux-nvme@lists.infradead.org
Cc: linux-scsi@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
Justin Tee <justin.tee@broadcom.com>,
Naresh Gottumukkala <nareshgottumukkala83@gmail.com>,
Paul Ely <paul.ely@broadcom.com>,
Chaitanya Kulkarni <kch@nvidia.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Nilesh Javali <njavali@marvell.com>,
GR-QLogic-Storage-Upstream@marvell.com,
Hannes Reinecke <hare@suse.de>, Jesse Taube <jtaubepe@redhat.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
John Meneghini <jmeneghi@redhat.com>,
Bryan Gurney <bgurney@redhat.com>,
Chris Leech <cleech@redhat.com>,
"Ewan D . Milne" <emilne@redhat.com>,
shinichiro.kawasaki@wdc.com, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: [PATCH v2 2/7] nvme-multipath: numa support for marginal paths
Date: Wed, 2 Sep 2026 16:05:42 -0400 [thread overview]
Message-ID: <20260902200547.184734-3-jtaubepe@redhat.com> (raw)
In-Reply-To: <20260902200547.184734-1-jtaubepe@redhat.com>
FPIN LI (link integrity) messages are received when the attached
fabric detects hardware errors. In response to these messages I/O
should be directed away from the affected ports, and only used
if no other non-marginal paths are available.
To handle this a new controller flag 'NVME_CTRL_MARGINAL' is added
which will cause the multipath scheduler to skip these paths when
checking for 'optimized' paths.
Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
---
This is a distinct change from the previous commit
which treated marginal paths as non-optimized but still usable.
This changes the priority of marginal paths to be lower than
non-optimized paths.
V10 -> V1:
- New commit
V1 -> V2:
- Rewrite
---
drivers/nvme/host/multipath.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 9b9a657fa330..dbf09cdda815 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -305,16 +305,45 @@ static bool nvme_path_is_disabled(struct nvme_ns *ns)
return false;
}
+static bool nvme_path_is_usable(struct nvme_ns *ns)
+{
+ /* Only NVME_ANA_OPTIMIZED and NVME_ANA_NONOPTIMIZED are usable */
+ return !nvme_path_is_disabled(ns) &&
+ (ns->ana_state == NVME_ANA_OPTIMIZED ||
+ ns->ana_state == NVME_ANA_NONOPTIMIZED);
+}
+
+static bool nvme_all_paths_marginal(struct nvme_ns_head *head)
+{
+ struct nvme_ns *ns;
+
+ list_for_each_entry_srcu(ns, &head->list, siblings,
+ srcu_read_lock_held(&head->srcu)) {
+ /* skip paths which can not be used */
+ if (!nvme_path_is_usable(ns))
+ continue;
+ if (!nvme_ctrl_is_marginal(ns->ctrl))
+ return false;
+ }
+
+ return true;
+}
+
static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
{
int found_distance = INT_MAX, fallback_distance = INT_MAX, distance;
struct nvme_ns *found = NULL, *fallback = NULL, *ns;
+ bool need_marginal = nvme_all_paths_marginal(head);
list_for_each_entry_srcu(ns, &head->list, siblings,
srcu_read_lock_held(&head->srcu)) {
if (nvme_path_is_disabled(ns))
continue;
+ /* Skip marginal paths unless we need to use them */
+ if (!need_marginal && nvme_ctrl_is_marginal(ns->ctrl))
+ continue;
+
if (ns->ctrl->numa_node != NUMA_NO_NODE &&
READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA)
distance = node_distance(node, ns->ctrl->numa_node);
@@ -339,6 +368,7 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node)
}
}
+ /* No optimized path found, use the fallback */
if (!found)
found = fallback;
if (found)
@@ -444,7 +474,8 @@ static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head)
static inline bool nvme_path_is_optimized(struct nvme_ns *ns)
{
return nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE &&
- ns->ana_state == NVME_ANA_OPTIMIZED;
+ ns->ana_state == NVME_ANA_OPTIMIZED &&
+ !nvme_ctrl_is_marginal(ns->ctrl);
}
static struct nvme_ns *nvme_numa_path(struct nvme_ns_head *head)
--
2.55.0
next prev parent reply other threads:[~2026-09-02 20:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 20:05 [PATCH v2 0/7] nvme-fc: FPIN link integrity handling Jesse Taube
2026-09-02 20:05 ` [PATCH v2 1/7] nvme: add NVME_CTRL_MARGINAL flag Jesse Taube
2026-09-21 13:59 ` Hannes Reinecke
2026-09-02 20:05 ` Jesse Taube [this message]
2026-09-02 20:05 ` [PATCH v2 3/7] nvme-multipath: queue-depth support for marginal paths Jesse Taube
2026-09-02 20:05 ` [PATCH v2 4/7] nvme-multipath: round-robin " Jesse Taube
2026-09-02 20:05 ` [PATCH v2 5/7] nvme: sysfs: emit the marginal path state in show_state() Jesse Taube
2026-09-02 20:05 ` [PATCH v2 6/7] nvme-fc: add nvme_fc_set_remoteport_fpin() Jesse Taube
2026-09-02 20:05 ` [PATCH v2 7/7] nvme: fcloop: Add set_marginal_rport to sysfs Jesse Taube
2026-09-21 14:02 ` Hannes Reinecke
2026-09-23 14:56 ` Jesse Taube
2026-09-23 15:34 ` Hannes Reinecke
2026-09-23 16:16 ` Jesse Taube
2026-09-25 5:09 ` Hannes Reinecke
2026-09-28 15:08 ` Jesse Taube
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=20260902200547.184734-3-jtaubepe@redhat.com \
--to=jtaubepe@redhat.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=axboe@kernel.dk \
--cc=bgurney@redhat.com \
--cc=cleech@redhat.com \
--cc=corbet@lwn.net \
--cc=emilne@redhat.com \
--cc=gustavoars@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jmeneghi@redhat.com \
--cc=justin.tee@broadcom.com \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nareshgottumukkala83@gmail.com \
--cc=njavali@marvell.com \
--cc=paul.ely@broadcom.com \
--cc=sagi@grimberg.me \
--cc=shinichiro.kawasaki@wdc.com \
--cc=skhan@linuxfoundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.