From patchwork Fri Apr 26 08:28:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13644226 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 B56D9C4345F for ; Fri, 26 Apr 2024 08:30:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F5C76B009E; Fri, 26 Apr 2024 04:30:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47F006B009F; Fri, 26 Apr 2024 04:30:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F8896B00A0; Fri, 26 Apr 2024 04:30:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0B99D6B009E for ; Fri, 26 Apr 2024 04:30:02 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B191E40F34 for ; Fri, 26 Apr 2024 08:30:01 +0000 (UTC) X-FDA: 82051010202.26.BCC90D3 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 10C4418001D for ; Fri, 26 Apr 2024 08:29:59 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=FxtLE7FD; spf=pass (imf06.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=1714120200; 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=v9h5Ceo2H7n+7/flj6+VCTiMD2pRka7m4z/lLKCOaas=; b=xXRe+00EoYDyfwzwRlbD8XSMd9O2NMmorYeIo+bazG7eGh9neqe/QYkve21oJrelZRX2U8 ISc8EReKnE7ETFZ1OKT4aQt7dTFkZE46vFCEpPFUeBEswPXzzIIqFZgUjQuRewTZP1DuSr FWVfXK/HAcIU6O5oJFA+7Kl6+0QXdKE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=FxtLE7FD; spf=pass (imf06.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=1714120200; a=rsa-sha256; cv=none; b=r79ndjetrJLGk1FYBZzXtIjnEnIH0MkL+Y0804Qyo13Fcxb82b0YfdVtRUr7pPbQCSlqXx DUJvgWKHfGb+1+/jrZYEA8yLZTBBqn9KtO9dMZYCWwOrm3Tz5K9GBbgIa5f6PHrgsdj39u TsqpRUkhQBb3EPlyOepk8TSI5IKGclo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3D14762002; Fri, 26 Apr 2024 08:29:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 542DDC4AF07; Fri, 26 Apr 2024 08:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714120198; bh=3M2ZG/VEWUi/tLsKuWV23dNNSZ6f7DkD53R0UR9I374=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FxtLE7FDecUHDXtLc4lOQtpBLWDxwjYFEEqYIkPR0QwLBDoD0zZ8t9vMwtiNZytp+ ABQ7RDoHM2Wc8RbUl8TpphzmEPE3zGDm9H3NJtnVJldRKMdfi/pFNBIoxoDEyAWloM qKk5ZdZFe/QBUMzCeM17G3JEc1Q4ge5Z39+eSmY1YmeSj+KnOWOdkwt7Vg0syHyV2v MWiu4EM+A60684+xjiReNXSAogLjTsxd0SEDmFZ/ASqSKiS3Ag5ts/MGVnz++OOj4B XyuNjsYN43GEx4Pus1MPQkKPSwr0XVDkAZGhn7sXt+cl6vvS3YrJ7KQi2FaOLbqO+3 OD3ZnzghTMFZg== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Andrew Morton , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , Rick Edgecombe , Russell King , Sam Ravnborg , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: [PATCH v6 04/16] sparc: simplify module_alloc() Date: Fri, 26 Apr 2024 11:28:42 +0300 Message-ID: <20240426082854.7355-5-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240426082854.7355-1-rppt@kernel.org> References: <20240426082854.7355-1-rppt@kernel.org> MIME-Version: 1.0 X-Stat-Signature: jdqemawouf38szkmnys9w4x4z1h6psmh X-Rspamd-Queue-Id: 10C4418001D X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1714120199-867177 X-HE-Meta: U2FsdGVkX1/p/6XY4mMrcW84ipn1hl7BrlCyuhm1rG9EoGIwhlm1vmD8c3v4OSH20AdmnhNZAVjmQVl/qQRankjF4ALWHa51LsH2uHeWIdSSgYVgDg7NnpfvRLFFhj8k4Zk2LLyrBwfjXj+hWUVzqfPtSDBWpHCGGpnJPOU35qF5BYpMfvZQAd4eM23o06k26b0Dw5VdCipY+5MlsQLYo3AaY3PBafGhtHN+dBQEoRg+x25+lo50N4A15AZnd4xuyGNtsJWbQU2ksuvt4zGDYH5mMguzqD32SkT2UqlXkTfXXDpEabtXgG8y6ORDdPQpBz1oEzzFJiK/h/X82JjqD9ooHvCCG9IjlGjvJ8G3eurQM5N4uNeRkB8eURJB/UHnVDN45Mu0UQw1BQES35rXD3YVJBhDcH6FFXBMB1P+fgrJwmXbbNB498G1+mq8VlEIk4X2DrtAGatWsl9e2YIJC0JtuerFGt1sqlCAL9FbZqdZuD+8WpIH4JTpTo1Y51LpzDepE1v41EAYyYEhamwv3yJYaJOcr31HbHAknTS80iN1pLJSbYSAjKVltrSmCmEY2192RlWySXmhy19NmI/UiIEDXm2Tm7Kf8gYv8P6lIMi59S1AXXrT3ljWcZU787sTVh15SKJMdw8z8fpXM1X5qIfbEFhO1VF5MSVdf/OagP00x+wDb4rqTd/WeHfJXiZqXsid/T+j0KNng/YdfoB6ADiGAiN/Y6UiM2ccIthcW1y+vti1pn1rrwllXrfeufvZyBa9oWazfTahmwDHPee9wxZUdtnP3XZyPhT4pgpXLQP42XzQgPGV+yrirbml3LViAEs9/u6LQV3eWiptTeQtbFXfKRRW5WVghkCgGNjRJBqMm3qwhdNU/+P5F1U7TkUw5/UAtQKZ8CirS60IqRS2K+nDiPLbyQDQe8ZJGgImnax2Yt1zDv/UqWuflF0CdT3zfpm6dUafxPszOiCFC9H ohIEnwVK Y9+7wCQqVmEzYtvVrN6o2DuwtqiWXPOoyGiKFhqbeccRE37liJP20Lp1r4s0gvquUxeyYbo/2crgmYQeJfl4p+/LAzjCqlhTrfmZH4ksRR1XRopmImvAZQeVokKS5Y1JS87VBax1k8h1gHyCgv0JygvXeHRKm04sfXa2eX+tifqNtgVEwvpFvjIL7r1NEdfKIqBEybItPYLd7ETR6vXddEMpoU9K76Y1HhH7tAw681ghLRZuhFIXXUFjQ3tHIutGTHmoKfd6xUsHca01uA5CG7nBKc0Yg6NIfNeCaRLj+J2YD6Qpb9j1V/azVkM70GsoesxKyJKcYrszz9SiDaDxSTcx2EF+iBC06XkcjovHByImt9mSufkdxoyd6n/jFZHNLDFs6liKR1LGsyd0Rwb7743JeUCDceznhIoA4qtQrYFt89tE58y3wfZk+nNBOwM5b4eDa4gLU7XrT2HZh5BsGsgOzDlE25egwsGqCLSvsKVrg+kE1Eny4WIgAs0PXhJ9dBKTJ 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 (IBM)" Define MODULES_VADDR and MODULES_END as VMALLOC_START and VMALLOC_END for 32-bit and reduce module_alloc() to __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, ...) as with the new defines the allocations becomes identical for both 32 and 64 bits. While on it, drop unused include of Suggested-by: Sam Ravnborg Signed-off-by: Mike Rapoport (IBM) --- arch/sparc/include/asm/pgtable_32.h | 2 ++ arch/sparc/kernel/module.c | 25 +------------------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h index 9e85d57ac3f2..62bcafe38b1f 100644 --- a/arch/sparc/include/asm/pgtable_32.h +++ b/arch/sparc/include/asm/pgtable_32.h @@ -432,6 +432,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma, #define VMALLOC_START _AC(0xfe600000,UL) #define VMALLOC_END _AC(0xffc00000,UL) +#define MODULES_VADDR VMALLOC_START +#define MODULES_END VMALLOC_END /* We provide our own get_unmapped_area to cope with VA holes for userland */ #define HAVE_ARCH_UNMAPPED_AREA diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 66c45a2764bc..d37adb2a0b54 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c @@ -21,35 +21,12 @@ #include "entry.h" -#ifdef CONFIG_SPARC64 - -#include - -static void *module_map(unsigned long size) +void *module_alloc(unsigned long size) { - if (PAGE_ALIGN(size) > MODULES_LEN) - return NULL; return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, GFP_KERNEL, PAGE_KERNEL, 0, NUMA_NO_NODE, __builtin_return_address(0)); } -#else -static void *module_map(unsigned long size) -{ - return vmalloc(size); -} -#endif /* CONFIG_SPARC64 */ - -void *module_alloc(unsigned long size) -{ - void *ret; - - ret = module_map(size); - if (ret) - memset(ret, 0, size); - - return ret; -} /* Make generic code ignore STT_REGISTER dummy undefined symbols. */ int module_frob_arch_sections(Elf_Ehdr *hdr,