From patchwork Thu Jun 22 20:57:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13289617 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 D18F0EB64DA for ; Thu, 22 Jun 2023 20:58:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FA978D0016; Thu, 22 Jun 2023 16:58:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AB198D0001; Thu, 22 Jun 2023 16:58:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54C828D0016; Thu, 22 Jun 2023 16:58:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 440828D0001 for ; Thu, 22 Jun 2023 16:58:41 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1CC17801F3 for ; Thu, 22 Jun 2023 20:58:40 +0000 (UTC) X-FDA: 80931597600.23.0AF72E4 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf20.hostedemail.com (Postfix) with ESMTP id 31B691C001C for ; Thu, 22 Jun 2023 20:58:37 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WzrZfg7I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687467518; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=ttWJe8mD+tDLtiF2/clFQ8cBY5yriV9HQznRsBtYNEl4cEu5XIj8kwno2AaU9H1UIQl2q/ +V5jvE93KoP3Yg1wiOw4vlx0ezBrhVJsGPlH/icZ4IvVm00kSovhVMn5fFKjfDCFmNbSol d8wbgTbjolaFcBK/+RHIu4JS0qAUOFU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WzrZfg7I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687467518; a=rsa-sha256; cv=none; b=4rxOm3CJJ9LF8lCZv71dLJMCyoRn0Rz2w260qWpZXjJdZqyFS6FsbdboO6rt0PDRjmHoy7 HPOLbnbUEeaQRtvH5vbwI9cLvtkSix15XnFx6ZDkyIp/gpl1zACVfQMLDI43I6l6+lchH5 BQZqbu1YCNjqQrltSgwX8zVgpQ81Fyo= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-bff0beb2d82so2083128276.2 for ; Thu, 22 Jun 2023 13:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687467517; x=1690059517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=WzrZfg7Ix9NVgsDMORZZHtKMCnkCtYTNqN5BxfEl0LqJAF/m52D2DjGs1CtMdjlW/Y FCQoo6ICOsgfyZao7TI8v6fZI4UENFpY3jZe81s91B3mvmmCsOIgDTDPzHKe5SMRuqNo GqmfsZL/fdh4LhL0Jo2UTpv/Zzerp4OFJp5voue8zSTsRJ0/4bzo0POGwXibz4pL7ew3 XfWPis6drhy3Tn+kW5uEHt9jkm10f1F49xoaZHUD6V/XhEZK2GBId7pwhiwEW8CobjeX ndMopKlNsVQQSaeMMfuVNTCC7fSMRAuphXmsb5MG/ItVGni8JlC+amvlrfvw1GK2MkRJ BN3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687467517; x=1690059517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1W6z1I6yvWrQZbHmgHYBEGZZDstSbvELOPET/EcKlKw=; b=NMZ5ubNrRpY1d1iXQY14IS87d6C3CKleLoSnz5JC+5GSkHUkHdC0JFE2aJQ7Q1EDGZ eh9Arq2Ep3sI9FrHKUjgfyvJgyhk11VshZgW57LECgXNsraid6cXWfVXLh673ee0V9TP Dha38ULZs6qRYqBJwDuEr7GXOAZXfGepxznjPhZ4JPZf95ZrCWRtcugIC3wlVMfcPE4t gMxt+LWZzst7YJvwNS6vWYNS1AEecktJBpbIioX3OjPjdF0mLgU2HRFMOWVzr2Y5oC4X rGv3+loZibuYCHenoCuO5PG60IMy9Pd8Hmyj3Qiawazc4tmbs7JnZfhm2SZuumM25+m/ Awjg== X-Gm-Message-State: AC+VfDxy3FSnDP9wDfvJExubW2U/TqspHacUAAN776cORV25hFdsEjns TrYiFRre92Lv8d41URU9fZ4= X-Google-Smtp-Source: ACHHUZ43E6q8U9GZrhFDLZLO6dXpt9JpmRg2Kg6CKMns06auYc1hxRdgyW9/NyEhButWG+5gdBeMhw== X-Received: by 2002:a25:b190:0:b0:bd4:8ea4:39bb with SMTP id h16-20020a25b190000000b00bd48ea439bbmr15159544ybj.4.1687467517233; Thu, 22 Jun 2023 13:58:37 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::36]) by smtp.googlemail.com with ESMTPSA id d18-20020a5b0c52000000b00bc501a1b062sm1684937ybr.42.2023.06.22.13.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 13:58:36 -0700 (PDT) From: "Vishal Moola (Oracle)" To: Andrew Morton , Matthew Wilcox Cc: 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 , "Vishal Moola (Oracle)" , Catalin Marinas , Mike Rapoport Subject: [PATCH v5 20/33] arm64: Convert various functions to use ptdescs Date: Thu, 22 Jun 2023 13:57:32 -0700 Message-Id: <20230622205745.79707-21-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230622205745.79707-1-vishal.moola@gmail.com> References: <20230622205745.79707-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 31B691C001C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: uu3d6pckbjd8qpqu9amxdh5s6n7jyrwi X-HE-Tag: 1687467517-753725 X-HE-Meta: U2FsdGVkX19mkznlSDsb8ap2IQtqqxuUXfp6PYGfH5IxGs4ukHKAiaFWOjxgsGPVn3G9s5ocAZ/x0anyMdfCFlGaKa83HXhhpsoJpfWSmEyhNo0LlWQTq3mDEibjgoW60tMpKOoVJg7egfKgGP0GJ4pyKFTw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chB3SdnB+QkI8al0xpb9b4Ax/7qWCuxX+jdPpVfHamiFZTsH0xS//gh6X0LIHx28R3HHbKuQj88l9LWpL/gcyq0DjVt9HW8p5mlS/ufDEFbeLZSIonEY0rHcJ3ExxV8DJcyuiGWNYTANqxu6Dc9BwoBg4Ppl5wWrIOIczd1BzYENMy+rdRjZftR0Y7OlKQ6qh8I7uWrFXWzqj+7MOwUq4BgoOm+WjFmUQRiGSs3/e7nAfNNkKoHsZnMWMiCCF2BJuuZ4ibN+ZDOqyKMa5iKELqIc6lkdUPlUFGWLztLEkE0Dv+Tc1ZsQW1T1UhGvud5f8N2HU8v6EHobNC9phP7sk5W6mUT1mKMpUvdrVHIAu19AbThf6sllVQ4yB/GkGiA6hMyWyYkeHCExKozZEGDsASw3nWIxiVSRUUU7NWjoLNyo1sw== 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: As part of the conversions to replace pgtable constructor/destructors with ptdesc equivalents, convert various page table functions to use ptdescs. Signed-off-by: Vishal Moola (Oracle) Acked-by: Mike Rapoport (IBM) Acked-by: Catalin Marinas --- arch/arm64/include/asm/tlb.h | 14 ++++++++------ arch/arm64/mm/mmu.c | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h index c995d1f4594f..2c29239d05c3 100644 --- a/arch/arm64/include/asm/tlb.h +++ b/arch/arm64/include/asm/tlb.h @@ -75,18 +75,20 @@ static inline void tlb_flush(struct mmu_gather *tlb) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) { - pgtable_pte_page_dtor(pte); - tlb_remove_table(tlb, pte); + struct ptdesc *ptdesc = page_ptdesc(pte); + + pagetable_pte_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #if CONFIG_PGTABLE_LEVELS > 2 static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr) { - struct page *page = virt_to_page(pmdp); + struct ptdesc *ptdesc = virt_to_ptdesc(pmdp); - pgtable_pmd_page_dtor(page); - tlb_remove_table(tlb, page); + pagetable_pmd_dtor(ptdesc); + tlb_remove_ptdesc(tlb, ptdesc); } #endif @@ -94,7 +96,7 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp, static inline void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pudp, unsigned long addr) { - tlb_remove_table(tlb, virt_to_page(pudp)); + tlb_remove_ptdesc(tlb, virt_to_ptdesc(pudp)); } #endif diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 95d360805f8a..47781bec6171 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -426,6 +426,7 @@ static phys_addr_t __pgd_pgtable_alloc(int shift) static phys_addr_t pgd_pgtable_alloc(int shift) { phys_addr_t pa = __pgd_pgtable_alloc(shift); + struct ptdesc *ptdesc = page_ptdesc(phys_to_page(pa)); /* * Call proper page table ctor in case later we need to @@ -433,12 +434,12 @@ static phys_addr_t pgd_pgtable_alloc(int shift) * this pre-allocated page table. * * We don't select ARCH_ENABLE_SPLIT_PMD_PTLOCK if pmd is - * folded, and if so pgtable_pmd_page_ctor() becomes nop. + * folded, and if so pagetable_pte_ctor() becomes nop. */ if (shift == PAGE_SHIFT) - BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa))); + BUG_ON(!pagetable_pte_ctor(ptdesc)); else if (shift == PMD_SHIFT) - BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa))); + BUG_ON(!pagetable_pmd_ctor(ptdesc)); return pa; }