From patchwork Tue Jul 23 06:41:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13739444 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02F53C3DA63 for ; Tue, 23 Jul 2024 06:45:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 856746B00AA; Tue, 23 Jul 2024 02:45:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DF3D6B00AF; Tue, 23 Jul 2024 02:45:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 659536B00B1; Tue, 23 Jul 2024 02:45:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 433AA6B00AA for ; Tue, 23 Jul 2024 02:45:30 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ED91C1A1B11 for ; Tue, 23 Jul 2024 06:45:29 +0000 (UTC) X-FDA: 82370081178.27.27095D3 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 8D7EB40023 for ; Tue, 23 Jul 2024 06:45:27 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sJMN+k7p; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721717076; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OjNQgrN6REz6c9/9GZCtVK4ZXG8FOeXjLqwyGqxjeVY=; b=U5IpTQsGoEaSvXxiw++EzUktV8BqPALx0nGg4t5vxGjbq/MIbLeQeAhnfQ/GicKxqUuIky co5EZxpuyrr+2WaizShCVGY+QaHSgdE7J7jQluMuRNbMM9stGi/sVqa6sxFJNkXny9402Z oLrb8ObWbylbxxEZeL92ZM/e5e75PMk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721717076; a=rsa-sha256; cv=none; b=wQxI2zMm3URon84f+cmr2U88dVsmDcuBv54S65pW7yhE2RJsascdSLO/vXFgQU4KUxUYWH GN6LDGJwSWioO+T5/GDNtHN8zaDn8oJfW6loGorzPsId/MvD1GkeDBErxeAE5EBHKfyLRR P7eC2SIqPXDV6kwf0iSdn/1/5LZzjHk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=sJMN+k7p; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BA02FCE0C45; Tue, 23 Jul 2024 06:45:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA842C4AF0C; Tue, 23 Jul 2024 06:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721717124; bh=pNYfU5nbHx/fmG089PdPYGa3502wUyTtzM4zHrG8Mvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJMN+k7pUNhxKMGnIuCjgZTlPbUXg5/os1ykrILC9mUEWtB/1tafJrHYsT3Lzg6CC KxPlE4rLwAsWg/jKdXOabKO5hifhNh89+1FGJQUF+HuswOt6jRskwY16gaVvWcjg/u JaaAiOp6hsF6GNf1J4jgCi5e4XLZRTtF48K7QOEb7BcTzzyd78BuVnpn+3nEetKgQf pE/iZ00OiDD3XHUDQouzidclYaIdyKCfhkVnZGJn2HO5Ygy861wCszx7RSgDBl462P a5O5umZhDFqU4hwmQ7pIFqaYYCMo9SUyHpQy8O0yggfld3P/JTN0RCi+SHOyn2AaAG hdaJ2RE8Lgb/g== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexander Gordeev , Andreas Larsson , Andrew Morton , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dan Williams , Dave Hansen , David Hildenbrand , "David S. Miller" , Davidlohr Bueso , Greg Kroah-Hartman , Heiko Carstens , Huacai Chen , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Jonathan Cameron , Jonathan Corbet , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Samuel Holland , Thomas Bogendoerfer , Thomas Gleixner , Vasily Gorbik , Will Deacon , Zi Yan , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cxl@vger.kernel.org, linux-doc@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, nvdimm@lists.linux.dev, sparclinux@vger.kernel.org, x86@kernel.org, Jonathan Cameron Subject: [PATCH v2 16/25] x86/numa: numa_{add,remove}_cpu: make cpu parameter unsigned Date: Tue, 23 Jul 2024 09:41:47 +0300 Message-ID: <20240723064156.4009477-17-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240723064156.4009477-1-rppt@kernel.org> References: <20240723064156.4009477-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8D7EB40023 X-Stat-Signature: ghpownoko4nmf51i5p5713hwbmc14okm X-Rspam-User: X-HE-Tag: 1721717127-89422 X-HE-Meta: U2FsdGVkX18COnDnu0IUA3JnNIl7R1e+NpSYb3Giv83SMPVhdZpukDt+uovt+DxJyCgPpI/4WL1rKSCFvfJGKLcBKDgi/4hNZHv6jTHM5WwEXuxDSv4MmOBUU201wzrn9OOF2C4XCPbgIHQnV8rQNOGVIYmyRfPP88WPlPY/RH2OhsilkVu1O5VCNiftUMjqxe1DNB/wh1SbvBTRFKh5E5vW3Bpv/jaCrD66g0CPHpsBCZlgUcyj0Gpzll+z0HSPAlGkfB2yYfVV82iRo83J33yNQT7MK/i8ifpf/LTD3khY3LrryTYIrGXzVH6edYG3KQGFuvTNtaiqFgnVPDE5CgU/Gr+BT5T/25QxF/Dd53oqF+n6oekXvxYZUzUTVuNT//j91IvdBvGXyMzbKPiSQirl3QqxhD/LaOu4ldKxT/EG8C50n/U7cYpAOl+jGK3xx0nhryIHp9WurHATD7SMoIIbvbgeeWu9nTOky7VjPqGvn8yZiZ5Nq0ZqxniFw0Sg0lV2KUH1h66D0ewrZEni5rpbd09ZzK2mtksa9sGdxZfKAGXgN2l5aHcJoOwNR8IB4vmBR/5ttUqPo1thyd0VI3s4j2hjO/o3+8f9qNxkJwx5vW1ATndy29CQ088Des7ucflU67LbUZ9CeQfwjTGZbjM/SY/prb/wJsv8LglmaVH6sDw26MXRBVb1rjBzgn2U90Zf+DnjtYvY3L7Gide23PdvKLApH1WZ9qjoUf5fHMqpKZ9RYTGQXOXqeKQuZomw/ROF9zhWMKDo/N+FqxVhPh3qEMfelmLgBlpQeAND/RPb5uHyQ4PXLt44ilgqz1jw4c6Zx+dyaPracuKq+i/vspF0hQCrGO0lnTezL26P6DGI+nBFCO1gv8PnDfHl2CsBPE9X1yAK3C+y/srsqDbaWl5vW9cvF3RwCYCqQJwDt5jkrbas+foJjNp4EvDzbQNEPKKsZ5Bw70cU0EVGG/o I4jBf4ez iN7+aYO7OywKwtWA91loIrdCjmgvBZqk/bnwjhbGtQyTiVjTqQCyLXSX8qR/yN9lI3UaWx60qhnykKKY4b2zQngmfqUksMPo+mhyg+kVTeDKAEFu0Xy9mKVO7MxI+I/O0WfAIarhcFFaRtVaKYv7QmeUja0UglfRlWTKpf9KPleatXQ0Vv46Q0i4TvX4n2+drjlfRzEop2VA1wdokE3oo2nMJ4FCGisDkGOJqDRtrOPE4TtggHmDDY/MdNoJ/eO1L7awSTneWPcB+Vdbeds5UZx8DdsVj/tc9o1VSo1w3ENhXmlyRotXyAEvVISFOTrNYInW6TQIt9CFVpIRnEIYBG4y/0G/kBbow9f43 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: "Mike Rapoport (Microsoft)" CPU id cannot be negative. Making it unsigned also aligns with declarations in include/asm-generic/numa.h used by arm64 and riscv and allows sharing numa emulation code with these architectures. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 10 +++++----- arch/x86/mm/numa.c | 10 +++++----- arch/x86/mm/numa_emulation.c | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h index b22c85c1ef18..6fa5ea925aac 100644 --- a/arch/x86/include/asm/numa.h +++ b/arch/x86/include/asm/numa.h @@ -54,20 +54,20 @@ static inline int numa_cpu_node(int cpu) extern void numa_set_node(int cpu, int node); extern void numa_clear_node(int cpu); extern void __init init_cpu_to_node(void); -extern void numa_add_cpu(int cpu); -extern void numa_remove_cpu(int cpu); +extern void numa_add_cpu(unsigned int cpu); +extern void numa_remove_cpu(unsigned int cpu); extern void init_gi_nodes(void); #else /* CONFIG_NUMA */ static inline void numa_set_node(int cpu, int node) { } static inline void numa_clear_node(int cpu) { } static inline void init_cpu_to_node(void) { } -static inline void numa_add_cpu(int cpu) { } -static inline void numa_remove_cpu(int cpu) { } +static inline void numa_add_cpu(unsigned int cpu) { } +static inline void numa_remove_cpu(unsigned int cpu) { } static inline void init_gi_nodes(void) { } #endif /* CONFIG_NUMA */ #ifdef CONFIG_DEBUG_PER_CPU_MAPS -void debug_cpumask_set_cpu(int cpu, int node, bool enable); +void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable); #endif #ifdef CONFIG_NUMA_EMU diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 8b7c6580d268..cf7b95125d2a 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -737,12 +737,12 @@ void __init init_cpu_to_node(void) #ifndef CONFIG_DEBUG_PER_CPU_MAPS # ifndef CONFIG_NUMA_EMU -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { cpumask_set_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { cpumask_clear_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); } @@ -780,7 +780,7 @@ int early_cpu_to_node(int cpu) return per_cpu(x86_cpu_to_node_map, cpu); } -void debug_cpumask_set_cpu(int cpu, int node, bool enable) +void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable) { struct cpumask *mask; @@ -812,12 +812,12 @@ static void numa_set_cpumask(int cpu, bool enable) debug_cpumask_set_cpu(cpu, early_cpu_to_node(cpu), enable); } -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { numa_set_cpumask(cpu, true); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { numa_set_cpumask(cpu, false); } diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index fb4814497446..235f8a4eb2fa 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c @@ -514,7 +514,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) } #ifndef CONFIG_DEBUG_PER_CPU_MAPS -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { int physnid, nid; @@ -532,7 +532,7 @@ void numa_add_cpu(int cpu) cpumask_set_cpu(cpu, node_to_cpumask_map[nid]); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { int i; @@ -540,7 +540,7 @@ void numa_remove_cpu(int cpu) cpumask_clear_cpu(cpu, node_to_cpumask_map[i]); } #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ -static void numa_set_cpumask(int cpu, bool enable) +static void numa_set_cpumask(unsigned int cpu, bool enable) { int nid, physnid; @@ -560,12 +560,12 @@ static void numa_set_cpumask(int cpu, bool enable) } } -void numa_add_cpu(int cpu) +void numa_add_cpu(unsigned int cpu) { numa_set_cpumask(cpu, true); } -void numa_remove_cpu(int cpu) +void numa_remove_cpu(unsigned int cpu) { numa_set_cpumask(cpu, false); }