From patchwork Mon Apr 22 09:44:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13638120 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 72A24C07E8F for ; Mon, 22 Apr 2024 09:45:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F9026B00BE; Mon, 22 Apr 2024 05:45:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 080876B00BF; Mon, 22 Apr 2024 05:45:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3CAE6B00C0; Mon, 22 Apr 2024 05:45:46 -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 C1E5D6B00BE for ; Mon, 22 Apr 2024 05:45:46 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 75DD0C06A6 for ; Mon, 22 Apr 2024 09:45:46 +0000 (UTC) X-FDA: 82036685892.07.53695CA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id BE7821C0018 for ; Mon, 22 Apr 2024 09:45:44 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pTzYnfXh; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 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=1713779144; 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=gLcqR744GpBLkE5pWgIaCTqVpjjcEZ9vTTfJ8PMlxfg=; b=Lg5PqNyKU450U/4X/Vh0a4VzcItIKGIwLrEy/IQFWjmntXwmK8XgL8xX31f8uAJwV16TeQ 2GroM+Vsmrapxg414+4djFTUuwL/Bb/9VTArrBiClXS9TyCtoyWRqJ2WHmLWJyMCIRkEbT PFefLR4KPG/nkpQFEAHumMa0X++SK9E= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=pTzYnfXh; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713779144; a=rsa-sha256; cv=none; b=5B4Sgw/CiFAYrmOyfV9GBQioy2kVALu59QQbOdwUw4OmzIlaiA5ZVF+f/tq7KJgy3G2jBd BILrahC0QHgvGb5jvFFwFGFsqzuVBCJnSFpOHKPfUq4+Iz77EhRMg078aBmEnWBPh73azO 0qh9lfSqRA2+6The7Y0ZKmis0++dBac= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E0ECC60C2D; Mon, 22 Apr 2024 09:45:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 524EBC3277B; Mon, 22 Apr 2024 09:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713779143; bh=jgYZaFJ37N18LMQ1WJO1fYtb83p+Fzz2HBcTxrLBVpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTzYnfXhpjxu83nQPuEnNLRgHVoQQroHJiCpAQ3Za0sQG/dZMmhg1H4T+YOmcaqe0 W8/nK7bnWno/TQVlwkLSwhtUciMpaWbLG3k8baDb1t4dhUQEhwC+fZNZZ0aP4Ff0FA SK4hqgU6ME9logSwScvy01bmqFt0tlL8NIeHoaBIScIM5cBVNPh0LPNAEBVoxt0wq7 oM8kmGLxHnFtdLfcWmNBGVpaFk4UBmZXcVCJSKD0K7oqah6ftCD+6zrI0vZpt/vIt5 RvttqW0vSfXuroC5zmudSNEVC7fM/Am2IbPF+1+Ac1O0Hpgj2CFEzW94QP2gWq+6bd J5GXrq3B+u2Ig== 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 v5 04/15] sparc: simplify module_alloc() Date: Mon, 22 Apr 2024 12:44:25 +0300 Message-ID: <20240422094436.3625171-5-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422094436.3625171-1-rppt@kernel.org> References: <20240422094436.3625171-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: BE7821C0018 X-Stat-Signature: u65r7kbp54a4mir88ynxjkbqatzgcp47 X-HE-Tag: 1713779144-902185 X-HE-Meta: U2FsdGVkX1/o8x8iQcvlJFCtDdu8J7FeiLXT2fP4j1J46t44Re07siIj7kzgOHf/vbBWItqQhkLX3hz0629UP2g0gMjX7E64sRtjw02lYeF3YJcHRFiFGpTocqSh3WyPtEUkR7eUR/m1kDqGbPoZK/b/XDMDCi6CdXkYFsmEVmVMDwUMz4NdCofW5s3mjfEzTjnNIEULdPzoPagt4jMr/p2HdWRlmQHnySCiG7fx6WIEHNjCx/lIWt6GbC6L7cUbM2Z9lmMKk5chIy8brdR0idhqT3NZ3Ac5FpysOrj5ulnCve8YA26ah2ORVm48vV+PUq3KUAbSJ9GmsZuG7/JIHJ0tZtasjD014+dNnIzoF3JMeNPoPX1siP30+7hibzI41TRV4/atuRk/OLc6KrQRKsTy1EKZ32hBjcrUP6ru8U1Yv39GC7jobxDG7V7v568tykurTp1mpt+8kUVrPxEdclgE1BqEuKdgIQH1j/MICXGdvGtrorpy4IP2yatfvwZ4yiRlPSMGmeId4epzasmoaDAAmXVRH4rPiAoYCqeIN9kO9DeRlwTvczddJ65piRsRf63bP0B0RfY7EuiL/GlHvr4d/hlj4U9u1Uccr/de6OKGv1aj9GQ2RV5SzQNYL8h8cBZRWKqumWOJoYxx4ojSvX2vhT8GoRW8FWoaliK8lIk8JCW/oIuk1TWtQbxnnqYhwulRsGHKy2/qB8JacIZVhs5Ei+Ve3EId+Ot3AAPE8yOPmd2ZlCwM5gGM463TXvjf93GB9XB/7T7uVpH0Z/wD61+trrohmzSc5F6J8ZcHUUaYcgbEtqF4EtYJBLqj4IW8Y3Y/Kx4vBY1C3rBeFQBKEZnsbo1pcJmdITHeDL0IcSU4OTi9H46eU1WOoDVZ5kZPBNy42YDI1OyfYgD7RnUmz1fe4U0eBrbXCqrQBHMAaRT91fwPeK8Z7KqIzW1ahDOwALs80jZjJNk3FCRTBxZ xAqN7fqY B+ODGEmTvqdm4WHyss8R7J9SigFJHRNjhAqa74XxE9WEUJnwAKMu7BYZmR1uVzTN2Y5fl4cSQeRerouXnPlB896fmy82Y4aI3AkAnpXUpKg1uEA7aFf/eAyiXyTnQmoyODroIb8JWPH19jBwRD0ImtMsYmhIOk9bAyyWBx6akRRhav6FvWkw7V4+bk7Dwk3DXgAM+ktNADtbsIEjU5GvIKkubvmb1zxxOcivzAomv9ayFm5TsxcumXYAl+p3Nd+39SBvV8UcNR3NfW0kNYVYoMRZMRoPGhHBp2UPGeD3BtmzRDbVgH1hHQgp/gu3aO4Pjz1024+r2Z3BeST9f/fNFCiQknXBfnPlSemN3wEm2WjzEKpmUN7GH0KN8hwnFGwS6AYnYmXUS/L3ckAGaiWZFC4OpOivarKt/vi199S8VvQfU1vbfFjeEtIvKwte3VbXS0pI9vgbXTSI5Mn4660CKxxU5Zy6qTeDxgtzG9xpjSipIm+BLX4EBLVZ1X+w4d/EvXKnf 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 becames identical for both 32 and 64 bits. While on it, drop unsed 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,