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 49379D44D53 for ; Wed, 6 Nov 2024 11:38:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D66E46B008C; Wed, 6 Nov 2024 06:38:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D179E6B0092; Wed, 6 Nov 2024 06:38:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE0196B0096; Wed, 6 Nov 2024 06:38:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A1CB36B008C for ; Wed, 6 Nov 2024 06:38:25 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5889141AF2 for ; Wed, 6 Nov 2024 11:38:25 +0000 (UTC) X-FDA: 82755471834.14.DFADC4D Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 6FA7816002B for ; Wed, 6 Nov 2024 11:38:00 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730892980; a=rsa-sha256; cv=none; b=QaosEa+7oWDLpLQNIXrh0hC8tF9iHAHog2M7DKfxcpUfL+1JKjj4z7YulUAfE1HRugsWjc wqlQ+H91xUIvU8pfLHZCeMX710EWw/8Hj9FKYHeZgz9h+x5OckaxE/u5uKqPKDMp7cXFfH mzOPQY7M0EtF5aqTne/Q1+oiB7brMYk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730892980; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E+z6a7MMcQZtbFKBYAUv1zKEi9fXON3uYimVaAWMw+g=; b=ItmVEl6TcQWVmnWDldRM9JVs8Lz1ljSjPtr/vvM7sWcrmWHsqoskun5QHkzKTLQzjsSGSO QCbPgOBLhOJC+pxt3Sck1e5OdORM3gtkzOAFl3L3DyvH1Mv760P/O4Yc+9TmMolhvapihp Y6lCIIBjz6S6zSPzZvOoAolNShosGPE= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11BCD1063; Wed, 6 Nov 2024 03:38:52 -0800 (PST) Received: from [10.57.88.115] (unknown [10.57.88.115]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5B8423F6A8; Wed, 6 Nov 2024 03:38:19 -0800 (PST) Message-ID: <083d9e98-b6b8-4702-a700-24aea95cef9e@arm.com> Date: Wed, 6 Nov 2024 11:37:58 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1 00/57] Boot-time page size selection for arm64 To: Catalin Marinas Cc: Andrew Morton , Anshuman Khandual , Ard Biesheuvel , David Hildenbrand , Greg Marsden , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20241014105514.3206191-1-ryan.roberts@arm.com> Content-Language: en-GB From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 6FA7816002B X-Stat-Signature: 9rakhh44su1y7gzhbx6nshsewtp6q9ip X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1730893080-21127 X-HE-Meta: U2FsdGVkX1+vlv8u5TXrdtZqPwzAFPi6QOtAbhE9RjUTNdxmqCQ7DO++C3imuXci8lcURUTovw+jQCLzb5JTUDF402yTpg2b8xgNUQGFhGoCeV3NrRPeORF9Ohc32+L7RcsVPgAtTjoBJuUZDK3qjZJNsiwhdxpmKB3lv9qm21hoIDyeFyLeS7YutWZ9ZTXK4TPmBgUaY/ofLeal3+QjjTjaq47vV+LbThccIBSOnFMTVQl7zopTpRgceoEAIiVbdaTOPt6dISgm3XEe/jcffhUhW/m3ppMb1vnCOQ5bdqmnw+lO9Trt7iHh7ZbvtM6dTeUHoF39mHfCTUYkk/z3qhuk1AFdpS1tntuYMMfmwRFUqg/0rFuCDq4KSJR96gXnaa3wdKPM7v7nYA86z4jlgLijHn4Xg/rz5yaxVgY79mzWuexzktFxQqpiIdplgrikSoLRZ7dPpkEMV6HGNeeqHYuB2DwUihkVJkX5ftcIq1htEyPRsMnMY7CjbXlL03oeypDnmIl6Fqb1NmiCpduhyHdBNxggMVKKS7WRM90K8o5YZfv4d9GAyK/s0fN1lNzGPRiiD3oCBvBo4jSn2Jo48KzOPoHtIDlU0VE0M7fh+8Ig8CEgKX0Bj5RDopLc2cSLgQM7dUUhjwhGGPKexq1bv76XOdpj5ePO1r4Ac13WCPDKR5cAd5eKtCv2HVlyLPT3L1PqZ7mD08Oeh4f8oTs+i64GGNBIcyOyFs4M11q0xgIEMa7/piw9ZOEl7LSqc//kVjlmCUQcO7o3vKfC9ZmnwIYf1U9alfcLq63w9kle8ycQsdnYeFRO0P1yCUClSonl1E9usUMdpPnDmEqvrRTQ2qrWH/81ER/4pAJAI0JrB7m2tIHFODMBmZR9kjRUY8NbdiS6XJ2xTpMlYdXBgJESHiW2Zbj4Z7Gj/+euz5DTLnYFOW7hnPilt56o79Jlsm/F/zmPaQQogQMAXwejveK 5wxUD4o8 CrZ9r0pGPI/Ce5Uv+N921vINiX1MU40BDH45gC8NibrzW1ShfxbAq7BveCL0sCRv6KNqWalEL4y0E33ILyC0I7JzTJhGKAUxCKDuZd9//RUk39WfEX/KoZPc6r/DZCDqWJAAAAVgJNiPG18j9mbhBZtFdVQ== 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 31/10/2024 21:07, Catalin Marinas wrote: > Hi Ryan, > > On Mon, Oct 14, 2024 at 11:55:11AM +0100, Ryan Roberts wrote: >> This RFC series implements support for boot-time page size selection within the >> arm64 kernel. arm64 supports 3 base page sizes (4K, 16K, 64K), but to date, page >> size has been selected at compile-time, meaning the size is baked into a given >> kernel image. As use of larger-than-4K page sizes become more prevalent this >> starts to present a problem for distributions. Boot-time page size selection >> enables the creation of a single kernel image, which can be told which page size >> to use on the kernel command line. > > That's great work, something I wasn't expecting to even build, let alone > run ;). Cheers! > I only looked briefly through the patches, there's probably room > for optimisation of micro-benchmarks like fork(), maybe using something > like runtime constants. Yes I suspect there is room for some optimization. Although note I already tried using alternatives patching but for the fork() microbenchmark this performed worse than the approach I ended up taking of just loading a global variable. I think this was likely due to code layout changes due to all the extra branches/nops - fork has been very sensitive to code layout changes in the past. > The advantage for deployment and easy testing of > different configurations is pretty clear (distros mainly, not sure how > relevant it is for Android if apps can't move beyond 4K pages). > > However, as a maintainer, my main concern is having to chase build > failures in obscure drivers that have not been tested/developed on > arm64. If people primarily test on x86, they wouldn't notice that > PAGE_SIZE/PAGE_SHIFT are no longer constants. Not looking forward to > trying to sort out allmodconfig builds every kernel release, especially > if they turn up in subsystems I have no clue about (like most stuff > outside arch/arm64). Yes, I understand that concern. > > So, first of all, I'd like to understand the overall maintainability > impact better. I assume you tested mostly defconfig. If you run an > allmodconfig build with make -k, how many build failures do you get with > this patchset? Similarly for some distro configs. I've roughly done: make alldefconfig && ./scripts/config --enable CONFIG_ARM64_BOOT_TIME_PAGE_SIZE && make -s -j`nproc` -k &> allmodconfig.log Then parsed the log for issues. Unfortunately the errors are very chatty and it is difficult to perfectly extract stats. If I search for r'(\S+\.[ch]):.*error:', that is optimistic because PAGE_SIZE being non-const gets the ultimate blame for most things, but I'm interested in the call sites. Number of affected files using this approach: 111. If I just blindly search for all files, r'(\S+\.[ch]):', that is pessimistic because when the issue is in a header, the full include chain is spat out. Number of affected files using this approach: 1807. If I just search for C files, r'(\S+\.[c]):', (all issues in headers terminate in a C file) that is also pessimistic because the same single header issue is reported for every C file it is included in. Number of affected files using this approach: 1369. In the end, I decided to go for r'(\S+\.[ch]):.*(error|note):', which is any files described as having an error or being the callsite of the thing with the error. I think this is likely most accurate from eyeballing the log: | | C&H files | percentage of | | directory | w/ error | all C&H files | |------------|---------------|---------------| | arch/arm64 | 7 | 1.3% | | drivers | 127 | 0.4% | | fs | 25 | 1.1% | | include | 27 | 0.4% | | init | 1 | 8.3% | | kernel | 7 | 1.3% | | lib | 1 | 0.2% | | mm | 6 | 3.2% | | net | 7 | 0.4% | | security | 2 | 0.8% | | sound | 21 | 0.8% | |------------|---------------|---------------| | TOTAL | 231 | 0.4% | |------------|---------------|---------------| I'm not sure how best to evaluate if this is a large or small number though! For comparison, the RFC modified 172 files. > > Do we have any better way to detect this other than actual compilation > on arm64? Can we hack something around COMPILE_TEST like redefine > PAGE_SIZE (for modules only) to a variable so that we have a better > chance of detecting build failures when modules are only tested on other > architectures? I can certainly look into this. But if the concern is that drivers are not being compiled against arm64, what is the likelyhood of them being compiled against COMPILE_TEST? > > At the moment, I'm not entirely convinced of the benefits vs. long term > maintainability. Even if we don't end up merging the dynamic PAGE_SIZE > support, parts of this series are needed for supporting 128-bit ptes on > arm64, hopefully dynamically as well. Agreed. Thanks, Ryan > > Thanks. >