Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp258796lqr; Wed, 5 Jun 2024 05:28:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXB8D+b7ff/4Zx3tvdsjK+QJMLRzAamfJZJgmaMahEwXcEJLTeBMZ7tpkJsI1R5KknZQ/5KYghKRjzc5HT3SssYi2M3k2qEZS/2FqiLUg== X-Google-Smtp-Source: AGHT+IEYuh4qN8cE810xn2kRTd/+O9zjYZk3ogwSzVrk6uoFP4LequdcCjWY7vO+Qo6snrK/PJLv X-Received: by 2002:a17:906:1c43:b0:a68:c21f:70a1 with SMTP id a640c23a62f3a-a69a0253195mr152347366b.70.1717590502470; Wed, 05 Jun 2024 05:28:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717590502; cv=pass; d=google.com; s=arc-20160816; b=elU2Fwsu0tqu7v75mSCDkHAcPJoruqj0wKLsadxmtBz214YkhvI47Mmkubw+6xkIUx HBQ2DJNNi8pamDTa9DiouFw4tNB9fLdeEZg/XuN5V9Jk9jfSK5ZFDDK4i6of4ZOPzX7F mJiceQrZnQY+TADgE7J2j4QBX5aLETHdarMzAaeLryiPk/dGdssAaIrDEaUYqp6Eyr5S xrigbsXSvJr2Fu2qEL/VGxGoUlqpwoU6Hz/cwGDcuSWt1WXoQgbcNGJYEjISm/kWwUBS tWs9fFfWH7txNLa4GQEnd9qCC5HfJVGZWb6VXq1T1AyhoigRdNUZqpfo2jDZVshS/6TW NuFw== 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=kGhZJmGbQ0Cr5mNkeWpVOXiFbg8QgnZxBbvdD78egvw=; fh=cWZXA0+fzoh2mDCis4YUyi47qKKqg4qMc0Pz7Nvuduc=; b=KaAb4+eMRsQkJMtJ9Lc+k6VWehBdcIUaeQJtvLSk/3Ux3gUubO1kaASJDYsrFtCQHe sTIrbpGLymYjT7+34YLUdQ5xMRmjjbS0WSodlfQrJdDx8S23XoPei/dMfa2RTz9be0P5 ECvQmvQpaO4exY0e0Yq8hNNxm6hBOUhvk3woXJHNGiwc2vNbCm15KO27sUS4QSsqp4ik 9PshQoF1OcOtTMNH6XnOWL+ZX7snmXyZU5Avot5ZF+mFzfCqnsdY8cQOYi45KZ4smxw9 IKV7tQxYCy5fqQ1Yjjm0WF6GbyR6zZ6Z72a3RArXzIM5PB/dn48uC7C/B6+oEcxI1Mc7 cj9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XUAqZR1I; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68b0f2b388si464558166b.167.2024.06.05.05.28.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:28:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XUAqZR1I; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202451-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 am.mirrors.kernel.org (Postfix) with ESMTPS id F3FDB1F25250 for ; Wed, 5 Jun 2024 12:28:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF043195FD8; Wed, 5 Jun 2024 12:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XUAqZR1I" 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 09A28192B68; Wed, 5 Jun 2024 12:02:23 +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=1717588943; cv=none; b=SExeO6mnZ/PCep0qUJRx/F2eYhm5kd4UgHvC8x1mrhfCqY9eQ8G3rt2s5EGXW69uMZ6/Vy7TziU+oT+gKCYhY9L1trPGfyCODPpsabSXX2FjevGkeNxL807luYtxtx2Z6PWEvx4SIQ18PvFH5yXB0ffKIFmwVfjZH/B+Wj9O2+c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588943; c=relaxed/simple; bh=nUrzGKAlcTVG27/8nvDQiyvFFzUX6+tQO0eRQHx673k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=fM7W98jMXWACiHVGBx0bFGWWR1GJPxH7doqtwrbo+SIC6MAVgrs8v93fD7LPWskOYbb5jLcM8HTIP+vwowogWRjtzI0B03auEQXti5BRzP7QU9jzzk7wexPMqoeWYGszSvZiDaqCKlE0/FAI1jTSfck4GpmHjHmOgPM5VbFyN5k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XUAqZR1I; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3B87C3277B; Wed, 5 Jun 2024 12:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588942; bh=nUrzGKAlcTVG27/8nvDQiyvFFzUX6+tQO0eRQHx673k=; h=From:To:Cc:Subject:Date:From; b=XUAqZR1Ia9cJ54WN9Z5NmlR9Ip0zPR9ZVwpLMT7f4/nKzExyCHNnHVI1HR6zx6EO/ 4yhiTRhi9whL1EHg0kHIUbWGopqZrPo6+pCMWkGeO2rOAoGqdwjNwSdVmvwGLAROlp jdSg3JdR31d7hTXetuBHYm+mKP3lIkPIfTWxCDSEZeKncluEaPc42H4U2uhmG+xCuK eHcIYXb8X/HylwuxSZGhjqWDrruIDZD+BlSy2N1hwyw+U31ERVU5qCdkcfjZjw5nvn Mvf081PONT1DGr8JJBF2zatmHoS3j1+e9JrRXqzDxXgzsZda73rThUelWJzx4BV9hE nLe/C/wUxRg8g== 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 6.9 01/23] nvme-multipath: find NUMA path only for online numa-node Date: Wed, 5 Jun 2024 08:01:44 -0400 Message-ID: <20240605120220.2966127-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 6.9.3 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 d16e976ae1a47..9c1e135b8df3b 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -595,7 +595,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