Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3185502pxb; Mon, 9 Nov 2020 05:06:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlWcfZWz72JaT1mDnvpgOJYvPZcWuk76PKNBlaNcvp5IOW+HfNMXf7IoDP8Pg7Q99UmNGh X-Received: by 2002:a5d:488b:: with SMTP id g11mr2901266wrq.210.1604927216168; Mon, 09 Nov 2020 05:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604927216; cv=none; d=google.com; s=arc-20160816; b=Qz+WmR83pZ5EdLCXNRjMUE92xA6qmSsl/Sjwxd6KKXcC1ja1vXzQEgsZGMowZ0Z/AQ 5M+LELwg+oLknC2OkNrjacU2hDblOWKo7elmdQe3klsT+EqhXWdQXgKa20EHqZV541Q9 Hlyj0+gzEBXA3urNxamzg2S14wnSFpHV+vAVbPEyX60hyg0XXjnjRuS8sU9NrNapGZ2D JCKaDc9FKG8VB7v7CYglYONRMzSFrJr3ceoQLIe7szKk1TE/7cSIQRuvB3Cv6gwNvpBX xBV+6M/o4e+xBof/6s0cM3MJ8TQatWvFzoPFq3YDHBMLCld3d4iudHOgmUqtS3WAaHS1 Mk7w== 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=dFtxsfr3ejBylUA7Dc9kehwa9WDYe27v2nB1woMH1Ds=; b=AwBVQ0rKG+GvhNlfZVTNsf5gq2mm1vCyndbSzUmrMkcugh3FqnGlvZS53qTCPSoOGx uuEwU0xmC3co41Ia20mUhBBISnnT1G/eL8vrpSmwiwOQNYEQDdoZfnm+pZi259GLY8Pm JGYwJ0y67R4xRqOWCkjWOUoAvGp3Ta4cjl9z+XTaZQRxajfngCr5fnE8+RvS7JcLkxTU DHH81iLwgyer45DEmQGmF7P5t5tfoXF35uflvFi47xXMDCRnW5Fc53qJ/rH/FjhivfBy exrkT09MI5R3HzE2uMLQlQozcQzF1DFV72EuJn5vjqRIastqRrQwodfHzwUZ192neZ0o m8Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YK2IROCD; 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 61si7205551edc.400.2020.11.09.05.06.30; Mon, 09 Nov 2020 05:06:56 -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=YK2IROCD; 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 S1730569AbgKINBb (ORCPT + 99 others); Mon, 9 Nov 2020 08:01:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:55116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730548AbgKINBF (ORCPT ); Mon, 9 Nov 2020 08:01:05 -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 A8D5821D7F; Mon, 9 Nov 2020 13:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604926864; bh=g8dycIUtF/AmpihNlDy8kl8JRfHZx8cPTPXx5ha8b5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YK2IROCDTdRBMkBoVNol6NtMTkXGGX2zt3bIXaTL8YswE5/+8sgbL7eLmOKkucTm9 4S/bFPyHwf/paKfufo25q5+UXDBD2e5iXD/mZ95HxRwQrV0x2PmKFf3KqpLeY+c00g ainuU9HzDppCbVTqGzAAEqOixPKlU2qiBXVtQ/Ao= 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.9 031/117] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE Date: Mon, 9 Nov 2020 13:54:17 +0100 Message-Id: <20201109125027.127211442@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@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 600887e491fdf..496070f97c541 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 b1e42bad69ac3..fddae9b8e1bf1 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