From mboxrd@z Thu Jan 1 00:00:00 1970 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 4E01CEB64D9 for ; Sat, 17 Jun 2023 05:58:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A50D56B0072; Sat, 17 Jun 2023 01:58:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D9F78E0001; Sat, 17 Jun 2023 01:58:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 853A56B0078; Sat, 17 Jun 2023 01:58:25 -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 731CC6B0072 for ; Sat, 17 Jun 2023 01:58:25 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 40810120C4B for ; Sat, 17 Jun 2023 05:58:25 +0000 (UTC) X-FDA: 80911184970.02.F005C86 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 729A3120005 for ; Sat, 17 Jun 2023 05:58:23 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="B9hc07/U"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.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=1686981503; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+kGWBLyDfhTCDtZcBuR10p+fn54/Laq+yoObILqNGYg=; b=1O50BV2DfdUZ0VLHoDV/2kSlatexVvdMxXqVLn/wZXd5ZlGDgsyYJ5Vld6Dr2t5r089haq KUWyD1ve+gbckgua4M/sEmbUbX4BUA6pYEbbOVQ53HoFeB3jTaYF34ZjtthG7QpMaef5xA +84iAZvoja1G31TjOXvLmQfjiJqkleE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="B9hc07/U"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.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=1686981503; a=rsa-sha256; cv=none; b=IHlYpNEDPZzfJoVMf76HINeT78lzj4zsTWSLPl3wNgO8m4YS5LHO85NSQdxacccKQ/boLm Fm9OZ0eo1vRt/dgpd2Qqkkt2FWgEglPKbnTB53Kq9xwJwRJrPgKfQ51j3/XB2bcwmvRguF RX+UMIDdGwAk6nFHQYMgt3uNNf6FsAs= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 73E2760D2D; Sat, 17 Jun 2023 05:58:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA841C433C8; Sat, 17 Jun 2023 05:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686981501; bh=9SqjLlF2xzEFMDzeUI2FvZ8TQ/VYLeU5U3+d2ag6lCs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B9hc07/UYnnRas23n9bJwWr+pH130gxwd28u02GqPOK/3pfJBCaemAnqVGrkDZJvc c1CAOIsikGJgqoHvH/7lYMCMhV6ZKfKOSUTWgFsy65h+ShXGvPeLAwohq+3h4qZEdI 4hdYWdRJ1+jHavy8l0eCEiP9dZuoxTKyc1UOJ6v+W6Yd8E12mVMWzVMrv38nPKgPzX moqJqCymmH/VJkuy+GUQ7PHhVA13ypUE+mj0CzOEMjMShVb3ccT9eDbLaWG8SQqxxA PHzQL4oLwI3nEQGSA+tdAQmm6prwylQLhbSagwZslqD3uTtetH44zVkHm5GQY4CCKg LaEhwb1fWA+nA== Date: Sat, 17 Jun 2023 08:57:35 +0300 From: Mike Rapoport To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Luis Chamberlain , Mark Rutland , Michael Ellerman , Nadav Amit , "Naveen N. Rao" , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@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: Re: [PATCH v2 02/12] mm: introduce execmem_text_alloc() and jit_text_alloc() Message-ID: <20230617055735.GN52412@kernel.org> References: <20230616085038.4121892-1-rppt@kernel.org> <20230616085038.4121892-3-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 729A3120005 X-Stat-Signature: qyuria1z81kxrteadhhwjbasyxrtiis7 X-HE-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gZ+H2FvhuZVHQQIMD+u/PAHtatKkfPOXZP9GVVVHxYoJavKXhLvc1irD3HrskNNvtby0o67SVn+x1vx2204f59cJ6dcloU9Ack/m2Ru5MnS3IDXo9hC/lF6dysJ1w3+nZQhQrBJqNN0AVES+cs7F1pNwO19y8MkbHBi67VCXHKdlBgPeUyY31MTRegb48gscC2hm8EICcTHqu6RSmhGbMazRFlQlNcqT64Nn8h/0gNXX4iRHwxxYEw3WBUbt0ZvLPamMNKgvcl+AD+s2Bt+s4Xt+rgEaFyliIBVukMUHHD3lE8AxZ5OcDJfJALo3T7WYczHaRfuUFeTuYjjpf2PVgzYTtjjMnyDKftg5C4w6CseQltSriTgFWKPpEvrIyK6WxlehNqEktCD8Q== 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: On Fri, Jun 16, 2023 at 12:48:02PM -0400, Kent Overstreet wrote: > On Fri, Jun 16, 2023 at 11:50:28AM +0300, Mike Rapoport wrote: > > From: "Mike Rapoport (IBM)" > > > > module_alloc() is used everywhere as a mean to allocate memory for code. > > > > Beside being semantically wrong, this unnecessarily ties all subsystems > > that need to allocate code, such as ftrace, kprobes and BPF to modules > > and puts the burden of code allocation to the modules code. > > > > Several architectures override module_alloc() because of various > > constraints where the executable memory can be located and this causes > > additional obstacles for improvements of code allocation. > > > > Start splitting code allocation from modules by introducing > > execmem_text_alloc(), execmem_free(), jit_text_alloc(), jit_free() APIs. > > > > Initially, execmem_text_alloc() and jit_text_alloc() are wrappers for > > module_alloc() and execmem_free() and jit_free() are replacements of > > module_memfree() to allow updating all call sites to use the new APIs. > > > > The intention semantics for new allocation APIs: > > > > * execmem_text_alloc() should be used to allocate memory that must reside > > close to the kernel image, like loadable kernel modules and generated > > code that is restricted by relative addressing. > > > > * jit_text_alloc() should be used to allocate memory for generated code > > when there are no restrictions for the code placement. For > > architectures that require that any code is within certain distance > > from the kernel image, jit_text_alloc() will be essentially aliased to > > execmem_text_alloc(). > > > > The names execmem_text_alloc() and jit_text_alloc() emphasize that the > > allocated memory is for executable code, the allocations of the > > associated data, like data sections of a module will use > > execmem_data_alloc() interface that will be added later. > > I like the API split - at the risk of further bikeshedding, perhaps > near_text_alloc() and far_text_alloc()? Would be more explicit. With near and far it should mention from where and that's getting too long. I don't mind changing the names, but I couldn't think about something better than Song's execmem and your jit. > Reviewed-by: Kent Overstreet Thanks! -- Sincerely yours, Mike.