From patchwork Sun May 5 16:06: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: 13654466 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 98929C4345F for ; Sun, 5 May 2024 16:07:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 310876B008C; Sun, 5 May 2024 12:07:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C1026B0092; Sun, 5 May 2024 12:07:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 188176B0093; Sun, 5 May 2024 12:07:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EB63A6B008C for ; Sun, 5 May 2024 12:07:41 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A07AC120141 for ; Sun, 5 May 2024 16:07:41 +0000 (UTC) X-FDA: 82084822722.06.BFD7DF1 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf14.hostedemail.com (Postfix) with ESMTP id 6457D100009 for ; Sun, 5 May 2024 16:07:39 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mnzdUSuF; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.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=1714925260; 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=7cP+UE4ru8ZOp4Lgw8abtA3l8iwc1zc0WynmSLYuYazHXzKZVJyzHCRKYPRnxTnSsO/KCj UufrhO0yOYD+n2Ec+dca1JJAJuSLHqeRfGg/A1ovrOlaS2wLlCftTtLBc100mHRLlz/L0R 8W4nPSPdoQGud3w41r4JLqSCmHZvtP0= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mnzdUSuF; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.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=1714925260; a=rsa-sha256; cv=none; b=CpNWfNeocbcKIiHlbwH27P1hcqGJZwblEvBnoqBohVoDxEL+oHw6YFI1gxtCOFY8UnjCZN ItZ2vZLQ5tbOCDCnAwYyZthF1OSpDAwoueqboME01k5kS4xg3lFbwln3zK8V4qxTztc1he f2JWNIqTMTfQeebObgHY+CfTcxi8bXw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 50247CE0AB6; Sun, 5 May 2024 16:07:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 556B2C4DDE6; Sun, 5 May 2024 16:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714925255; bh=S2WO9rrdnIu5PceUjVXVwYLrUCttkXy1oVefr4+OvH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnzdUSuFwZFr/+Ip2l7zLEpPo7HXw0QyaxcHIUqM8tYDbmvTYVi7whZRj6QYhAI5c u+OLcnSpi7V7V0jzzVPB9rWa+rJA3dD3nlH+8wp77vvEuH9IEFWLpzyrsWjJPj/jKs BDJmr/0582lWHgGlperk2Rs+BsENvYpmK5JvRFZoFvCPINOMHITRzkh8LcMznIdb8y hOOVaEDM0UZeQGuU9MlrUVaRg389IJ8S7gihJymsFxUbKAYtkt7Avfm7rb5zhV1CaN R6G5Pk6nhS/74iVs2XgCvdWj3a1mXB9GimpVhAzA7uDys6bqCeiKfazaVLcWk7io+d ZIn5pR9SP9ZcA== 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 , Liviu Dudau , 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 RESEND v8 04/16] sparc: simplify module_alloc() Date: Sun, 5 May 2024 19:06:16 +0300 Message-ID: <20240505160628.2323363-5-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505160628.2323363-1-rppt@kernel.org> References: <20240505160628.2323363-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6457D100009 X-Stat-Signature: ofsa353u3fzdj8dfzcu9jzp9cuiesywn X-Rspam-User: X-HE-Tag: 1714925259-797693 X-HE-Meta: U2FsdGVkX1/ZuZLa4SBTE73pjOywsgJDnxBwv9ZEazgLe7Ee6SOO9ddotzSbqc2XXH/GQxumDXSPElfsU+UU2GYoTes/0bc2Y2ijMFft3D/rSZlkaSLkaRWE15YwHhAZUdwHp5gOYaYXssXXgUDNMH5nEKLEPuKdZuFbLyt8u6Ml9XH8WeAnpCw0EGulXx8nwVrlpe/12gRLqz/QQkSnMdwsCfmEglsev7pZ7QQk8v2/O8g+B5pfjruq5bf78kpcj14Z2YMEIqdP0Xm1kpFT988z7XQ7f9S+IAZTCkU/oN1nRMT1qPQf05vfC7Zy7+UMqACavgM2ucUsbjdB7wqZ8L784iAZR1ARIfSKqB7iH7vj9eIg4JVLsAABm0mwxFarHVtqP0d9m+YmW9okE+2S8HVl2+f+lmhAmXP6hL7HVSrl5jNfm62/5edzdPbOvMYQ7U8ew54/x4Yqb3sFbs7DUZ13ysa+4cSI2+rm2ab5CoMaiBGqy/FTKUpiYiv3egmPxK4d+YZIrZ7xTqPdN7suhJjoFpAnOryHrxO633hRQjjDWg+JxdDUc0ASvIViKK9CDw9cOcKq35byWs69kUDD9rZWD0hzS8REXTRfbVGz0tOdJYGxvHOhEbO4v9zTDmhx4mYLHagTF+C10shv5ntJ6OZojRjoSSSnrd02wvwfA1ZhGUgSjTcEIpZJI9SMhHWqx9MYr8qNocTaIN1OvEnj9n55UIdWKD3NqYg2qXRC4Ys8fllwUhIS1kbVWi5hFfdgl0dj/YF5lJEIyB/4VuWW2AinDwA5LOSoy21bG1AHuI36fOvWxUSUZS67BATauYjZ8SejOI8sgivGC9Ijs3fOWgCNj191ZIpZQqYcQwUJ3BzaKkLrBVwWaZxa39NQBEr2Ef9J348mNFF0hKElaKRya/FaaTv/+oM5HO+Xc7aFnVVIPXKODLw4K6ESDUL+vd9tH0Nsm9M/afnqNsPxvhj YG2Rs6/e N9GsP4jXGKFbzYZpVzVlfhCfbsyehEVtG9pa4x4TYZT0eET0xat6JOsa0kzKn7z+eJmkho5GnaFaO9a6sDFFJQi60x1P6XZMNheovI3z2Pf97idSF7pEJ2E/okVgdr2nquOgNIDKnuAhBQVYMEYoo5ptyHftlrLD9myDhXZnAY2+MZe++C4pxCXHnoPuNLVXeVinBIe2OgExxxej5BKRp0trXYcTAB9OsdOhqRrDATcr1TE/x4DUbWTcOP+yi8WELoGLfbMcsZDku/OK8ErZUTbYlJW9AfZ2hEsbUJVb6lB7nkbV2LXEq2dAxtkZE77Ze/xf8DGEBvR/1lM4j5QVsGlclZS3AN9IxGG8gp4SogRYjoSGQPAJH9aGKf3TbwrIjlBrn/vXYIk8EvhBjj635J0pUhBzYzXgY9RwMf4TQyJYcN2fDRyWNiyUUfhG/9jtqGsbenGrc9g0/cCztwwqYkWWLbCbPJr+K/8FD0o23PDKw47EZyvjULqoUZrfMlplsGD6/GS8I6hfNUQbDTHAdq3dieQfO3KRZ2I1V81ARmCIhYkBH8o5BxwOtdIN7u4ffpMLxnmR6e+5FSF4VfHbsVoQEEGm/5JlnLFfrjlX9Xv/3RMI= 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,