From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A0C1CA0EE0 for ; Wed, 13 Aug 2025 20:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LbCKMaN8yeNFHOmVow+bQ+J9MDeLKNiJqmp7FkwAZAc=; b=XyY6WydUYzCTKGAi4ec8p/md1M 8cy0eEy7KgIV6PFJNyqHE6XbOiLwh52M9L3XdtaWHB1IBnWan1F7sZnSxWvU6hlUPi6WfDIRHjbhD 9UbyJsGpjYMuUedtcs6KqgAwbfPHBvFMc0ywXWcLZsMYk50znhJ8Z8eNuxlBYZCvQWYcNCuTZtRGX 021/cvgPFbfm+mCTX2TTj6LNWhkUhN9W83pSJxvdyfWywqRuXUuYR1t2bRfScdb72JWtEvf5XtQEu EvcwsJR1Fj+VpYlw1R+oXgxQBKIHAgEALC1jk2ftuTRXl5B8GmZz4pVcWTUfeAWSKQMOVH3vu0L4d nGmkb1kQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1umHls-0000000EuW8-0UY8; Wed, 13 Aug 2025 20:08:28 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1umHlp-0000000EuVE-3ASm for linux-nvme@lists.infradead.org; Wed, 13 Aug 2025 20:08:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1755115704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LbCKMaN8yeNFHOmVow+bQ+J9MDeLKNiJqmp7FkwAZAc=; b=OlDuudJhn5X32Us1g5VIaE8FSWdW3zjfkIRJRyVyrzI1k0k2TSnVz/uqAbtjHFHEXk9dtD Yd4i+xDDv8JFNregTEYT30t6Lefdp2F9hYOOGOvXXmymHEZmDo/r4GWbzNYwIBVcKLt/Hz U20vSexteYqpLas4vOwMtbAXD4bDCdE= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-P1tTLv_rMmGmA3le9UpsXQ-1; Wed, 13 Aug 2025 16:08:22 -0400 X-MC-Unique: P1tTLv_rMmGmA3le9UpsXQ-1 X-Mimecast-MFC-AGG-ID: P1tTLv_rMmGmA3le9UpsXQ_1755115701 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5FEA71800370; Wed, 13 Aug 2025 20:08:20 +0000 (UTC) Received: from bgurney-thinkpadp1gen5.remote.csb (unknown [10.44.32.39]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5151F18003FC; Wed, 13 Aug 2025 20:08:13 +0000 (UTC) From: Bryan Gurney To: linux-nvme@lists.infradead.org, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, axboe@kernel.dk Cc: james.smart@broadcom.com, njavali@marvell.com, linux-scsi@vger.kernel.org, hare@suse.de, linux-hardening@vger.kernel.org, kees@kernel.org, gustavoars@kernel.org, bgurney@redhat.com, jmeneghi@redhat.com, emilne@redhat.com Subject: [PATCH v9 3/9] nvme-fc: marginal path handling Date: Wed, 13 Aug 2025 16:07:38 -0400 Message-ID: <20250813200744.17975-4-bgurney@redhat.com> In-Reply-To: <20250813200744.17975-1-bgurney@redhat.com> References: <20250813200744.17975-1-bgurney@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250813_130825_868213_9D6DFD6C X-CRM114-Status: GOOD ( 16.70 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org From: Hannes Reinecke 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 the 'optimized' paths are unavailable. 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. They are, however, still eligible for non-optimized path selected. The flag is cleared upon reset as then the faulty hardware might be replaced. Signed-off-by: Hannes Reinecke Tested-by: Bryan Gurney Reviewed-by: John Meneghini Tested-by: Muneendra Kumar --- drivers/nvme/host/fc.c | 4 ++++ drivers/nvme/host/multipath.c | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 3e12d4683ac7..bf6188b554ce 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -786,6 +786,10 @@ nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ctrl) "Reconnect", ctrl->cnum); set_bit(ASSOC_FAILED, &ctrl->flags); + + /* clear 'marginal' flag as controller will be reset */ + clear_bit(NVME_CTRL_MARGINAL, &ctrl->flags); + nvme_reset_ctrl(&ctrl->ctrl); } diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 3da980dc60d9..c042a9a11ce3 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -324,11 +324,14 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node) switch (ns->ana_state) { case NVME_ANA_OPTIMIZED: - if (distance < found_distance) { - found_distance = distance; - found = ns; + if (!nvme_ctrl_is_marginal(ns->ctrl)) { + if (distance < found_distance) { + found_distance = distance; + found = ns; + } + break; } - break; + fallthrough; case NVME_ANA_NONOPTIMIZED: if (distance < fallback_distance) { fallback_distance = distance; @@ -381,7 +384,8 @@ static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head) if (ns->ana_state == NVME_ANA_OPTIMIZED) { found = ns; - goto out; + if (!nvme_ctrl_is_marginal(ns->ctrl)) + goto out; } if (ns->ana_state == NVME_ANA_NONOPTIMIZED) found = ns; @@ -445,7 +449,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.50.1