From patchwork Mon Jul 31 17:03:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13335119 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 A6EA0C001DE for ; Mon, 31 Jul 2023 17:04:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 93B7E6B0180; Mon, 31 Jul 2023 13:04:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C5B7280072; Mon, 31 Jul 2023 13:04:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A200280071; Mon, 31 Jul 2023 13:04:18 -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 572AD6B0180 for ; Mon, 31 Jul 2023 13:04:18 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 369CF16031B for ; Mon, 31 Jul 2023 17:04:18 +0000 (UTC) X-FDA: 81072530196.02.926E079 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by imf15.hostedemail.com (Postfix) with ESMTP id 4845EA0015 for ; Mon, 31 Jul 2023 17:04:14 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DoLYDaRB; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 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=1690823055; 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=CNRNqydFQU30fHNpX1gymLK7Ztn+cMmm0w9N6c61ox72V1/ZVw+0d91XXR45/lz2DRbSzL oTyo1hpdFXFXR+uIzwe1Gv+5s1umBAdQesiq9O+pZWdATZjamq4rSE1BNPwLUTws04JQfM So6Zw4yOmF4Hv6Uz6HFji0kKMZrxw04= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DoLYDaRB; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.219.170 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690823055; a=rsa-sha256; cv=none; b=0O8/2hweMynMmjv4uindArNkFc5qOhTWo/M/iK2A9uWiUlftBaKCtFALrdoEXMbqVjVenv LIi4HKDSA/NkHgeNd3vK5OY905rGYNuZxJUT1ANLUVuvR+L71VKRU5gqbtR7ZGG6Pi28/l tOcoBtlj2CGW7QTy6zxsMXNRGH+IXxU= Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-d29a5f7dc74so3268156276.3 for ; Mon, 31 Jul 2023 10:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690823054; x=1691427854; 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=DoLYDaRBa41Zdh1yGELvr4mktDPzCr5wZMtfaOFQzQ5hTcfRkcfNo2gxzOD+0/ykOM euBOcnH4+UQlm104MdM8Mcd6Wd+0oXQ7r2d8C7k16OxK93xpXJQ9cxidNEnw+09+Tsgn 4MiJbaZ4azooZbJym/w2spQi4ZLNoUGyQvzF+yt3P/maH4DT1bEGYtqh5RJ+6A+RSiNZ F4VZO0F3scHf9jVdMvyffz9Y4Un+dZzmqLUFBUExZqr5BTOKTZ3vKrNuYiRkZjRgx8qM A0v2BAwmzAgXUoHV1OBdUh/BQxSYjg1Y5Vc+ifw6djIqa1GbEqCTgLRTuyk3SSeDHWhN ZcIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690823054; x=1691427854; 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=QyXjfx661GKUFXlvS17g0Ymn4eziEZBEkRn6sOKFlLuGQXwKBqaYRXfUFUSFR3oOC5 3DvhFAXHp4HZid1QN8yMy6cWAdgw/3aQ+l53/XYFVLgGiuXEW4EjgAO0YhsUOMkdVvlW sERs5NV1UXQgzo0PyZB7sFFxILVMdrtVv1onQs1ZRHRmow7Xtb3cpPRyhPTJw97SHWPV 1WVpLniXjvsIHOosS4i4b8s/F88pnprx+cL4LV7CLMUivzcacVcorQmNdMKZnfz5Bvt7 aYvO8/6Jww8lO4TB40LcMs49m7q6R2BznTwAhW8/Cv+qgBsUKm5DvifUwZI0fmtYHLgx vZQA== X-Gm-Message-State: ABy/qLYrJ3KybSLKYpy6AWonTIN7AjQvPsT1OPHw8lgNm2rD3+CmdT1C jHhBxiCLR5+p3+VybZHBMo8= X-Google-Smtp-Source: APBJJlEdpRjJyqAaQhaJuPKqzpefz2AFbwFC7sVhDBH7lQjGs0g9KoyKRkFSzeflgvIaUwqu4lunqA== X-Received: by 2002:a25:b08d:0:b0:d11:2a52:3f35 with SMTP id f13-20020a25b08d000000b00d112a523f35mr11488364ybj.20.1690823054136; Mon, 31 Jul 2023 10:04:14 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::16]) by smtp.googlemail.com with ESMTPSA id x31-20020a25ac9f000000b00c832ad2e2eesm2511833ybi.60.2023.07.31.10.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 10:04:13 -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)" , Mike Rapoport , Catalin Marinas Subject: [PATCH mm-unstable v8 18/31] arm64: Convert various functions to use ptdescs Date: Mon, 31 Jul 2023 10:03:19 -0700 Message-Id: <20230731170332.69404-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230731170332.69404-1-vishal.moola@gmail.com> References: <20230731170332.69404-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 4845EA0015 X-Stat-Signature: xuhaifbx4k8d3aoqijyegmxcfb94kboy X-HE-Tag: 1690823054-65646 X-HE-Meta: U2FsdGVkX1+Pq3XmrTw7B6oNwNtaB4MKPUwPa+66qRKzu7nsEvZeRFLiSx5zWV5ODVBHM2Mghy2AHSaDBWS4L7Z+VHtfBEgIQVlgsoSRAJzl9DdX0IJH54ttyMooCsnhSjGwuqRk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diO0ePhxhineUgj33+Ko/2f402pOqeo+g1a+hQ3yMZg9v0p7xSXs4rnHUKNks5JoQr1/DO8xnqBjsebVkIp9xRfBEmIRYoY2Ipwn7SX3gq5GsGVZ5Leg39RqC8wLp3e7mkK4X9+/ET0+7euTonvAvCg8EHD9I5HNbzPl/uxELi+FjOV8ArH1vS+ZZctBiH3EhTvic33/7mY6tVb0MTJUMvyJV7alQR3mWAPcgwHC5kD6NO8Rha4JeIbVYJ547v0uuVGeGtity8YQiseQr/jhPyKFO1V5WMXT6U80K0DBaipahYY7tNhXMKzv/m9NeCi9zYrunZzuy6al0z54B+RfROSgVMjbeUM4DLbxO3yTjmgAjXftBITq+UfNbtyhrs/ku7pQSdrBPo6vAtX1xcs9blQeBY/SqTIcqTAYHTiLF5lt6HwIEgBHPLF6VAYQXLQ== 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; }