Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp170403lqg; Fri, 26 Apr 2024 11:50:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSBuyvYUeQjcBBRO+71HR2BVQDM1NoAzoPohyjkZrWVg3T8/i96vao65lw6BZM93X/M4wJvrxWdv+pfrs5WPSfNQsbVUfLjhOrAzq89g== X-Google-Smtp-Source: AGHT+IHvXnRJJjcVhkUzOANi2JsBg6AUmZtG9e1IVXOFmdV2m03ixRS5TUGBjdbHGIBFhns+fePo X-Received: by 2002:a05:6a00:2441:b0:6ec:f282:f4ea with SMTP id d1-20020a056a00244100b006ecf282f4eamr4131550pfj.34.1714157454332; Fri, 26 Apr 2024 11:50:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714157454; cv=pass; d=google.com; s=arc-20160816; b=bOHdJbUiHknm4QZiV+7rq3ViU0zfWptBqTTForOzZsrVdEnAtS3YCEiNn8jPnOTKmc dJ+TyjcDLY/LN1+sJQNA/gsH5xGjzhuGPueyFPBv98qysomW0pHhwU+prhOOqiMy15TC rfckSpWte8NGgDNUX9/CJqGrCBDsAHxWOVXcN1ILF9FQS2PiJPRxuympoUXWuQt1J5sl qFcqCDWbtruw12gxQjMj94HIaKVLovLS6fKCYqld3bMmOckcXcTmWclSo0vhVc0U2roP j16vfYi3qhRC4gxqp29vWk3eJuY469ypaq6BJ2HvMaL7dobxTAoA9dcrOqmRzEgqNwi/ vxSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=qzSv2gnEZ82yuyykHlGJGrukq6yL7NdagG67pBjWhfw=; fh=i4c7eGgc4NnoRxUANGIUbkYuP35D1erzBblpfrtQC9k=; b=v0Zyao/kv3CNdAqmV+v7+DBFWYWXYsQbX/IX5kkgg4VxETkCVPmoelB5TlSolo5b2c 5K83mB6X3FT1F9MVi+LREosqaQeltBZrWn6oWZx5BhUXwyTMEv72v3BuXACR7iF7JRS4 xgW/4td2lRATN8hS2xj1BQqw3GHOVvgl3cY0FMaZbuBiiXJycDP5C5zDFEpZv/heHYi2 jHtBoHOsDatg+E/KNn+4C1jMHf5lipjSUKSPfkH5XMOmRmctJdswLDeRUS4Kg4OtS569 gt2wJ7vkqcKC2oPyx3H/2Vx2tJ7fq/r7efWmZLd+vxH7nQi7GfrdVhCjACI0bSJGMbsV 1tXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MJg/iu+I"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fi30-20020a056a00399e00b006ea9ca4970esi15843481pfb.343.2024.04.26.11.50.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 11:50:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MJg/iu+I"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-160584-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160584-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8BAF2B223B1 for ; Fri, 26 Apr 2024 18:50:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95758D2F5; Fri, 26 Apr 2024 18:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MJg/iu+I" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8BEF0AD58; Fri, 26 Apr 2024 18:50:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714157437; cv=none; b=dE0fYPzBr1CZS1lnJka6XTJ4Pep/EtOkLC/lRkWDVIJVlO7cxkvDHm+EoiEM+Wgiu9JdWd4+cCobPV7SqX7p6MzjGLAeh9/Uk6IMfwvum/OceORC/TqhnbO0VWttp3e/BnV9jPlbN8VjIWOKliRVkWwUGVs+UvY31p2iseIfjK0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714157437; c=relaxed/simple; bh=qzSv2gnEZ82yuyykHlGJGrukq6yL7NdagG67pBjWhfw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=t13AGvJ4NDcOkpRRGg+BPPdRzgj54Qrw9nvJ0D6l69oKjrkI9PypOA00d9LaLBo8mONsb0YWz+QnJ469B7z9i8H6SKzVYuk+uEnL/1hemkZevc4WjvHzXf+oow3AnHRrs675ZsBCkTibjC7W1OUKvhyxQaDGQD6B4M/DL9jvXys= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MJg/iu+I; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19893C113CD; Fri, 26 Apr 2024 18:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714157437; bh=qzSv2gnEZ82yuyykHlGJGrukq6yL7NdagG67pBjWhfw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MJg/iu+I4/bxeBy74ivwxjpibDvi17+LcvTxexZ733qg7mWsQP/TJR4hKVFLvYJGV nNQ5r0UMnswsV8YccCUbyXAInJmZICJGYI5xbZk0RGClIypeXKJAM+IdtmCAxuH7QU 0n0+7lFLssjIzQYU6rhHTGirgxd3BlpcsYG1QNdYaQYP+jcCVKDGl9x+45jlK4Qfpv 4PTzjVysJABGLG2mjl0Jb0tx74YMFI6RGvm/5cgcQkai0fGR5EfLmI5+6oudIp0t7Y D6A3w6VsJmjI3y6DUg0T/EcnQBedEgtsyc+lC8SIBwQHefuoaJKDYIxEIij+CkoPND ck4iV3+++E/iA== Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-516d68d7a8bso2313815e87.1; Fri, 26 Apr 2024 11:50:37 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCULS9SEt8RG5APHpkY2OvLyl3tkfKhy/LGGFV485RDAq73WobqMIAhUrpc29wmK12sGYK7iANW4HF6k1ioetiTf+FL4cHfaAEW/6pL7uU0z11UbacnjJC8LHBDY3j49WgwZKhPmQjbehG4RMVUoex3yGaicCwua7bDnCKsAklpj6F0YF1CS2Rtg5167b1B5pBoHZuEkiGbyK5TfJzGXvskeYP8ITbk6y3A61MXwx9dYW/Nj4vxKh6HaujJgT43aC2IPXDouAqLrdThpfK4jwjz6q+ixKMiyvFlAnDvzeGo0SHAWfxNc9n/syvrDhRt7zV/ZF/UO3P9EFsUKRrwmRA4heXGeo0Oolg5EaxQPIZRMYGJNAnPIbclMNECqNdpysxKx2lTyhtQBcbit4w0= X-Gm-Message-State: AOJu0YwqfRoA/JO5x/obZyQJiKaIp+P7ENGXo5QMMbEXVN/7X1P+7qCY whf2DyZg2ynSQoX+r058cSc78debKkPmE8z5c0ZbyJo53qNZvuqp+tLe2mTcRYFEvuQglEygeFV Zp+cYxv4hQCM7hSMgsHlYTa5kDj8= X-Received: by 2002:a05:6512:3116:b0:516:ce34:e4fc with SMTP id n22-20020a056512311600b00516ce34e4fcmr167995lfb.31.1714157435505; Fri, 26 Apr 2024 11:50:35 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240426082854.7355-1-rppt@kernel.org> <20240426082854.7355-7-rppt@kernel.org> In-Reply-To: <20240426082854.7355-7-rppt@kernel.org> From: Song Liu Date: Fri, 26 Apr 2024 11:50:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 06/16] mm: introduce execmem_alloc() and execmem_free() To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, 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 , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , Rick Edgecombe , Russell King , Sam Ravnborg , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 26, 2024 at 1:30=E2=80=AFAM Mike Rapoport wro= te: > > 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 an= d > 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 b= y > different subsystems that allocate executable memory, execmem_alloc() tak= es > a type argument, that will be used to identify the calling subsystem and = to > allow architectures define parameters for ranges suitable for that > subsystem. > > No functional changes. > > Signed-off-by: Mike Rapoport (IBM) > Acked-by: Masami Hiramatsu (Google) Acked-by: Song Liu