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 AAA14C79FAD for ; Tue, 8 Sep 2026 11:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type: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-Owner; bh=wrZchMHbuIO6XXck0lzWb4MFVBIJqfPNOjZp2CkiLAo=; b=ZnBVHmoH75Ye5J8P99F/x5nsmg q4Rvbg5xstJuQIZxBLf7xzoq1H2I4n0JJSd2rMVgJLZoMWB+2H4RpoJGgNXVXVVf2/iJs9kDMd4Bi 4v2TXiBhIVd0v/QasI5fDMZrDZntKyMq16iDTgbwKkI5u4xxv2JBOk2msPBLI3Dy5y2S/DX/px8mu lqpryyasFVNBaDW3wpx1NvmaK2wJuBdUPwObxLvOK0rVrBaXa1ok5KNjIAcG+GVP63waF8ySMe0k0 pQ5muQhbNvpnZ5dDYU61RIj4pqfgpZmIVfjKMOQovH3oMXxZTdYjpv/TFL4tM1tqxf7P3FJdK9ZZf 55im/w+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x3u0r-00000008sxX-0LrO; Tue, 08 Sep 2026 11:29:17 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x3u0o-00000008swy-2XDR; Tue, 08 Sep 2026 11:29:14 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 0DDBA41328; Tue, 8 Sep 2026 11:29:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD8561F00A3A; Tue, 8 Sep 2026 11:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788866953; bh=wrZchMHbuIO6XXck0lzWb4MFVBIJqfPNOjZp2CkiLAo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=UaGEuylvnKTadsfjaS7bvwU33xN2v3VvG9wjjwlcHZzqg4jRyqMpEEdO03+MvqeIM 0cduj0er10VqGiGsJx7yjqifKpSllSZ3vK2y8omgzwmD0GHCZufWGZlTXVUWUiJ1V9 ryqufjLkVU0NIOGHntM/W5uaFdDur34HOl0mDF/iX8gW88SDJFV9ZGxssqTmrANwpQ ynMdPQCgyGQbU6JnCqU5u6mlf0Svv7YVwvZzUogSUfvbxLoYO7+FDhTi6mBmpO9DWp jokGL7RYOK/KgBIS1bsW+dwWJav2y/DtDFT7YQL4WN6vyefxcqOuYZ/U9v7ZU8r1QK 2OBX8O/r781rA== Date: Tue, 8 Sep 2026 12:28:51 +0100 From: "Lorenzo Stoakes (ARM)" To: Suren Baghdasaryan Cc: Andrew Morton , David Hildenbrand , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Kiryl Shutsemau , Guo Ren , Brian Cain , Geert Uytterhoeven , Dinh Nguyen , Simon Schuster , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Russell King , Vineet Gupta , Michal Simek , Chris Zankel , Max Filippov , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , "David S. Miller" , Andreas Larsson , Richard Henderson , Matt Turner , Magnus Lindholm , Catalin Marinas , Mark Rutland , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Madhavan Srinivasan , Michael Ellerman , "Christophe Leroy (CS GROUP)" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Arnd Bergmann , Vlastimil Babka , Mike Rapoport , Michal Hocko , Jason Gunthorpe , John Hubbard , Peter Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-openrisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-snps-arc@lists.infradead.org, linux-arch@vger.kernel.org, sparclinux@vger.kernel.org, linux-alpha@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, Hugh Dickins , Qi Zheng Subject: Re: [PATCH 05/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for arc, microblaze, xtensa Message-ID: References: <20260901-rcu-pagetable-freeing-v1-0-5456a81c8212@kernel.org> <20260901-rcu-pagetable-freeing-v1-5-5456a81c8212@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org On Mon, Sep 07, 2026 at 02:07:37PM -0700, Suren Baghdasaryan wrote: > On Tue, Sep 1, 2026 at 4:06 AM Lorenzo Stoakes (ARM) wrote: > > > > Each of these architectures directly free page tables without routing these > > changes through tlb_remove_ptdesc(). > > > > The use of tlb_remove_ptdesc() is required for > > CONFIG_MMU_GATHER_RCU_TABLE_FREE to correctly free page tables under RCU, > > so simply update these architectures to use these functions. > > > > Since none of the architectures share page tables or do anything unusual, > > nothing complicated is required here. > > > > Therefore this is simply a mechanical change - convert __pud_free_tlb(), > > __pmd_free_tlb() and __pte_free_tlb() to use tlb_remove_ptdesc() as > > required. > > > > At the point this is in place, all mmu_gather page table freeing is > > performed under RCU, and thus MMU_GATHER_RCU_TABLE_FREE is selected for > > each architecture. > > > > This forms part of an overall effort to switch every architecture to this > > mode. > > > > Signed-off-by: Lorenzo Stoakes (ARM) > > --- > > arch/arc/Kconfig | 1 + > > arch/arc/include/asm/pgalloc.h | 6 +++--- > > arch/microblaze/Kconfig | 1 + > > arch/microblaze/include/asm/pgalloc.h | 2 +- > > arch/xtensa/Kconfig | 1 + > > arch/xtensa/include/asm/tlb.h | 2 +- > > 6 files changed, 8 insertions(+), 5 deletions(-) > > > > diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig > > index 2ed7186c81c5..7a7542b61823 100644 > > --- a/arch/arc/Kconfig > > +++ b/arch/arc/Kconfig > > @@ -47,6 +47,7 @@ config ARC > > select HAVE_SYSCALL_TRACEPOINTS > > select IRQ_DOMAIN > > select LOCK_MM_AND_FIND_VMA > > + select MMU_GATHER_RCU_TABLE_FREE > > select MODULES_USE_ELF_RELA > > select OF > > select OF_EARLY_FLATTREE > > diff --git a/arch/arc/include/asm/pgalloc.h b/arch/arc/include/asm/pgalloc.h > > index dfae070fe8d5..9b6c37f92e97 100644 > > --- a/arch/arc/include/asm/pgalloc.h > > +++ b/arch/arc/include/asm/pgalloc.h > > @@ -72,7 +72,7 @@ static inline void p4d_populate(struct mm_struct *mm, p4d_t *p4dp, pud_t *pudp) > > set_p4d(p4dp, __p4d((unsigned long)pudp)); > > } > > > > -#define __pud_free_tlb(tlb, pmd, addr) pud_free((tlb)->mm, pmd) > > +#define __pud_free_tlb(tlb, pmd, addr) tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd)) > > > > #endif > > > > @@ -83,10 +83,10 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmdp) > > set_pud(pudp, __pud((unsigned long)pmdp)); > > } > > > > -#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd) > > +#define __pmd_free_tlb(tlb, pmd, addr) tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd)) > > > > #endif > > > > -#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte) > > +#define __pte_free_tlb(tlb, pte, addr) tlb_remove_ptdesc((tlb), page_ptdesc(pte)) > > > > #endif /* _ASM_ARC_PGALLOC_H */ > > diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig > > index 484ebb3baedf..af7e821e96c1 100644 > > --- a/arch/microblaze/Kconfig > > +++ b/arch/microblaze/Kconfig > > @@ -41,6 +41,7 @@ config MICROBLAZE > > select PCI_SYSCALL if PCI > > select CPU_NO_EFFICIENT_FFS > > select MMU_GATHER_NO_RANGE > > + select MMU_GATHER_RCU_TABLE_FREE > > select SPARSE_IRQ > > select ZONE_DMA > > select TRACE_IRQFLAGS_SUPPORT > > diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h > > index 084a8a0dc239..ffee6a009219 100644 > > --- a/arch/microblaze/include/asm/pgalloc.h > > +++ b/arch/microblaze/include/asm/pgalloc.h > > @@ -25,7 +25,7 @@ extern void __bad_pte(pmd_t *pmd); > > > > extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); > > > > -#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, (pte)) > > +#define __pte_free_tlb(tlb, pte, addr) tlb_remove_ptdesc((tlb), page_ptdesc(pte)) > > > > #define pmd_populate(mm, pmd, pte) \ > > (pmd_val(*(pmd)) = (unsigned long)page_address(pte)) > > diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig > > index f2f9cd9cde50..33c4caee30e2 100644 > > --- a/arch/xtensa/Kconfig > > +++ b/arch/xtensa/Kconfig > > @@ -55,6 +55,7 @@ config XTENSA > > select HAVE_VIRT_CPU_ACCOUNTING_GEN > > select IRQ_DOMAIN > > select LOCK_MM_AND_FIND_VMA > > + select MMU_GATHER_RCU_TABLE_FREE if MMU > > And MMU is required because NOMMU does not perform mmu_gather > operations, same as in the previous patch? If so, maybe make a note of > it in the changelog? Right yup. Will update! > > > select MODULES_USE_ELF_RELA > > select PERF_USE_VMALLOC > > select TRACE_IRQFLAGS_SUPPORT > > diff --git a/arch/xtensa/include/asm/tlb.h b/arch/xtensa/include/asm/tlb.h > > index 8c3ceb427018..6fb7b78154f6 100644 > > --- a/arch/xtensa/include/asm/tlb.h > > +++ b/arch/xtensa/include/asm/tlb.h > > @@ -16,7 +16,7 @@ > > > > #include > > > > -#define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte) > > +#define __pte_free_tlb(tlb, pte, address) tlb_remove_ptdesc((tlb), page_ptdesc(pte)) > > > > void check_tlb_sanity(void); > > > > > > -- > > 2.55.0 > > -- Cheers, Lorenzo