From patchwork Tue Jul 16 11:13:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13734338 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 7B77EC3DA49 for ; Tue, 16 Jul 2024 11:16:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F71B6B0088; Tue, 16 Jul 2024 07:16:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05A4A6B00A6; Tue, 16 Jul 2024 07:16:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E16686B00A7; Tue, 16 Jul 2024 07:16:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C18E86B00A5 for ; Tue, 16 Jul 2024 07:16:00 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7DDEF4161F for ; Tue, 16 Jul 2024 11:16:00 +0000 (UTC) X-FDA: 82345361280.15.DAC1829 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf04.hostedemail.com (Postfix) with ESMTP id D3D0840020 for ; Tue, 16 Jul 2024 11:15:58 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jTqJhb+J; spf=pass (imf04.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721128539; a=rsa-sha256; cv=none; b=S2/LPmYhGIFbYGPBxMqsySbdu6TIf1YY8niRGbN/yVy+HvVjnpLfBjnQQ+5lntf5QWNvvx ZHX/KrSLZZoz7DqsS9rr3H+JvNMRbU7BmWsFalvdMPIIaGcdWWhkwulgj2PdNMAxL9JhZY zuekVSg2sIV5RJM7lMmSfzFwxWitjOc= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jTqJhb+J; spf=pass (imf04.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721128539; 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=GsHM4en1ORUNmDX+9w/oBAP4Y8AolH6zdlJ/OX2HJNI=; b=r3/vg8R5yQt6Zti45ej+qchvvZu4rEtRZATvcw0lzLT6jKY/JdAr5ukPUwT4gnYpCvuKEO 0rjSkdIA6Q6yy73Vz8QzB7U6Y6uzhPO4x79zb222Bl4o8lZ6G2eBps52cFNBgTspg8UtYd zpOsorfkieihLNP9LdVzASdpV1/hBcg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1D31060FDC; Tue, 16 Jul 2024 11:15:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 336BCC116B1; Tue, 16 Jul 2024 11:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721128557; bh=6ZFGRjYd+QNIUdrgNxjtQqFy9oztOVb4PVdQaCr1DCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTqJhb+J/VW8s8FQhoWIm7JmyR7Sc40Gf1abzPVEtyCJSyOeruE4iUvKzhPwGcHZq Gi4WEguWl1O/anPnXyjcLo96X7Rifluaha+hVAmP+qOfc209n9oCyWPBZRpMoYnPr6 Z5AaKpJTWx4q2hkMglcJA9vMoAHkQ8xT0oT/X8MLKWMqltWUD2nJJ2C/UHWolUSTPw xVAV2MG3lf4D6NoKqyzRsu39aHx+4G8biXYYgL3Uj8BUvthEwCiNO+ydarfCknuyZl 1o6FotWt7NVXmkyVxnHnLouc/cneAWx4CdKbtUK9MU4VFqae25h1qRS7if/PMSm7r1 zsVdwrWEOeq0A== 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" , Greg Kroah-Hartman , Heiko Carstens , Huacai Chen , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Jonathan Cameron , Michael Ellerman , Mike Rapoport , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Thomas Bogendoerfer , Thomas Gleixner , Vasily Gorbik , Will Deacon , linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: [PATCH 11/17] x86/numa: numa_{add,remove}_cpu: make cpu parameter unsigned Date: Tue, 16 Jul 2024 14:13:40 +0300 Message-ID: <20240716111346.3676969-12-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240716111346.3676969-1-rppt@kernel.org> References: <20240716111346.3676969-1-rppt@kernel.org> MIME-Version: 1.0 X-Stat-Signature: ftgfp8494pito9hasxuhys4m4cmmasc9 X-Rspamd-Queue-Id: D3D0840020 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721128558-171505 X-HE-Meta: U2FsdGVkX19x3tDTxUCnWsvUQSHQBETYmxG3CWkQ/Xy++TRPNGVJn33aY3Cn7mWcevc2AVCcQUdq10NQMRZobDzuQYndCg4Tjq7eYqUvjbSBEm4drWWsHZeqyBe0k0lAFgboRjktRLyrPE4lHUNLWEuIJLyAWBKkaZRcC0q70PPB7F4M6KEaFLWFc7WyS9/DXIA+VOiLLzClLdmmP4WjW17kd8ayvg/ZzmWM0rMVDuClGEXpfQwe/khURgim82VhRLqXZTmQVxvE0GBDil6qUYv5q3Uqs60qK56shdhcGNqSRLZVy0RryMD+Zi/uMthJ/72ngpIlmpCIdJlQSx/QwGtg95xTofop36NzcNoCVPmP3oyuF4GJONjhI/AHW28H6dh2r1lBEI6k9NM7lvdH6D5YtPjS+tCXT7gMWUuE8aN6v3HNMVkpos59ruvaRY9Hvsidv6apuRv7VWl5kWzaHXWsv0urVw+lI6wsqobb3CcSW2dk+Wb6yJEVYE1F5pf6dO0UpBgbWakSoXlre0Ml9L9Ze26LtU4gTv9VjaQMOVYi2Kug+oYdbno0bHF0xPQXWISI3KtdhGoQN+aHRIZchi/BcwxDhYw5r4zt5vxOL3GTSoKsiAbZUjRRmTHnJZS+6JMccYVzgaYOB3V+2aIaKSexwHReK/GKXcU8WZe1pbpHyFLqEwvp1WhULaQq54pPiGPMTfd+YxBD5MJi6/VeioQ1GgNnTvkImFEqK2DzoVNbNUjeaiSLJkFx4YBZX4e37Civkc37P6PN5UarEkTty6wusZTWbgcT456j/ooAds583Nqkq6BLCmKZYG2ISovuY4423SlWqc/SBStDqOBcXXSgJzSU9dZ+BdM6IvrEXPBu4SkjcKUrCmA/xgKTM8W1TqGQPk9X7SClsjxEeRqsffbmELiLfpqsUf1B1Sp8KGXorKn6u9EkzwMyEX+icTJsLywBkNenCCbWH0hU56U MWQ6reFx /udSRquJeFDUuf6l4Aqnj+c1/wFC11gZeceSTffvkUZ1oyvQtS3OhodrCOiIztq4bQSxpvQrYinfTrpJkyNJ60bqIffUZHJNFVKOP1d9IC9mg5RTymExIFSZIaoych67bmWSkPix2sQmkDQ06K7ufKrtptTv2+2mlnfopCCqP2eN8NtJV3ADvbxj8+xB8jLw36nTDGiJ1mrTlwFSBNiUD1buIIeP7o1vRYPUSadMoQUY//p0gcfvcZrHdQLzvT7ACNLuf+IVslPD9rFT16wr4sfxs3XfCe+BQl0ny 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 0a59e3ceecda..deaa4816a895 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -741,12 +741,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)]); } @@ -784,7 +784,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; @@ -816,12 +816,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); }