From mboxrd@z Thu Jan 1 00:00:00 1970 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 9EF7A6EB56; Thu, 13 Jun 2024 12:28:44 +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=1718281724; cv=none; b=ZCFc7WN6wu2ORFcVXhUryrQfEIvdCoAiO/8yvj7mq0o7ervBVNFVNtCdiAm8qVpB1tfv+LWEP7rHrbhbyq9cnVn83oF1b6bFK6sHBSbRWHoqMhFa4EgmArW2EZ//abyFeMfQNAF3KKtfSTK8CdR4MlPkk4sXnVMRwmNohDpB+t4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718281724; c=relaxed/simple; bh=9Vi+1cXkZqzdA+hcQf3b6L8pEqjDyTGAh/HbIkcwUsw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rxZyT48LDGwg5kNLPx/4W14NH1KT++Chc0hB0q4nyu6n8oatZ+Mvd7nh4J8Mn8T2cBdlSzzmp6lTskKgB6TTOa8c4ZszA9MxOfbR+Usytcf4ef/g8JLEv3kx5TfGtgRf3DrHLHxyIoJ7GHm3Cjmp00P9BoY0u97lSAzHLvwSeE8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ed4pYweI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Ed4pYweI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26724C2BBFC; Thu, 13 Jun 2024 12:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718281724; bh=9Vi+1cXkZqzdA+hcQf3b6L8pEqjDyTGAh/HbIkcwUsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ed4pYweIGHsDxg9Y8rygD+yMVFTxqTd/4EK9X+g2+7ENffWxYlwTMZAAWG7vsZ/h0 JRanaL6HuOfX6uUfKse7vaOiVYFFOT1L/ce1tZoIEiMQI8J1IfF2jkEoN9rc1T6+fY g/Vo9smwU+inZJMI/D1QxRVtbKUoFU4g77xjTwR4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nilay Shroff , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Keith Busch , Sasha Levin Subject: [PATCH 5.15 034/402] nvme: find numa distance only if controller has valid numa id Date: Thu, 13 Jun 2024 13:29:51 +0200 Message-ID: <20240613113303.467351881@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113302.116811394@linuxfoundation.org> References: <20240613113302.116811394@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nilay Shroff [ Upstream commit 863fe60ed27f2c85172654a63c5b827e72c8b2e6 ] On system where native nvme multipath is configured and iopolicy is set to numa but the nvme controller numa node id is undefined or -1 (NUMA_NO_NODE) then avoid calculating node distance for finding optimal io path. In such case we may access numa distance table with invalid index and that may potentially refer to incorrect memory. So this patch ensures that if the nvme controller numa node id is -1 then instead of calculating node distance for finding optimal io path, we set the numa node distance of such controller to default 10 (LOCAL_DISTANCE). Link: https://lore.kernel.org/all/20240413090614.678353-1-nilay@linux.ibm.com/ Signed-off-by: Nilay Shroff Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/multipath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 73eddb67f0d24..f8ad43b5f0690 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -190,7 +190,8 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int node) if (nvme_path_is_disabled(ns)) continue; - if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) + if (ns->ctrl->numa_node != NUMA_NO_NODE && + READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) distance = node_distance(node, ns->ctrl->numa_node); else distance = LOCAL_DISTANCE; -- 2.43.0