From patchwork Mon Apr 29 12:16:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13646869 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 1CA4FC4345F for ; Mon, 29 Apr 2024 12:27:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAEB86B00AC; Mon, 29 Apr 2024 08:27:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A5E8B6B00AD; Mon, 29 Apr 2024 08:27:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FF976B00AE; Mon, 29 Apr 2024 08:27:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 700C46B00AC for ; Mon, 29 Apr 2024 08:27:24 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CD2A6141B5A for ; Mon, 29 Apr 2024 12:17:35 +0000 (UTC) X-FDA: 82062470070.22.27A638C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id EE0B610003C for ; Mon, 29 Apr 2024 12:17:33 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eY+CKvQp; spf=pass (imf05.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=1714393054; 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=xv1c3NSNlbKJt7QC2dkLsLhlMd2xAG4RTcPEyFkesSs=; b=v8SyjPpQseiRbLhgGoUi3T1WMtinjR66CIcC/mZSOCa+OFM8opFzkBY+pLuC65r0PGO4DJ S843utUvcA23ka4dDURA9IZfCD4zbfzQwzTJ/xXOZf28yl0cmbX0rXICVdvA3kshZtoCxD iLckX5xOEbJlZ5auVVIqupK8zli/L1E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714393054; a=rsa-sha256; cv=none; b=k688/0k8moPCgD5U2oDNEz3RAMKNjhmguR9djAgEjtQNsjcKkqB5YZaDAJtRrQiVv0rTSs c8YJne9hWpPLpaYJaKWm4FwyzpDEN9AkJIN8gAmRsgXy4FFlhQYHjpcgyoneH416V091xx v7ir+S3R3KmBW763UUU0A1Mue3Ay1NU= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eY+CKvQp; spf=pass (imf05.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 66DA860C8E; Mon, 29 Apr 2024 12:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B518C113CD; Mon, 29 Apr 2024 12:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714393045; bh=S2WO9rrdnIu5PceUjVXVwYLrUCttkXy1oVefr4+OvH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eY+CKvQpEbCC4GEq9mhZJ3FE5BsnJ19BL7Ivo7PyNg71BRnOuaAFEg0KSZrghVNvV ObQrz9l0+bYy3QlZ9YQ8dXv5h8QvV3+JVzvUZqeEsxzF2a60QLWCwAz1NU96jFIZBi 1m4QSTc2v9kY9+G0DWUXebn9VsEnq1NwBgWlFW3SRmCg73CMRs/pU1KWc4wmegl8hy DSSnSwcHaZtMB3Lm13UQjGoBcMR/hKYJ4P4owP4UwgSq5QpstfAUl4Mv9xT31M+uiV L7eh4VzdXFl3wCM0qulEEQjZsKn/TS4CHIKYL7HF0CV9WLkaoWp1QqIsExZ7RpHASC 9rq8lfswVALAg== 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 , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , 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 v7 04/16] sparc: simplify module_alloc() Date: Mon, 29 Apr 2024 15:16:08 +0300 Message-ID: <20240429121620.1186447-5-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240429121620.1186447-1-rppt@kernel.org> References: <20240429121620.1186447-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: wat9zdenpuc5dm9ouk1ty45n7ynzqbmj X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: EE0B610003C X-HE-Tag: 1714393053-208314 X-HE-Meta: U2FsdGVkX18xdecBQmX3BiWtwmdj8MazyNmhMYXSi8rKNbHzoy6LbLroLlezp+ViOZvXeA2vQ5xTrWNPM4jNGjcdJ7XNsqOfwM97RuF4l2zw7qWgTdV1Tml80LEndAr9BxOnXi62aCDnKYCcl5EvbD/7W6Mp06/4GWTh8pM80pYj+bxXv1oz0Tw5Xe5o0TbbwjKc13Wq8JgWo4oKIJEg1dmZQmnj2k5AMA2d9WjNBcuiyGWGdP+hhDuR6+u+My0atczjidS6VCxKKt//UohKYpzZP/jM4kLflC0d0C6zpwfBdfUbTCvrA8J6EeBthaPfFI5MznBA0rAMncHD7fi3vxhcyWeY5NgvJc9RNA2hnbrAkXLEpZzo8/MktzVsfBYsh6VgeEpuE71HqUp8b1PWaVNrNVe2oQcTC5YVwvBXDeSPk+nCZ3zR72/f6nZ2hOX4FptP8ugDv/clrIn3fQU7K/rrp4EV65uGQJzZblxsMC3lwjZfFkPqAcIl0/oB+/v9Ejwsy4KJppqZurZ2l9y8EX/ycUJoBvKTjnR8NMmNwLmCDcRg20EdjMIiCcfO8Rm/8rciuUqKawDeh4cxhFooNk+73nBSOO7s1e0ZOEr2h25S3pjtgzjG4c4iGITScD68Wm91LAhx7Cl8ZZTy5BGncd4Y040NeSIdm99PuhhZk4yhQ6izZ9MKZT48Ej1rpbSFi/kmi3A5rCdZAJvvoqddF4cr5jKkHOj6jFwyJ5V5C6w5hED74ztlXqZa55bc0aYRzD+l2xeBGkQtiRfedcTLi7oNXvvvqM8zXeD60TllVcWWMcfjf3b72LMcwGCHZOoCDRZgpAM08XSim7FO1L5vjEm5rj+wTVToPAO+3zJqiCmQcAdd+U/iu+VZLkDnzd7TwMYfSb41K4M7TZGMskPMkksz+o6YPX1p5JfT+iN79rHx3+42eoY8ORSpKjSgRDFzVcaG4Rlx1XFgzf/Ahdz mSXekm3B f2XiptsqD0gmM+L/qB+itAJzwd7h+Q+xU3TqhCnRPthpK1stjUN2opexug8x3QBhwfCqcASVTa8PrjjU4HrIFuOW2DwtLceaJ/zTyhKOFejgD6L4Z9MaDbpy6DbfHujRBb6BMF7wsJxJEUhdKWD73H0yiSK677woDdo3QWAZ1yuiyXDQWymXs78jfWjKaemNfjdT7AwNVrkhBcc12ytAelzxIOmTvkGvyI+4rh02Bitn3rU/wjrmxAZOtjVR/MAMygA6LyNVjNbam7SDGUfSyeZ20kX2qhmcKmge5nTJW23xWrHGOWGFd86n78AqG9ZB+9E8HewQCt/CXY0VmWkETGHLm4WRXuRLpQov4qf0VrIXGS0WPgbfpYj/0pK19qpMuYWAeNeM7NyZo/EbibdAQOqSa/WfLOF5Kf8GZbbcwCeEEhyIybSeFKmGH7U5ZP2EyfqStFmNR9lTFBNd+J0ro4SyHxrxmM1ZxmK0DNM57N+eXdwxxZsCbR2grCwEfMVei455X 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) Reviewed-by: Sam Ravnborg --- 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,