Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp277220lqr; Wed, 5 Jun 2024 06:02:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNmxgUceoh9TdfdMwav2y1iNGcvh2ot7N6U+ocGBXhnWhA/yU1JAGN3v0G7M0tlrlCMfxhuzYbHLQq1bXx6d7H9U75PoCUz/0ug9T3eA== X-Google-Smtp-Source: AGHT+IFmd8SvSDSI3qtna095EbuSQSQnYaq9jPXUr2kNVWm1VrqzuBWCqQbRLi+82Iw2jeUX9i2H X-Received: by 2002:a05:6808:f01:b0:3d1:e1d9:dadb with SMTP id 5614622812f47-3d1f9fbce80mr2481056b6e.10.1717592549394; Wed, 05 Jun 2024 06:02:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717592549; cv=pass; d=google.com; s=arc-20160816; b=ZrT6b3+jrNFzSRVzPK/zFQTcJcx8+Jv5ynPZnW9NlnIT6Ha5bANMhxBlDofCUmZJsh 0KEDIKVeNYNfHWsd+/t4g9RPmGnxzX+xUUxeam0n9xgqW0nLeAKkvHHA3ADLSIwdEKVp AylR05mnhGQUc6Zz4gXhhro1qB/OcQGoTyYdp5nPO3ZTN4s1t/ApmUsloQPP+DdqlxOE HyEXamSP8F8wP4OOPY9ipe1zo6zZJ/0BnUKjAJHyHxSiYRfM22D+fPwPiE6LTMfOPYrC JYdyckvWz7I4XVfPkvnk9XqXqV/M0VrP6J9NW4mIL1O70CW2zczOQjMfUexHGISgn81D 9v6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=7nLTOguVKvRCer9sbB04LZ6ym0L0X90mB+vw5ilpLIY=; fh=cWZXA0+fzoh2mDCis4YUyi47qKKqg4qMc0Pz7Nvuduc=; b=e1mRzGqCpcRHkxRx4uZyC2bKmoBRhI5mVjH+yCHqafLqYwRNBxsGEiFXAx58wSRvYX PgXKssRkg0K2HxSO1qZp3mExOCaMf+GoWGK1TFgwt5v2j3IsL6iqxPWixuHGF5l18lZx 2MWw93I6E+lE0y+6HvxkbMr76YSY+DN1MAnGXZVC4zYuGAuVXFEI4b4bYNXwjY1huo3G YXTHRK083Jijjyi1mkpZb71S/ANoHa7OHKoz5QhbVv1eJ3B22CHFx219Zg7qZktHoEG6 ZocGOg2rg7j7CM2tOecMgph/m19+r99lg80S05AZlcOhQMzgGTDG7aAdUUDPq1JXewM4 w/CQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=igR0OTup; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202549-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202549-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 5614622812f47-3d1e1a3de5csi4007575b6e.161.2024.06.05.06.02.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:02:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202549-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=igR0OTup; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202549-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202549-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 75ACA293149 for ; Wed, 5 Jun 2024 12:54:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD6421D1D1E; Wed, 5 Jun 2024 12:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="igR0OTup" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1350E1D1D14; Wed, 5 Jun 2024 12:06:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589172; cv=none; b=XhBxr+bvFcMuQxG1vHe+oWJW7Kc5CzjW9Z8r2QDl50t88I2shKgHa5dtLTxkHG4+QppV1ey9/TtoZ0EOhX/0tzFXEaO/zQjRcmK7XD6OvzXExX9hK5tmy72zxe88xC7WzuEFtrw29Um1hEwzVYLVIKD/m3aG3XQ1CEzGQ4ntmus= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717589172; c=relaxed/simple; bh=FyMwlV6zRQS7jXw1DmRiPuZ2aBUaTVtYyM8UZuF96AM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eO1onf30dnZIMhxZ6CI8KYQtysmQcVebcxrJD5CmyoB0AOw/Llj/xAJQXXTZevX3W3P1AfRfe4nEAVqoRMDthyk+Ufxi/iKoLwKB6QhD981ba0xYYdP+zkFkwtdVwKXXcPNrIdZv99pLajEPuXN5mPMlDlBP1Pv/tihU6DxH8m4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=igR0OTup; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B453EC32786; Wed, 5 Jun 2024 12:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717589171; bh=FyMwlV6zRQS7jXw1DmRiPuZ2aBUaTVtYyM8UZuF96AM=; h=From:To:Cc:Subject:Date:From; b=igR0OTupJOJlrKb4Ur2vakcY2JXJaoUdZ5xfiomxN0gjxO/SG196asuRp3ZPtJjBq CHQZ18yDo155zKCMVgWH1MsPW5WTAXT3GthryzWXrSX3169Mof/KHzw+4KqXJvGh2c 4B7mV8ZlDul8lu6qUK3GyoNee62RaGsWAQyJw6onRXopGmFSq70HcgpjYB2Wl+mJln kQmngoAV4Et4f4uy4woS5yhzswbT/WrYQltI+6PCIcdlZquo56th/ktw9zEaa5tN+P yXhQEML+WzYOL5zL3Vs4eUJ0SaiU/ct79zarleu0dCYUaNdhEpCVFdy0DY08VjRUQ1 XCQBBtgjYHcrQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nilay Shroff , Christoph Hellwig , Keith Busch , Sasha Levin , sagi@grimberg.me, linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 1/2] nvme-multipath: find NUMA path only for online numa-node Date: Wed, 5 Jun 2024 08:06:08 -0400 Message-ID: <20240605120609.2968188-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.277 Content-Transfer-Encoding: 8bit From: Nilay Shroff [ Upstream commit d3a043733f25d743f3aa617c7f82dbcb5ee2211a ] In current native multipath design when a shared namespace is created, we loop through each possible numa-node, calculate the NUMA distance of that node from each nvme controller and then cache the optimal IO path for future reference while sending IO. The issue with this design is that we may refer to the NUMA distance table for an offline node which may not be populated at the time and so we may inadvertently end up finding and caching a non-optimal path for IO. Then latter when the corresponding numa-node becomes online and hence the NUMA distance table entry for that node is created, ideally we should re-calculate the multipath node distance for the newly added node however that doesn't happen unless we rescan/reset the controller. So essentially, we may keep using non-optimal IO path for a node which is made online after namespace is created. This patch helps fix this issue ensuring that when a shared namespace is created, we calculate the multipath node distance for each online numa-node instead of each possible numa-node. Then latter when a node becomes online and we receive any IO on that newly added node, we would calculate the multipath node distance for newly added node but this time NUMA distance table would have been already populated for newly added node. Hence we would be able to correctly calculate the multipath node distance and choose the optimal path for the IO. Signed-off-by: Nilay Shroff Reviewed-by: Christoph Hellwig Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/multipath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 811f7b96b5517..c993548403f5c 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -436,7 +436,7 @@ static void nvme_mpath_set_live(struct nvme_ns *ns) int node, srcu_idx; srcu_idx = srcu_read_lock(&head->srcu); - for_each_node(node) + for_each_online_node(node) __nvme_find_path(head, node); srcu_read_unlock(&head->srcu, srcu_idx); } -- 2.43.0