From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65831606A31C for ; Thu, 26 Nov 2026 18:11:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=HObDIiKl; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eTrh4ivt 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:In-Reply-To:MIME-Version:References: 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-Unsubscribe-Post:List-Owner; bh=bgx0vORNqTSIIlqWb7C7pnKCok41KkPc+fvGOm72Wek=; b=HObDIiKlTMgWOVqXsh1enJoLAT XC/kpkVgaaaIuOdnnYVaSLovslYZz/UKH/tiTrUiQIrQvtBAVDzVwR2y8Una550R1lzRDDLo04aMk QZRKTp8JqKbIUAliFHTdQhciaIKv62tOKWuaR0kKOUo9YnAYVuklM4NjqgMVi6k+XaeC/cyvt/GuT MQxov0QXpqU3rjCRZkCZoNsf5NBZjuFxu4y7RdVPPkfcPhOPF82mVWJ6EyvRdXcnEHZECIHrB2RVa c6YUp5pQtd2l2LDvn9WkSq5N6Lx8bAwII5nY+yH4xMZuq0ZZCWktINenEwkruVQcrwdhR26Qm4d/x WvooMYGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWdw3-0000000E8iA-1X87; Thu, 26 Nov 2026 18:11:07 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWdvz-0000000E8h5-4AYz; Thu, 26 Nov 2026 18:11:04 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 3DC174482C; Thu, 26 Nov 2026 18:11:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E52761F00AD3; Thu, 26 Nov 2026 18:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795716662; bh=u9v575CLn7pmoDOzWOn9peb7SoijlK+LbrKGpES9aRg=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=eTrh4ivtfPOlk36i/Syox5jVW6dXJmhOgZwioO+nYxMKjGShC7TMyjjJl/zzRZ/W3 SkP6MLdWC5iwrRV6uvUn6/rKonHWO56PFB3c75THzdQTim1Mri+dYH52nOteGfRTCj M+BZepOCmKNRYHvlRa117MS6yceBdzXjdmtuENyHhISgbQTyWosUB771P8KFuwQKC8 pVw08LjMZlVYdDIpRqOeWvsFhzaGdSX4qDT0MagmIoJIq2tNOTskLwvuvj9X76KZmW omTnmVri/xaVPYJp7AvvaZYW/JxAmTrlzAhShiP47YqYQ+fQwkXl5svB+CMxRIbwv0 XMDyeevoEqAuQ== Date: Thu, 26 Nov 2026 20:10:43 +0200 From: Mike Rapoport To: Yeoreum Yun Cc: "David Hildenbrand (Arm)" , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , Michal Hocko , Lorenzo Stoakes , Tianrui Zhao , Bibo Mao , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Liam R. Howlett" , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Jonas Bonn , Stefan Kristiansson , Stafford Horne , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-openrisc@vger.kernel.org Subject: Re: [PATCH RESEND v2 12/21] mm/pgtable: redefine PGTABLE_LEVEL enum with ascend order from PGD Message-ID: References: <20261102-dummy_ptxp3-v2-0-78840b2ec73c@arm.com> <20261102-dummy_ptxp3-v2-12-78840b2ec73c@arm.com> <682c765f-332f-4ac2-b448-4201c8fae6fc@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu, Nov 26, 2026 at 02:30:54PM +0000, Yeoreum Yun wrote: > On Thu, Nov 26, 2026 at 03:19:13PM +0100, David Hildenbrand (Arm) wrote: > > On 11/24/26 19:52, Yeoreum Yun wrote: > > > On Tue, Nov 24, 2026 at 07:05:38PM +0200, Mike Rapoport wrote: > > >> On Mon, Nov 02, 2026 at 11:21:25AM +0000, Yeoreum Yun wrote: > > >>> The PGTABLE_LEVEL enum values appear to be ordered in the opposite direction > > >>> from their intended usage. > > >>> > > >>> Intuitively, higher page table levels should have smaller enum values, > > >>> but PTE is currently assigned 0. > > >> > > >> That's not what x86 thinks :) > > >> They even expose it in /proc/vmstat with smaller numbers meaning lower levels > > >> > > >> $ grep direct_map /proc/vmstat > > >> direct_map_level2_splits 152 > > >> direct_map_level3_splits 4 > > >> direct_map_level2_collapses 0 > > >> direct_map_level3_collapses 0 > > >> > > >> Just an observation, I don't mind either order. > > > > > > Right. I made this change because a depth-based scheme seems more intuitive. > > > > > > As you pointed out, though, the x86 specification uses smaller > > > numbers (0) for lower levels (pte), so I think we can leave the > > > x86-specific direct_map_* entries as they are. > > > > patch #14 depends on this, no? > > Interestingly, x86 documentation numbers the PGD level as 4 or 5, > whereas helpers such as effective_prot_pgd() use 0 for PGD. > > Anyway, this follows the usage and semantics of effective_prot_pXd(), > rather than architecture-specific level numbering, which varies across > architectures. I asked an LLM and here's what it told me: x86, s390, riscv, LoongArch and powerpc count from the leaf. arm64 and ARM count from the root, and so does the generic page walk and ptdump. My guess that the only reason that generic ptdump counts from the root is because it came from @arm.com :) > And yes, patch #14 depends on this, although changing the condition to > level != PGD_LEVEL would remove that dependency. I think the only real hard dependency on levels numbering is x86's KVM code that manages secondary page tables, but it anyway does not use enum pgtable_level but rather x86's own enum pg_level. > -- > Sincerely, > Yeoreum Yun -- Sincerely yours, Mike. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv