Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1258413pxx; Tue, 27 Oct 2020 12:02:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsNI6yJRnFOPpYMQli9HTLR6cxsyuSRGae+J5U1PVbUOescGNY3A/wjzyfl88c6L4jBCtG X-Received: by 2002:aa7:c58f:: with SMTP id g15mr3744618edq.99.1603825363398; Tue, 27 Oct 2020 12:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603825363; cv=none; d=google.com; s=arc-20160816; b=Gi+/LhnbVxbtLd9DNp4mo+gaEd5USGR0ae8I01hI4ByxN6eUojv0rer466zct+LonV Py4CaYqiFI0h1La+7TiwR2Z6pcZzpCS+mtjnB3yxqferaoXAe63OXmUQi02gPCMEpC0L bPT1lDZPyfma6tORk83VcpCQnssRLISx73hnSPw8EnEKgM3KxKXYwWfxL8TtDNNMIwCn JvpnCehZscMOPVszDBue3rLV4WTiJG0wNnyBEA1A7L7JslV9U/XnWrBv5JUlMgD4PqMY Y4rE/Z+2leqvgiySBI1I9z4JRwNhoW5nSBMw0GfZxumgcDf7DmOyh0+UVZ1wsaGS6i4A gCow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8tKvwgqHwGCYYF0tvfGSaXbi7pe/eqSrlndjH3thUf8=; b=qYUys3UR46WZdYBr0qsL1LBeqaOAe2ufh1HkVsvGiEhOu3sTJJURMLTXZOPOfDicdX 78+EPTUmh3YgsSdUzhd6ffiNl4K8lhLy1OMp0KfuTVAC/sqsdZW8YKtJmNchAaJXNUPN DbyXPjas+bQ2bnZzFKgHMLovsswrlCllPryrTStBrDkYUAAWZDrex7eXIu8MAG0fd17C bbeoWX1ciVDku1ZcUQtoXIpcJWWAAtBUDPOH+0sZZnD+HSOaBq2qla+3srdcILSs9FVn /9r28jq10vrRqGbSpduKuswpkFEYLbjazuOjGHD+R++YV6ZTflRbJ39H04/iq1GUqTKm Ioaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fMjeEZfW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si1505447edn.64.2020.10.27.12.02.21; Tue, 27 Oct 2020 12:02:43 -0700 (PDT) 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=fMjeEZfW; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2501952AbgJ0AjG (ORCPT + 99 others); Mon, 26 Oct 2020 20:39:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:50626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409192AbgJZXuq (ORCPT ); Mon, 26 Oct 2020 19:50:46 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 12427216FD; Mon, 26 Oct 2020 23:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756245; bh=8dpCUA/4YWNwMN2x6t00Hg+SVrx4Nm8IeimMAIWcdEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fMjeEZfWg9I2tb7NP4rAlDTvBL2MTvj/USAcRRhru+V1a/gZ+iBXw1mIF3VCB+3FD 5nuW67F1HasfpBnIQQksf70cScDZxglqxaPoN2xDZjIc0s0ooEy8d1rYEcYinyEWSk rlSBGcTBCeTcbDB3SJ8KUhDyorfXu7n0Vb3zXOvU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zhengyuan Liu , Gavin Shan , Will Deacon , Sasha Levin , linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.9 081/147] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE Date: Mon, 26 Oct 2020 19:47:59 -0400 Message-Id: <20201026234905.1022767-81-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026234905.1022767-1-sashal@kernel.org> References: <20201026234905.1022767-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 73f8b49d485c2..88e51aade0da0 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.25.1