Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp188964lqn; Thu, 11 Apr 2024 19:51:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6wf+V5pMDYC2m9sF3xchTn57btDwDbnRSQvDw4yfhS3HUboYxksBBaJhBz25cWu3DqBDO2hYhyKhC7GgGziMldQhYEaKHzayCMHSCGA== X-Google-Smtp-Source: AGHT+IGKnuLaHOlHXS9wZ42kNl19A3Meh0dfkVUMo2vAh28U/wSdE/5/iCQNx604NRm75XO0iqzk X-Received: by 2002:a81:5282:0:b0:618:4143:1513 with SMTP id g124-20020a815282000000b0061841431513mr1334300ywb.0.1712890308886; Thu, 11 Apr 2024 19:51:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712890308; cv=pass; d=google.com; s=arc-20160816; b=piQsMHhsiLOHooxh2dlNll2+y225qNM+ZY2bgESbxI/sYtSBE5m3Uz61pU17zCaXtF drd8U4PgTycu2Hze0R5qDLis+jnhAwa7g/PO+1J3aWmXg3Fai7mo6niDe2CHp2p21/NY 6Mu19f3Xl5uKDbQwbVGSdQWsk5nPCACCxUBIWjXVtkL3ynM8SlFrm2p+3b+r3iphp7F2 QOniF2w1WtaNLByaNMCbVjgyYss9tyfNR3+ozerP80iB0hFlEV8p8SS77mDRHGDqfDdP FuHkxFsZ4dRm3UXdEAEi8vTThrYA7QnWZN7Bc8NyfIdSTaZykkw9gLAIBhaMJa024p0L 14gw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=GLmQ6OAiLByfHZ0eGe8X2lInPvVUnYvYGHLtnSFpmng=; fh=jTjzqf4Qp86zU3ry7i1X0CkrpDSrtQRZtCooOT/2euA=; b=Ia8QRSf1pX1T2SBSisvRXg54i53ovaebVCgdYAg4EhB+O3oqzSn1ZYVPYSu3+glcqW GjiSD8p5Ce+/uJ2yPz3Re5T1S9sqMTPM0Hk/55CN6ek9PS8VV4mn0ZW6lprBPb9d6q7o l2PR0/k7GHd/0BoKRfM72wcz1yW+CkVISy6Sg+KlbfXochEwomhsAFgoSl3IW/pUPuo4 31yfdv6K8y0Jy/M7WInOdHCm+P0/QrzJTzEHpOVUtlCK4YA/57Yei3zmQqi9kfyyOhKh McPmGooaQhuu1Xj7CVh33Z8QAFaQDkZbJAtluPowwtLGY1UxaHb+3XfwKKFefTp2KYUc RKig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=p6WjKA9G; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-141544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dt51-20020a05620a47b300b00789f1f0bc18si2864985qkb.477.2024.04.11.19.51.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 19:51:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=p6WjKA9G; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-141544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 744D81C21CF9 for ; Thu, 11 Apr 2024 19:42:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70B2E17BD8; Thu, 11 Apr 2024 19:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="p6WjKA9G" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17AB3205E1A; Thu, 11 Apr 2024 19:42:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712864532; cv=none; b=XlaHC7zX76LVzfJ6evy+NPMSmJVh5NQ3NIw5DUMZaexrH3d1Z6gZmYZYj55HutU4TweXlZRH7Q1eTWAyfVJZeQuL5Gx/2LoHTA/WLTQyOfuwW3khTWJoP26jh3rPLzd1EYnGfs1Yn7syVyeLFXtBohmU/nyhrT2euC2UwQJF0P4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712864532; c=relaxed/simple; bh=X8P1ZrYs4XscfQnXoOsg7tnFxIk3wKaA03HALumhDfY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=T90FIiRFuPofZNA8XmOLbapTjyyfz1rKVsgsfxmvv+qK1WJAF+pXOBV+P9EQ4OpHNU6AUnIK3QiK4oUNBYWtk9rnyd4zyPYR5gKvaoRpUiAfR0EcY6ebsH9RJx4qDfue0uUPdYmZLG2F/1aQP79yVMXD4LSyN+70AI+2iWpef34= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=p6WjKA9G; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GLmQ6OAiLByfHZ0eGe8X2lInPvVUnYvYGHLtnSFpmng=; b=p6WjKA9G6dX+WyDufUHAVMvzmt TEEuKUVS+thzRELnqAjvnH6i10dz570nqrjJL9ZXGf4bZS1nXuY4F57S1i8sknzzTiosXrRMWtwja Wl2QVyKMVPgdD4djWPDJyYc1qh+eRSQYF6g3SQ+FxVhW8CjBgW1dMrDQA2/rPtVx22R2m4mjZa233 XbfrF3KCbxbV4a2eULYCR2JvTK5mnLn6In5XBzJIKJGJJDaTbAKriC0c3xg5TIewrOd+koQ0lcmWE yuu9PAFmPro1hKpehzsdur/j+e2m4dzk/qfRpBgrPaEio0j2aD0jKKMt0SHDFcdZ3PlSFQUBMlTG7 n33Z/seQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rv0JB-0000000Dvah-2hQJ; Thu, 11 Apr 2024 19:42:05 +0000 Date: Thu, 11 Apr 2024 12:42:05 -0700 From: Luis Chamberlain To: Mike Rapoport 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240411160051.2093261-6-rppt@kernel.org> Sender: Luis Chamberlain 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. > 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. Luis