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 134EDC433EF for ; Wed, 2 Feb 2022 23:34:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DAD28D011C; Wed, 2 Feb 2022 18:34:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 289868D0119; Wed, 2 Feb 2022 18:34:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 151E58D011C; Wed, 2 Feb 2022 18:34:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 07BAD8D0119 for ; Wed, 2 Feb 2022 18:34:36 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B434399EAA for ; Wed, 2 Feb 2022 23:34:35 +0000 (UTC) X-FDA: 79099446510.24.B11E31F Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf02.hostedemail.com (Postfix) with ESMTP id E1F6A80003 for ; Wed, 2 Feb 2022 23:34:34 +0000 (UTC) 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-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=Jh/EL1diuD4J1JZYZhhqdPKhDKb1uRzo1pLWpqiNQQs=; b=bbPsm2Rw+E4ZQJ3Gw3fUrZTGnO k4tL7MeTqglU0jb/1hlbW+xa+BanJ470QCRr4yvg9ENXOU2gryoa8LYF82kJSVm7rsgG66ol4IQIB 4/NUNG9bTcqBoUNlRLR79ulXI5LQ8DO9tyJXr2y/Fv9KrPLoBlvZA1cDIJzUHMsFE1Fey8aLqAfOf VTd/zevfqWmzF29UOcxH+pTAcxesxVHVrFq84jSfiqdsVaDkC7y8br5ZVE6/lkN20W8qroOQ3Ky4N jJcXiP+owiRm5ttbkmMnRJD/ijuNsP/Yey+trKKLUNXCQgLLs692qSL3uR1aCH1A4SvHMLK+Dystg kSCXI3vw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFP8h-00H4m1-Uf; Wed, 02 Feb 2022 23:34:15 +0000 Date: Wed, 2 Feb 2022 15:34:15 -0800 From: Luis Chamberlain To: Christophe Leroy Cc: Jessica Yu , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "kgdb-bugreport@lists.sourceforge.net" , "linux-mm@kvack.org" , "linux-arch@vger.kernel.org" , Jason Wessel , Daniel Thompson , Douglas Anderson Subject: Re: [PATCH 6/7] modules: Add CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC Message-ID: References: <848d857871f457f4df37e80fad468d615b237c24.1643015752.git.christophe.leroy@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E1F6A80003 X-Stat-Signature: 8x4hopmi7wz3pt7cqtyp3k3fi5px9siw X-Rspam-User: nil Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=bbPsm2Rw; spf=none (imf02.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-HE-Tag: 1643844874-332677 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000076, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jan 26, 2022 at 06:38:30AM +0000, Christophe Leroy wrote: >=20 >=20 > Le 25/01/2022 =E0 22:10, Luis Chamberlain a =E9crit=A0: > > On Mon, Jan 24, 2022 at 09:22:34AM +0000, Christophe Leroy wrote: > >> This can also be useful on other powerpc/32 in order to maximize the > >> chance of code being close enough to kernel core to avoid branch > >> trampolines. > >=20 > > Curious about all this branch trampoline talk. Do you have data to sh= ow > > negative impact with things as-is? >=20 > See=20 > https://github.com/linuxppc/linux/commit/2ec13df167040cd153c25c4d96d0ff= c573ac4c40 >=20 > Or=20 > https://github.com/linuxppc/linux/commit/7d485f647c1f4a6976264c90447fb0= dbf07b111d This was useful and fun to read, thanks. > > Also, was powerpc/32 broken then without this? The commit log seems t= o > > suggest so, but I don't think that's the case. How was this issue not= iced? >=20 >=20 > Your question is related to the trampoline topic or the exec/noexec=20 > flagging ? >=20 > Regarding trampoline, everything is working OK. That's just cherry on=20 > the cake, when putting data away you can have more code closer to the=20 > kernel. But that would not have been a reason in itself for this series= . >=20 > Regarding the exec/noexec discussion, it's a real issue. powerpc/32=20 > doesn't honor page exec flag, so when you select STRICT_MODULES_RWX and= =20 > flag module data as no-exec, it remains executable. That's because=20 > powerpc/32 MMU doesn't have a per page exec flag but only a per=20 > 256Mbytes segment exec flag. >=20 > Typical PPC32 layount: > 0xf0000000-0xffffffff : VMALLOC AREA =3D=3D> NO EXEC > 0xc0000000-0xefffffff : Linear kernel memory mapping > 0xb0000000-0xbfffffff : MODULES AREA =3D=3D> EXEC > 0x00000000-0xafffffff : User space =3D=3D> EXEC >=20 > So STRICT_MODULES_RWX is broken on some powerpc/32 You know, this is the sort of information that I think would be very useful for the commit log. Can you ammend? > >=20 > > Are there other future CPU families being planned where this is all t= rue for > > as well? Are they goin to be 32-bit as well? >=20 > Future I don't know. >=20 > Regarding the trampoline stuff, I see at least the following existing=20 > architectures with a similar constraint: >=20 > ARM: >=20 > https://elixir.bootlin.com/linux/v5.16/source/arch/arm/include/asm/memo= ry.h#L55 >=20 > ARM even has a config item to allow trampolines or not. I might add the= =20 > same to powerpc to reduce number of pages used by modules. >=20 > https://elixir.bootlin.com/linux/v5.16/source/arch/arm/Kconfig#L1514 >=20 > NDS32 has the constraint >=20 > https://elixir.bootlin.com/linux/v5.16/source/arch/nds32/include/asm/me= mory.h#L41 >=20 > NIOS2 has the constraint, allthough they handled it in a different way: >=20 > https://elixir.bootlin.com/linux/v5.16/source/arch/nios2/kernel/module.= c#L30 >=20 >=20 >=20 > Even ARM64 benefits from modules closer to kernel: >=20 > https://elixir.bootlin.com/linux/v5.16/source/arch/arm64/Kconfig#L1848 >=20 >=20 > Another future opportunity with the ability to allocate module parts=20 > separately is the possibility to then use huge vmalloc mappings. >=20 > Today huge vmalloc mappings cannot be used for modules, see recent=20 > discussion at=20 > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20211227145903.= 187152-4-wangkefeng.wang@huawei.com/ Alrighty, this is sufficient information, thanks! Luis