Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp829527pxb; Tue, 3 Nov 2020 13:45:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaULKCFjAHa5DmqaLVG6P1Lf0sLJe6lLJo0labuerQR2jitEk6ltIU6xG7OGWpBPdd60ED X-Received: by 2002:aa7:dc12:: with SMTP id b18mr23833112edu.295.1604439932936; Tue, 03 Nov 2020 13:45:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439932; cv=none; d=google.com; s=arc-20160816; b=RHZowB10zmaNUMgKp1V126MDzD4x/lVyZ11TRi4RdCdjqERsa0vH4ivy/b6Iq1heIV tkvW9eeRysrHDV5GwVEOklm2eLtGVHK+/FgC3NTG+sJZ+pDRdeAcG9JJCRzSw8wjLuws 7L2fpU4R4mtIuF7I4Q1/PQKYQteR9ixNs7Hwk4RfZOBO5bE6Tsykhz5NHqlXPSc2jwJV 2BC/wZd5468G5Bfm7y+Ab46gc/Hj950W+348iaUtSDKHlAF+dFfNuKZi5dxtoZA/uNlT e9zAEng3MePiJzw6KSz9cfYBObR32jGtnBP4YjdAfpSPa+/juE4F668Zt9wpCWpaUvCF TEgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b4BfmbXZ1ekN5xwMvjANZn1y1h+YzM1zTFDKifC2cGw=; b=npX6Cmx/p5wXJJOrfBMbQmjZmuSxx47ulnguriLZGjKkgSsmAJyM1sd8aGQAycG9Me ejJPZt5FXqvVoBdjBvE3yShWPG8yKlIDvtMBNiT16VHMECnDmBs2gc6gLC/bRAi2D6Po Fx0wcyP3tH0jaIpO1x+oUuhizKt8DNCS9eDTxmVkTadpcdF4EmLwlbXAPpuuNahLvrEq BpiLP/K0/XU0AiJ3USMeQ4l9+hQDwK0u7uxoiD1XjGmZZ2Ps6G46WiuPnqazlSCie0aW KdHK9+5PgXQbIt7I4sVa5PxPmBX/k+A0519s3MqOK4HmAHZJJkth5ZXuiioJImPmP8J4 RvAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SB4O3HSU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si5758038edq.356.2020.11.03.13.45.10; Tue, 03 Nov 2020 13:45:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SB4O3HSU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731065AbgKCVnG (ORCPT + 99 others); Tue, 3 Nov 2020 16:43:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:55184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732677AbgKCUzJ (ORCPT ); Tue, 3 Nov 2020 15:55:09 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDED7223C6; Tue, 3 Nov 2020 20:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436908; bh=eIZYUGgER0xy5USWci4+NdIIG5c/xEh1I9vNq5bjvA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SB4O3HSUvowP29LB8GC/sRvDu0nezFoP2sIigATr32UPtCxdi3lmQO9uS7o0/yfXD y2H6iwrB+WTF9aiOtInzVV2qkB6q1C2HA/TZ8E2lvSLkfOeopyqCbHaBptUVGmeFNS 1LIQIiWEzZLhIyqgagcBKpphWFSVXBrAl2j5noB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengyuan Liu , Gavin Shan , Will Deacon , Sasha Levin Subject: [PATCH 5.4 062/214] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE Date: Tue, 3 Nov 2020 21:35:10 +0100 Message-Id: <20201103203256.173576176@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhengyuan Liu [ Upstream commit a194c5f2d2b3a05428805146afcabe5140b5d378 ] The @node passed to cpumask_of_node() can be NUMA_NO_NODE, in that case it will trigger the following WARN_ON(node >= nr_node_ids) due to mismatched data types of @node and @nr_node_ids. Actually we should return cpu_all_mask just like most other architectures do if passed NUMA_NO_NODE. Also add a similar check to the inline cpumask_of_node() in numa.h. Signed-off-by: Zhengyuan Liu Reviewed-by: Gavin Shan Link: https://lore.kernel.org/r/20200921023936.21846-1-liuzhengyuan@tj.kylinos.cn Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/numa.h | 3 +++ arch/arm64/mm/numa.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index 626ad01e83bf0..dd870390d639f 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -25,6 +25,9 @@ const struct cpumask *cpumask_of_node(int node); /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ static inline const struct cpumask *cpumask_of_node(int node) { + if (node == NUMA_NO_NODE) + return cpu_all_mask; + return node_to_cpumask_map[node]; } #endif diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 4decf16597008..53ebb4babf3a7 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -46,7 +46,11 @@ EXPORT_SYMBOL(node_to_cpumask_map); */ const struct cpumask *cpumask_of_node(int node) { - if (WARN_ON(node >= nr_node_ids)) + + if (node == NUMA_NO_NODE) + return cpu_all_mask; + + if (WARN_ON(node < 0 || node >= nr_node_ids)) return cpu_none_mask; if (WARN_ON(node_to_cpumask_map[node] == NULL)) -- 2.27.0