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 3E7F8C4345F for ; Sun, 14 Apr 2024 06:55:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 361666B007B; Sun, 14 Apr 2024 02:55:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2EA476B0082; Sun, 14 Apr 2024 02:55:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18BBE6B0083; Sun, 14 Apr 2024 02:55:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EC8CE6B007B for ; Sun, 14 Apr 2024 02:55:16 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 720101A0444 for ; Sun, 14 Apr 2024 06:55:16 +0000 (UTC) X-FDA: 82007225832.24.55B61B9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id CC52080005 for ; Sun, 14 Apr 2024 06:55:14 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="ExCk/4I4"; spf=pass (imf02.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=1713077714; 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=hDEviNYbXzxL9b/8RaN//YNQp1iG/5Lu2IdVlexJ2ps=; b=cdrKhoy+PQbU41ZE693pDI1ISDL83rSXChQL9um7xQtYSQm+3oc1YsH0gk6fcLOCPdR3xq 78VmQNFuuNQQwZH+/Ev5TDEfNfpx2jDhNB58xmPRSAX265m3BYIk1Eubv93dD/gVYmtuok FjF2ZZNzYH5s+HZX020IX0U+Zc/CA00= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713077715; a=rsa-sha256; cv=none; b=UulNAHluFEhOyGCOGVxdOkXkShfiKb+izxdQ41gQDlnmsWInLu7Xh6cUquEOYA8GaDZMrQ 0zCbEjjKS5hQbefO19rA5j8qodFp5REhDjtl693/65LnzLmv0x1kqgx9DBE+o0vvC+cV3w uGWFFNCBv7hNQ6UqqWQmVjwqXaH5+bo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="ExCk/4I4"; spf=pass (imf02.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 8F54E602C3; Sun, 14 Apr 2024 06:55:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6995FC072AA; Sun, 14 Apr 2024 06:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713077713; bh=yXFVMzCDhJLeup5ZM/cl95e9uW89yN9aiaOn424Za9g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ExCk/4I4W5Phef5aKaCHl7yCjGPCdhEDo2t4j5gOOcRyNoNKAWaoFjcjUPNV/ZDjL NgPGAZFKEHXGgq8aJVi8Z2vvDSoVvCAV16D5jLcPzItS86EojO+p5yw5DDCakIbCdC uDA7f0oS8i29LKJV724dmx85sHqKA14tjFqITDp8vRb8dfZu8WBgwU1FYXq0TYmRGR 7tSa/jZjNfXa/T7/J/CXr2wjq9OOfmF2PhtvRmpH6VXO/pNGCEo0ysFPCgbJcswH3+ 8pSQxW9Jh3lYLdHalhcMBeJUrFP7jE5aNtiOQBUuA7scvpAOHZqdofUGHWY2VvqQnF hEcRjO6WYTf+Q== Date: Sun, 14 Apr 2024 09:53:59 +0300 From: Mike Rapoport To: Luis Chamberlain Cc: linux-kernel@vger.kernel.org, Alexandre Ghiti , Andrew Morton , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Mark Rutland , Michael Ellerman , Nadav Amit , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , 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: Re: [PATCH v4 05/15] mm: introduce execmem_alloc() and execmem_free() Message-ID: References: <20240411160051.2093261-1-rppt@kernel.org> <20240411160051.2093261-6-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: CC52080005 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: fi4o479sozt5iwow1qisk4g1ewmyhta7 X-HE-Tag: 1713077714-67193 X-HE-Meta: U2FsdGVk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DZwNmhMu0PfFng4Dz2gZF6tt6konr8OeXbeteV8Cr+dYcISKq/lv+hIxv6HZGVCVmYqs7eLWkakwmJ8CLj8HHP8gLzcypOUg6UynXEWL8Qy2GzWWh2tdCjAdk1t/HeTgCaKsrReEEfASEFUpf887wcimWeDRxYehGtzDUu8G7Yfu1ydvE+lkBHGWUdW9oZ/10E7gRYewgIpTasR50nfc+LzDufrDTFWXLt9DcbXWUByGZ5YzXtxIAQb1SOhzJ2klhrlbaW5xbFHuHftw0TwKFjI1w== 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: On Thu, Apr 11, 2024 at 12:42:05PM -0700, Luis Chamberlain wrote: > On Thu, Apr 11, 2024 at 07:00:41PM +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_alloc() > > and execmem_free() APIs. > > > > Initially, execmem_alloc() is a wrapper for module_alloc() and > > execmem_free() is a replacement of module_memfree() to allow updating all > > call sites to use the new APIs. > > > > Since architectures define different restrictions on placement, > > permissions, alignment and other parameters for memory that can be used by > > different subsystems that allocate executable memory, execmem_alloc() takes > > a type argument, that will be used to identify the calling subsystem and to > > allow architectures define parameters for ranges suitable for that > > subsystem. > > It would be good to describe this is a non-fuctional change. Ok. > > Signed-off-by: Mike Rapoport (IBM) > > --- > > > diff --git a/mm/execmem.c b/mm/execmem.c > > new file mode 100644 > > index 000000000000..ed2ea41a2543 > > --- /dev/null > > +++ b/mm/execmem.c > > @@ -0,0 +1,26 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > And this just needs to copy over the copyright notices from the main.c file. Will do. > Luis -- Sincerely yours, Mike.