Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp628215pxx; Mon, 26 Oct 2020 17:23:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9XvbMIfVSXBG9pIuU4gvKojFgCAfNHLcbEAxGXLYIEwuNmZjyxnX8AWUEFicyFWZwn9cx X-Received: by 2002:a17:906:fcae:: with SMTP id qw14mr19231418ejb.537.1603758238165; Mon, 26 Oct 2020 17:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603758238; cv=none; d=google.com; s=arc-20160816; b=sMqeiP19aTpDJvK6q2tl856r63rhauVkqAn4bupHaw8wDYUYWJrpeyBDg77L6VnXkN 5GD0y/Ck02vFT24eO9cyXIbbOwG0i7YiAJ1v78SqbqEoYbmh/1pJ6ZDl06FTGH2tz8nt kUJeW5vSZ4GAKc1dwoMdLZAVAXTefCmP+Z7QHAFkUIF7A6Z2P1ntgpX6bWgmUQyCZ5Bj IfffGPzZ4ulI5GjVzaD/k9Oh1fQhml6xRTfLpScVmX7tjy1ti8W0erDTLlfgz7Cda/kE 6zzPV82qdKbscsbOYg3/KDGzwOeXhnlF1W1iSzq3raaxpilfZXx2QWySKmKz4SxD/cY5 uZig== 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=oZ54BTXi6tHsrWQ1Nd8HXXq+jOyWfn1sCeZvgOkqZkc=; b=GztpdU3vCDv/rrqxakfzali19afWBb1iL2AIfWFjD+EPOBj6c+rbhLpddG4GFDB41t awGDGjYJfcSkB30pPJ90125AsrX2bvizYCMaQvbXA7TIBl3gUGg8bU0cFamHQmVpXfQC 0OSqtPH0Vtn8H+JucuP6XTRbpnkZQ5iN/WmeR7Tdmetos3Nd++PDlH4Ev5x+CtsedyKZ Krcw0CcUAnqbMOX6ysfuCKzculTCiABoLMqUSQLvkCMawhpYMx4gYya0s9trjkedvtfC 247ItbPkyTrA45Ex5+cA09uGAVhHsaUQZpquh1VBEVrqTXRs+tKNOHV2qQ61Wmy07sS8 x7xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i8ZYQ6LO; 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 d12si9900936ejj.595.2020.10.26.17.23.36; Mon, 26 Oct 2020 17:23:58 -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=i8ZYQ6LO; 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 S2389205AbgJ0ADU (ORCPT + 99 others); Mon, 26 Oct 2020 20:03:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:35344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2411043AbgJZX4J (ORCPT ); Mon, 26 Oct 2020 19:56:09 -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 438BA20882; Mon, 26 Oct 2020 23:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756569; bh=BX2dVwuD7WjVTWf87DGGozXVqKlo/T5TFZ2njcWaccs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i8ZYQ6LOTeazlxGcPi1KY5MXBkh4l9UYLuf4XDJpP26zIhmWd4wk0jPgZw5wItUYk oD3/huc1tuo8W0xMtURkrhXDcfWqO6aDUqVeDCitnvKeFHX1yXmGko8fBdPPVYeyU+ D9fJB8PgZjM6gbiH7Qge+zk44CsquVhya6d6zrWc= 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.4 43/80] arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE Date: Mon, 26 Oct 2020 19:54:39 -0400 Message-Id: <20201026235516.1025100-43-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-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 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.25.1