From patchwork Thu Aug 1 06:08:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13749749 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 8B847C3DA4A for ; Thu, 1 Aug 2024 06:12:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CCE66B00B0; Thu, 1 Aug 2024 02:12:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 155C96B00B2; Thu, 1 Aug 2024 02:12:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE9A86B00B3; Thu, 1 Aug 2024 02:12:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CDCEB6B00B0 for ; Thu, 1 Aug 2024 02:12:00 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 87249A6301 for ; Thu, 1 Aug 2024 06:12:00 +0000 (UTC) X-FDA: 82402656000.14.D56FBD7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf28.hostedemail.com (Postfix) with ESMTP id 41C72C001A for ; Thu, 1 Aug 2024 06:11:57 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GkLWQm1Q; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722492714; a=rsa-sha256; cv=none; b=axiy2DNUN4yfJSVzor2asprhBI+MBKJ5Eq2k3fhCq28IvJvEhCCGOrpK3w6tfXWR87f0tG 6Vqs/aiNDCCbVQdfHyfRHHeN5H7C8oCth73d5qSsqB5aw78w7u0jlwSaY7Ek2O0DVpCyfj bKfiqwIcsmeAZJrLFs+CM7j5z6KdfNI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GkLWQm1Q; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.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=1722492714; 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=dIK4Q55zcs4jtLMV2QXL3Lds7wZWhrcM7lXH2HGTcWc=; b=z/gg1k6KGV0yJxYEV2m0si/xhszxZ8b2M2cySvXLof11Sh1c5oz1yCIK7e4pXV6f3XtbtZ DpwZjIvveECL/kLV49vzvujJTtA9Zvy8br4/BQBwNOL4Qf8j82O9ng9ooYLMt1tiqHowjI 7UFTI/SNvVXsdCdlNLVj/oOms36gyy0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 46118CE1802; Thu, 1 Aug 2024 06:11:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 529C4C4AF09; Thu, 1 Aug 2024 06:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722492714; bh=tUveSvpmOKw9bqMG5RQ6nMnK0ZuTV9etYelIhziTeKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GkLWQm1Q39ABfZyuhL6Q3SBO4x8iIO1aOYcDhmjxdECKBtds6RIO3AsP0dLgQUStG QtW9mrfuZenyPBlVOdTI6i/S7REgDYRiKN1CA/IZhqIQyTIcJ90XkexFNG60he+YcW nwrOGB28RY2W+r/fDE7isGmLMQjlQEUqNl+lxkKeFvYHRXETpNfOonPK6ZTeFWShkT jzJ1lBRW55/u4dxl3cz/0+RXH32Yt5toq8GS93/M5oq7C7KyDwt05M6VQW3pWbSuRL AZSqAJyclCGUpW1mJRDt2v/lV8TLLPtVR/5UoF3gKYIFZwKuaKKOEqL3YLG7fkgpyx /3cmatQc1Tbwg== 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 v3 16/26] x86/numa: numa_{add,remove}_cpu: make cpu parameter unsigned Date: Thu, 1 Aug 2024 09:08:16 +0300 Message-ID: <20240801060826.559858-17-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240801060826.559858-1-rppt@kernel.org> References: <20240801060826.559858-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 41C72C001A X-Rspamd-Server: rspam01 X-Stat-Signature: piw9uytybo3rkkf13jgrf4to3uyqfjg4 X-HE-Tag: 1722492717-222208 X-HE-Meta: U2FsdGVkX1/v0WQZESbAif+434pxuv3DiWlKGtlgxvM5hLMIkwitf+mMhuWwG6sixIvGod/p/DABKb9EjDZFT8CDDRs6WoU8E1lmcmiU8N4VnH0UfrUeHjbf+raY/RL0sKlH5lFU5i22kauMSHPO1Lz9eliSFhg6c9SsQwD4nSchJA7BFajXIj03HOdUnXz7O+fCMBAVkS0D7v89UdMpoW4RtkwY0GV5pZFEEKnmpuqSorJ/SsU0QIXx3ZwidWPxI+6Cq9Hkr36q04QVXS6DkinC3AsNOgQQHcAt9sorXEvJt+oYS6XgmpQN5KnU+OOURjlIUPHXaXag91LOtm7wCd2ZNY4YC6QB4iUU/kyUcwoxRWqSNhxavGEc/EVe9PmkcbaO5ZIOOOb/b6/jm8ieXxs6Qn6cKY+KSvf6r2wqnIZMzZgZR+bjC6fltILja9QVbzOGOxxYcygVnHUkJMlbTa5jYus2dNMKh5zqHD86dxupLVMpNvxFk8ugOxOnkhRdhlVHocwq/JL6Z6RH9Agshzn54b656xKJFxadtBfAoocigVEP8H/xBtdQzjOw+Cict1wyaJTMbreffPdGnq1gGtqRAvFD1zfsVCTNz1PmJNfCruVu8zACFLYYTs2qI2T23zelr7ZBhcanhLCJwYad7Bo2FQShe8duIliKDDtVIy1upCWOzCmCmGRgeuLPKwNvFpEYITjM/fS9Kb0otU0l/R/HkDPjJK+8oQ/uGJ9XA8qzceNq4aMoIwxpQCt4YJp7uKkjZBTy1S7zi5qvFADiQBX2NTxg1Qz8O8rnBRbBHhyjsUpGJ8lO2n0f0hUnuYOFqnnqeiwGiUBXJLiPDUhGfEjY9OAlTsRtgTH0dEXWT7+fGvZIR5tywYjdkkGp3e7c9MTo3mu1jSCsBzkDWxh4mSR/zuia+zjSIbVqJINkZ8ydndjeeQS2WItmsHdZkPAjOjV/Vzd9eOiLtfA3H6l C1vY0siz A0Fe4v57nKtCrkc2s3Oidwe3ZaVjyLItVYTU+MR3WYocSL6bQrQ6NhC7eUOAOIyOeDzJoRB6EO5oq4qBM2UVVFq706DA1I56Mg0swlxmRQ07Utj4hvMvL9Mm9lcjm/6B2ocGHMFcmc2xqAXb888IfiH+eHhsIOP9vCDDiz1Wx5WkJjpkFfODN8WL3GxgFiwt9H3oOxpwjKsFpbdRAKEICqJBDA3Ghv4YdFnzAEo23L2o3sLyR6y146cKcT823VqgFqZd11Z72EzdonEhtSCfjhBN+fadMVfgWunHOiIpb680ukL+lStVBIn64kCjO5AwjxMe+65S9xaO7nyZGVt1jc+PPKxfubvytKWvASYy68XRj/oF9gAuuhGIyyA== 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 Tested-by: Zi Yan # for x86_64 and arm64 Acked-by: David Hildenbrand --- 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); }