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 68C9AEB64D8 for ; Wed, 14 Jun 2023 15:19:35 +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: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-Owner; bh=VhGeOpHlGc0QjoQ0q+lhtVmckAVmuHHx4zj7LIdQoh4=; b=vcPz9rNtU1v1hz nndsaZugPplo/lmaJmpT8/JV0mjvv7k+EDjsOQRA7MrpLM00z96rpUZBWIhxYya9uTtOAGvZUo6pd mO73982ara4J9Rhp6UCSXwGJGDOS7oBUJJF17bZ2ZANhqKsF+rYlje5tUPYRf8Mmg6A3mnUnIwv2/ UMpwJYALimTx/xn/OeXGEnJBRyAQhIKHjLYkoOAu3m2o2gPQozMt4rezadV2ACxG2AIMYyoTtrj+o 179SLR9b6/GPvteJq1yDwJizF+fNy9Z0rkaLeQsGF88ATajsQbcup7TgVQtc9TtDPx7uKL/Z/Gvzz +/asBIhebWbdGczOx6Zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9SHS-00C2w2-32; Wed, 14 Jun 2023 15:19:30 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9SHP-00C2us-2T; Wed, 14 Jun 2023 15:19:29 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1176663EB4; Wed, 14 Jun 2023 15:19:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5818AC433C8; Wed, 14 Jun 2023 15:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686755966; bh=c6X3BgGu/EnO13cv7axj+v9K19tCICftWYw//M95Fnc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mukQSaSzdQR3OwjUS8vlwj1DHxIFmnMmoNoVkKPQxFhB5yNNsmSGfOiEGD8e6JtXN VZrzNf4q5GRrRBOrFQak3/eBTJY3kdciGuz9dfIz0ogQBeAxF+PTcvQ/gdSnr6B6Ya C9HPAVz2+QHGDvMOZCaBKr/tY2qJeGKCeVCDx4TNXrt2yXr+HZedFR/l+9aCOtZIfW p20G2U+/kfUbEadTA1MzcZsMIBLzRi+uWub7RgdqmiPZpQJB5MtxjDgSgPYQUK2ycp Y3HwjPWpr3Oy82TQpASrv+jsR0EnwOAILsyUfuVeolmVBSHpN9tcvEMjDpzLifkGiY BbULUmkygaTkA== Date: Wed, 14 Jun 2023 18:18:48 +0300 From: Mike Rapoport To: "Vishal Moola (Oracle)" Cc: Andrew Morton , Matthew Wilcox , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, Hugh Dickins , Palmer Dabbelt Subject: Re: [PATCH v4 29/34] riscv: Convert alloc_{pmd, pte}_late() to use ptdescs Message-ID: <20230614151848.GB52412@kernel.org> References: <20230612210423.18611-1-vishal.moola@gmail.com> <20230612210423.18611-30-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230612210423.18611-30-vishal.moola@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230614_081927_896289_EC0FAB33 X-CRM114-Status: GOOD ( 17.34 ) 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 Mon, Jun 12, 2023 at 02:04:18PM -0700, Vishal Moola (Oracle) wrote: > As part of the conversions to replace pgtable constructor/destructors with > ptdesc equivalents, convert various page table functions to use ptdescs. > > Some of the functions use the *get*page*() helper functions. Convert > these to use pagetable_alloc() and ptdesc_address() instead to help > standardize page tables further. > > Signed-off-by: Vishal Moola (Oracle) > Acked-by: Palmer Dabbelt Acked-by: Mike Rapoport (IBM) > --- > arch/riscv/include/asm/pgalloc.h | 8 ++++---- > arch/riscv/mm/init.c | 16 ++++++---------- > 2 files changed, 10 insertions(+), 14 deletions(-) > > diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h > index 59dc12b5b7e8..d169a4f41a2e 100644 > --- a/arch/riscv/include/asm/pgalloc.h > +++ b/arch/riscv/include/asm/pgalloc.h > @@ -153,10 +153,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) > > #endif /* __PAGETABLE_PMD_FOLDED */ > > -#define __pte_free_tlb(tlb, pte, buf) \ > -do { \ > - pgtable_pte_page_dtor(pte); \ > - tlb_remove_page((tlb), pte); \ > +#define __pte_free_tlb(tlb, pte, buf) \ > +do { \ > + pagetable_pte_dtor(page_ptdesc(pte)); \ > + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte));\ > } while (0) > #endif /* CONFIG_MMU */ > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 3d689ffb2072..6bfeec80bf4e 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -354,12 +354,10 @@ static inline phys_addr_t __init alloc_pte_fixmap(uintptr_t va) > > static phys_addr_t __init alloc_pte_late(uintptr_t va) > { > - unsigned long vaddr; > - > - vaddr = __get_free_page(GFP_KERNEL); > - BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page((void *)vaddr))); > + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, 0); > > - return __pa(vaddr); > + BUG_ON(!ptdesc || !pagetable_pte_ctor(ptdesc)); > + return __pa((pte_t *)ptdesc_address(ptdesc)); > } > > static void __init create_pte_mapping(pte_t *ptep, > @@ -437,12 +435,10 @@ static phys_addr_t __init alloc_pmd_fixmap(uintptr_t va) > > static phys_addr_t __init alloc_pmd_late(uintptr_t va) > { > - unsigned long vaddr; > - > - vaddr = __get_free_page(GFP_KERNEL); > - BUG_ON(!vaddr || !pgtable_pmd_page_ctor(virt_to_page((void *)vaddr))); > + struct ptdesc *ptdesc = pagetable_alloc(GFP_KERNEL, 0); > > - return __pa(vaddr); > + BUG_ON(!ptdesc || !pagetable_pmd_ctor(ptdesc)); > + return __pa((pmd_t *)ptdesc_address(ptdesc)); > } > > static void __init create_pmd_mapping(pmd_t *pmdp, > -- > 2.40.1 > > -- Sincerely yours, Mike. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv