Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4479865ivc; Tue, 3 Nov 2020 13:07:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwLHGB7THiWbS4vbnR3vXaZ4+ZBruPa60pKY6cbZ3kIc51ayTb1SzA2V+a6mHnOkCMdc0p X-Received: by 2002:a17:906:31c6:: with SMTP id f6mr22096831ejf.164.1604437652914; Tue, 03 Nov 2020 13:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437652; cv=none; d=google.com; s=arc-20160816; b=fQMxiE/Eg7NU3hExars0QuSn8XqnL9p8qVTCEA7l08nkXeRP07PS5hC6QSX0cV7D6t Z/tAL4lqik8rLe7Arvz5vk+7V0WnjRjvL7YV9IqTz6kRCfn6Coit4WTpMGwRTSqkqhUs FobItah1qkReUlR8VRJSjjD/VXJNJiia8ex+16psJc0Z7dza4SZE1c1nyhkDg12Q3fLC RetMZc/4RNeYHCTUyZCQ8rHK4h7jXCXi7FLmNk+bNqYVY6Qfd2qMTgpLo9AtqS7gWqYF 50F5fbEzuxwvlYaay6BfCnhKCOkJEveBJQ30StMrW0ncm+PGRIEiZareI6isEgKSMxI9 bO7A== 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=IQzC1++CXLo3UEOEKX0b1JoTkXJNHmKFnKjhqLao+Z8=; b=O6tDTDYUzFB+jx3hG2iuZ8PK+mlyna/rmA075hO7dyNJN294OLyCmbWlNyQJ89pD49 39zZoP2MSeyeYgUgPJ512hFn2DZUcPPXQun3V8z4VJ5U1xTrXJZopVOH5OHlV08rPL0y ZU9t3yuiaTAzuBcNswlzLYf2ciH+MYEHZdqZUdqMzKxOxUFgqWtUIUqFc5C4wdv8mmQt 9+npizkgUbNag+X0tfVTkVp7ILhBta6ZEjtWFrq1K3OnOwrXDmbIIiQhx1iRHqSFWZV6 yTtW5DBE/tFz1Fw/sK5tIH5okySlGG56SALCREIBXF778mMsvubzFkWY8WP+vpNZ5QS/ eQng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SYVD4zPu; 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 lf3si4814ejb.78.2020.11.03.13.07.09; Tue, 03 Nov 2020 13:07: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=SYVD4zPu; 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 S2388016AbgKCVEm (ORCPT + 99 others); Tue, 3 Nov 2020 16:04:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:42754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387998AbgKCVEh (ORCPT ); Tue, 3 Nov 2020 16:04:37 -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 8CB7A20658; Tue, 3 Nov 2020 21:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437477; bh=gkPEqAXJN9EPTh7XGZIwCLPEEsQ7pPhdG9e2tiRjWY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYVD4zPuB/nqY9M6ns8UKt4QePtNsKQw64eSISNRqdky8CPAaegMly6il9YdyTgLv Am7PYSyHLUe0rymG0j49E3cuQdn6vy+nr93jQSkIzsYEyDqgJbUxNIlWiUS074vSla Rrnj47VEePORlM4wK26leINccOj2YxJtaXGCNvpY= 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 4.19 086/191] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE Date: Tue, 3 Nov 2020 21:36:18 +0100 Message-Id: <20201103203242.125528550@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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 54529b4ed5130..15eaf1e09d0ca 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -58,7 +58,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