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 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.lore.kernel.org (Postfix) with ESMTPS id 1618DC43458 for ; Tue, 14 Jul 2026 21:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+yFzLx2TyMqeYxuyCioQ0WDdf71KPEbFF6L0sRqiyjQ=; b=E6+uVEjW5dGKRh zCQpjJfKlY5ykcKJbULD37taYlKwCpqlQtfOP5M2LSMWwBHfZHvbOUKlpPWuVhk9j8F+Ldmlg+LuE m60wkxyrpH1AqAB2BFVkhouXlyPLGm/eBd65YhYXupk7bfQCy1N4R8eqb4VZ10hi8nMismJqpQp5R Q8SN0I1SUtyheqUdwy5/FI63SopcPwAeEf6KO98iK5PWs5Ze+aqVuPcYpeLUemSaXl29LDfvkf8lz MNI7XW5uIIXLfp40snkqVcVvV9LL8P4oFvgtupsXg2trMIRIZoii6OUnXy4fm5Ec3AHatuN/ljSoF Obe676MMmRlm+Ov9CSWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjkx0-0000000DMxz-2shW; Tue, 14 Jul 2026 21:46:03 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wjkwx-0000000DMwl-01N0 for linux-riscv@lists.infradead.org; Tue, 14 Jul 2026 21:46:00 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-493f2e39e81so19477035e9.2 for ; Tue, 14 Jul 2026 14:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784065556; x=1784670356; darn=lists.infradead.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=lsgDUhCPZi1cUpPkNQ/I7/JmqQLLDAJpIhlyKeHE0tE=; b=jtV2R1AacnsHVbnVhm93NemXFlZ9HFpZLME3M9D+I31h6Fux+613Z9YhvfCxLNhd/K 9G4qE2WcoQr0a+rgwn2zvZZgYwS5hYsxKvzKTeWQ9dINzDsU6GiP1pmX1xbRmPOPThbc 78TB9eXQs1d0ShHwPHiNM/mG5AGPcWYYbZQyzfRXEq/eWZk8hrcP2/YRWbjg8bSg/Roo BZk5NA7yobwRNmBCp5vRcsEEBRjxGZqAWm6YCwjCwJwl49zpA8/jPxsVNvBhVkAgWGeW PI5woReZbB7vRffz8pmLdWEVmRmQ1QN8QerWjRRYVrkphgmAunZ8dCz8kio22EMIlmG4 HHAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784065556; x=1784670356; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=lsgDUhCPZi1cUpPkNQ/I7/JmqQLLDAJpIhlyKeHE0tE=; b=UaepjeRIS2Ub4s3NWGz4aO4hzqnRMYqVW57VTu4g2jLjJPuwyHh1JsFJY209wZviYu u+f4CoRmBdiZDVVFvg28fU5At87XaTtUx/uiuRIDURtKTGRiyVE3+ob4EVHJWdspxtjk eEOKDIEGaHRKC7qIoNfbmqNzB+zZ/kBf/wCjxV4klo71lF1HZIrxrREPDW2YXCDciMiM 6kCs8XzMM4A5+PCoaHJkk/DDB9vyvJ2ICA+tUcdSBokmRPBqdBIhbfm/lSK+nzW6p7QU wmepB5kpUU8tjp9T38Qk+Gjcf+ytOPACFCRxNj1YK8e1VRSm1t3nhh1KGtRq6DfIBryL TVNA== X-Forwarded-Encrypted: i=1; AHgh+RppbGQ0+c8nn8WTangndfQTtQFr96sN2P4CKEwNLO64og/+vEgGGpM2bfI3Cuoj1Mkw5UnHFSe9kQlk8A==@lists.infradead.org X-Gm-Message-State: AOJu0YxVv71CP8rsirDkBaEa1xVRkfy3b1wLmgoiV5O8iDltf1qogf1Q oq2OjeA9lW2KAvUREL4I89xpcmEPGvp65MWgBJhKlAIuMBdcnG/Ak7nk X-Gm-Gg: AfdE7cmhUjOfNVBPk4rlb5MTcEuMZvYq1fvndzy+H7JS2hMzCE88Bwo8h8DqSAM5blg Y5IUlWxX6vyVmxV3hRRcqa0aEv/aUY9uOImJfbUJF3efxCwhs1WK6w3JCbeMibT977G/fhu/4Xz 7NrNM8+yXp5u6drH9Wi6heS4/fPpwz1F1ZCYKLNN/x/H0EPTXgUzG1R71c8QvJCOTp2SISjIuVf zdrW6Pv2hS8JpMS/K4qxNsHg8F9vwX9Z5Q2++dp5yRbP7xKuEdDBurwCijxOR2+lYKywTuLFDEi /hc0u1ubu1S9HR0k2nok2Z0xIjCVtnCuqqG9vO6ktiNwsMVwpBdGj0s+NWajSL0eWDLIj2avE2a zxl5UJwOWql1/9PCXTE9OfTgpxqfRF66gio75iZio/9hEoyBLCf5ZqA84+O13VBlrPtyOjTZYjU nwZuE3yh++pjVHx5vngN00KLKNQkuIiZ6vFPqDqxvqS8GQJBR+NQ== X-Received: by 2002:a05:600c:4e8f:b0:493:b307:6777 with SMTP id 5b1f17b1804b1-4953c273de7mr4061435e9.22.1784065556082; Tue, 14 Jul 2026 14:45:56 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4950a32b9f3sm118533945e9.13.2026.07.14.14.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 14:45:55 -0700 (PDT) Date: Tue, 14 Jul 2026 22:45:53 +0100 From: David Laight To: "Arnd Bergmann" Cc: "Pedro Falcato" , "Yeoreum Yun" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Linux-Arch , kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, "linux-csky@vger.kernel.org" , linux-m68k@lists.linux-m68k.org, "linux-openrisc@vger.kernel.org" , "David Hildenbrand (Red Hat)" , "Russell King" , "Andrew Morton" , "Ankur Arora" , "Mike Rapoport" , "Magnus Lindholm" , "Christophe Leroy" , "Klara Modin" , "Huacai Chen" , "WANG Xuerui" , "Kirill A. Shutemov" , zhangtianyang@loongson.cn, wangyuli@aosc.io, "Thomas Bogendoerfer" , "Lorenzo Stoakes" , "Jason Gunthorpe" , "Catalin Marinas" , "Will Deacon" , "Ryan Roberts" , "Pasha Tatashin" , "Rohan McLure" , "Baolin Wang" , "Tejun Heo" , "Kevin Brodsky" , "Anup Patel" , atish.patra@linux.dev, "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , "Alexandre Ghiti" , "Dave Hansen" , "Andy Lutomirski" , "Peter Zijlstra" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H. Peter Anvin" , "Johannes Weiner" , "Michal Hocko" , qi.zheng@linux.dev, "Shakeel Butt" , "Kairui Song" , "Barry Song" , "Axel Rasmussen" , "Yuanchu Xie" , "Wei Xu" , "Andrey Ryabinin" , "Alexander Potapenko" , "Andrey Konovalov" , "Dmitry Vyukov" , "Vincenzo Frascino" , "Anshuman Khandual" , "Yang Shi" , chaitanyas.prakash@arm.com, "Ard Biesheuvel" , guoren , yang.li85200@gmail.com, "Alexander Viro" , "Dinh Nguyen" , "schuster.simon@siemens-energy.com" , "Vivian Wang" , junhui.liu@pigmoral.tech, "Muchun Song" , "Vishal Moola (Oracle)" , "Nam Cao" , "Pavel Machek" , djbw@kernel.org, yu-cheng.yu@intel.com, "Baolu Lu" , "Jonathan Cameron" , "Coiby Xu" , "Andreas Larsson" , "Liam R. Howlett" , "Vlastimil Babka (SUSE)" , "Suren Baghdasaryan" , "Michal Hocko" , "Geert Uytterhoeven" , "Stafford Horne" , "Jonas Bonn" , "Stefan Kristiansson" Subject: Re: [RFC PATCH 02/34] ARM: mm: make 2-level pgd_t a scalar Message-ID: <20260714224553.583c8445@pumpkin> In-Reply-To: References: <20260713135614.1618183-1-yeoreum.yun@arm.com> <20260713135614.1618183-3-yeoreum.yun@arm.com> <20260714143450.61a94085@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260714_144559_167188_6AE3736B X-CRM114-Status: GOOD ( 34.08 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Tue, 14 Jul 2026 17:06:00 +0200 "Arnd Bergmann" wrote: > On Tue, Jul 14, 2026, at 15:34, David Laight wrote: > > On Tue, 14 Jul 2026 13:55:18 +0200 > > "Arnd Bergmann" wrote: > >> > I see the compiler has an awkward time returning a u64 struct (see > >> > https://godbolt.org/z/qejbv6j9a), but if this doesn't work maybe we should > >> > get rid of the STRICT_MM_TYPECHECKS stuff? I seriously doubt anyone is > >> > purposefully toggling it on for testing from time to time. > >> > >> As far as I can tell, the #ifdef was originally in i386 and > >> got copied to all other architectures at the time, but was > >> removed in linux-2.3.23 from the original copy when CONFIG_X86_PAE > >> was introduced. > > > > For x86-32 the makefiles request 64bit structures be returned in registers > > (at the same place regparm=3 is set - probably added at the same time > > between 2.4 and 2.6). > > > > Note that arm32 can will return a 32bit struct in a register and > > arm64 will return a 128bit struct in two registers. > > > > The only problem is returning a 64bit struct in 32bit mode. > > > > I'm sure this code is arm64 only. > > The file we are talking about is arch/arm/include/asm/pgtable-2level-types.h, > which is definitely 32-bit only and force a 64-bit struct return > on the stack. I've clearly failed to detect the environment :-( The 'struct return by reference' is part of the ABI. > I checked some trivial tests that show that arm-linux-gnueabihf-gcc-16 > also still produces badly optimized object code with structures > passed by value, and will spill those to the stack for no apparent > reason. clang handles those just fine as a pair of registers. I'd have thought it would be ok if the structure had two 32bit values and they were directly accessed. The silly test I did earlier didn't spill. Taking the address could easily force a spill in the function itself. So that ((int (*)[2])&var)[0] (which is just ((int *)&var)[0]) is likely to be problematic - or certainly heading in that direction. > For the 2-level page table, this only concerns pgd_t, which is > rarely passed around or returned by value. The 3-level page > table has a 64-bit pte_t, which means we probably won't > want STRICT_MM_TYPECHECKS there. I did do some mmu setup for a strongarm a long time ago. I do remember in being odd. But I was only moving the software frame buffer away from the physical frame buffer to steal a load of screen rows for a keyboard. Is the 64bit pte_t needed to get the extra modified and accessed flags there aren't free bits for in the hardware pte? Would it have been possible to use bits that are fixed in the hardware pte for the extra bits and write the value to pte[0] and pte[256] fixing up the value written to pte[0] (that the hardware reads). The arm docs seem hard to read... (the left-right scroll doesn't help!) David > > Arnd _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv