From patchwork Mon May 1 19:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13227944 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 6208FC77B7C for ; Mon, 1 May 2023 19:29:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D7D2280017; Mon, 1 May 2023 15:29:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 25CC0280002; Mon, 1 May 2023 15:29:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D611280017; Mon, 1 May 2023 15:29:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EB8F5280002 for ; Mon, 1 May 2023 15:29:13 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9644AA07FB for ; Mon, 1 May 2023 19:29:13 +0000 (UTC) X-FDA: 80742674586.19.B1108FA Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf06.hostedemail.com (Postfix) with ESMTP id BBD9A180007 for ; Mon, 1 May 2023 19:29:11 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Z7q9x2Xo; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682969351; 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=4OtNgWOkZ3LfZLHJ8GzTdJkHLxMJcmtHKM1yrsNlf/Q=; b=fuUOwTnz21/zSHClkcq/h1K8S6avpWQBk5eVxujraTQdrWg7h0v2MVhpKsYQ+Y/JE11ZaH AUnSweOLjH7WVV9FzaOfNutbnkkowLp2EKvKubPJFfSiYjLPWekG3eWFR1xevtKIomnC3c IXyWEqeRjv1pedvtvMwN7xI/bAmll0c= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Z7q9x2Xo; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682969351; a=rsa-sha256; cv=none; b=7QBKv9U6+NMSDE6FnWkjNOk8lNfPQwOjG/2ft9WmuQIeTkuvVQDw2Wj/WPzYoGyhlsDQKF CMDx3jHnU5Cv9DCDK3JRj9ch85+0uLhNSS0wODxiKZ6GpIf0S873g9TlF/mbt10r8UmYKN 8uh3Rcd2Rvu9jz78r6aRoR+cbTqHuwA= Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1a69f686345so21085605ad.2 for ; Mon, 01 May 2023 12:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682969350; x=1685561350; 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=4OtNgWOkZ3LfZLHJ8GzTdJkHLxMJcmtHKM1yrsNlf/Q=; b=Z7q9x2Xo+R2VkP+SAoL4No5SPSbkqDSqv1O/IrhmxSJUfCVapYFLSqvpVv77DdaaNp 7xLFfeVlS+/Z0T5loFjBwxXBtJMOL0SomvnLpxrMgUE0H3Z2NwMVPWqjWZZaWw/Xtz9H bXhAt7jaDl6TAQEvatyLSYOokashb8FOV+mCaWLsgTEKm8FhtMTj/edGzjuLKaTQnJVx 0eZhRzcKCCgmZxOyeAj8qE7Nk7KdCTP6wyrMnmtMZ4gp104XnMq6z3YcmLmYurGQiyUb qQCTGhNGKLl+87vhFPVut1PJmPE/0ePjlrtCLEgAAJx+RTgFbaFyPCMZ3prXkkSGna7E KEcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682969350; x=1685561350; 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=4OtNgWOkZ3LfZLHJ8GzTdJkHLxMJcmtHKM1yrsNlf/Q=; b=D9eAtFPYPD2r5PUQSLgF1Wk8vOEgxPI7wk6ejbgeTu5dq5/ivXqMWI1S966fOZ73dt exQVki/BEmmab45MqPZ/JOALReYvH6oHsTEzCDrRqf+a0dtF+9MejEQTyn3heL7i+CC5 bW01QH/V48gzUNhEO3dJZ9D083ASPu6mYmTET1rF1XNvQROwtkK0/hCMTVfAGreF6UxQ gjTm0XSJ2+EnIT0iYXxN5Dfd9Z8D2HhAKLnrbLVhtIYbMWdRH7Y6Axyz/rOov6i5n0CK 1opJBn1nSklzsFEaVGMJ7VnIH3brqLk2Oj9TmzALOIkdDDCqC5Zgu0RQh/Eeia4onmmJ 5+gA== X-Gm-Message-State: AC+VfDwNrqY81H9VYzXElE91o/osmb8Mr9aIKboE8rl7BMQGZwOJ20Az egFGAXQ0d//B2Dk8pnEH/9g= X-Google-Smtp-Source: ACHHUZ6ZQG7EefBUYeumgjpKENexw5lTdMP6ZEhxCncdw/ecXlC+vhc9H9rF3r/Lw9bkiQ71uazgBQ== X-Received: by 2002:a17:902:a516:b0:1a6:6b9d:5e0f with SMTP id s22-20020a170902a51600b001a66b9d5e0fmr14561274plq.17.1682969350547; Mon, 01 May 2023 12:29:10 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::9a2c]) by smtp.googlemail.com with ESMTPSA id u8-20020a170902bf4800b0019c13d032d8sm18175622pls.253.2023.05.01.12.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 12:29:10 -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, "Vishal Moola (Oracle)" , Geert Uytterhoeven Subject: [PATCH v2 25/34] m68k: Convert various functions to use ptdescs Date: Mon, 1 May 2023 12:28:20 -0700 Message-Id: <20230501192829.17086-26-vishal.moola@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501192829.17086-1-vishal.moola@gmail.com> References: <20230501192829.17086-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: BBD9A180007 X-Stat-Signature: utuu8p91tqj5154sqyrtoarq674obicf X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1682969351-332932 X-HE-Meta: U2FsdGVkX1/NJfTFgJa4pauCC+gsMufZJFaPUHq8VHaInqlCEX9ZuZzP49AGAfMefBrPCpJpzltVRh/w6j2DHf0+P4lg0T+q1LO7iez3AEdG7WnY1/M5zkvBgYM3HF9e0/OGqqYAV+MJWw6G4OSk+muHlmUMIsCV9wCqk0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ohfFfdX0OA9dStt1o/QxMur7x1CBbzpbpH/ZHyMiQeLLhZtHWNiCz4sKvDCIv4D6MdmmrXv85JXorTq1hjI3yHPdfzWVEv28/803hXIuUWrOurZQrMz4pS35BR8djfHS7JIctK5SoBTe7W9j7rGpssFLK1WBF1daoetFo68sUi/HvRdsvq4prz1m7kXfZo5Nt3FVaT+DXXK1Y1d9tXL3A9k+Td+0bKnIguayiEpovuERoqDbsqtRfVhqX1FCKIq0/HBqCDbitc726yC+OSBupdU75BI1ZojdUsQ== 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. Some of the functions use the *get*page*() helper functions. Convert these to use ptdesc_alloc() and ptdesc_address() instead to help standardize page tables further. Signed-off-by: Vishal Moola (Oracle) --- arch/m68k/include/asm/mcf_pgalloc.h | 41 ++++++++++++++-------------- arch/m68k/include/asm/sun3_pgalloc.h | 8 +++--- arch/m68k/mm/motorola.c | 4 +-- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 5c2c0a864524..b0e909e23e14 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -7,20 +7,19 @@ extern inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) { - free_page((unsigned long) pte); + ptdesc_free(virt_to_ptdesc(pte)); } extern const char bad_pmd_string[]; extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) { - unsigned long page = __get_free_page(GFP_DMA); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA | __GFP_ZERO, 0); - if (!page) + if (!ptdesc) return NULL; - memset((void *)page, 0, PAGE_SIZE); - return (pte_t *) (page); + return (pte_t *) (ptdesc_address(ptdesc)); } extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) @@ -35,36 +34,36 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address) static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable, unsigned long address) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(pgtable); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } static inline pgtable_t pte_alloc_one(struct mm_struct *mm) { - struct page *page = alloc_pages(GFP_DMA, 0); + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA, 0); pte_t *pte; - if (!page) + if (!ptdesc) return NULL; - if (!pgtable_pte_page_ctor(page)) { - __free_page(page); + if (!ptdesc_pte_ctor(ptdesc)) { + ptdesc_free(ptdesc); return NULL; } - pte = page_address(page); - clear_page(pte); + pte = ptdesc_address(ptdesc); + ptdesc_clear(pte); return pte; } static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) { - struct page *page = virt_to_page(pgtable); + struct ptdesc *ptdesc = virt_to_ptdesc(ptdesc); - pgtable_pte_page_dtor(page); - __free_page(page); + ptdesc_pte_dtor(ptdesc); + ptdesc_free(ptdesc); } /* @@ -75,16 +74,18 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable) static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { - free_page((unsigned long) pgd); + ptdesc_free(virt_to_ptdesc(pgd)); } static inline pgd_t *pgd_alloc(struct mm_struct *mm) { pgd_t *new_pgd; + struct ptdesc *ptdesc = ptdesc_alloc(GFP_DMA | GFP_NOWARN, 0); - new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN); - if (!new_pgd) + if (!ptdesc) return NULL; + new_pgd = (pgd_t *) ptdesc_address(ptdesc); + memcpy(new_pgd, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t)); memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT); return new_pgd; diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 198036aff519..013d375fc239 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -17,10 +17,10 @@ extern const char bad_pmd_string[]; -#define __pte_free_tlb(tlb,pte,addr) \ -do { \ - pgtable_pte_page_dtor(pte); \ - tlb_remove_page((tlb), pte); \ +#define __pte_free_tlb(tlb, pte, addr) \ +do { \ + ptdesc_pte_dtor(page_ptdesc(pte)); \ + tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \ } while (0) static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index 911301224078..f7adb86b37fb 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -161,7 +161,7 @@ void *get_pointer_table(int type) * m68k doesn't have SPLIT_PTE_PTLOCKS for not having * SMP. */ - pgtable_pte_page_ctor(virt_to_page(page)); + ptdesc_pte_ctor(virt_to_ptdesc(page)); } mmu_page_ctor(page); @@ -201,7 +201,7 @@ int free_pointer_table(void *table, int type) list_del(dp); mmu_page_dtor((void *)page); if (type == TABLE_PTE) - pgtable_pte_page_dtor(virt_to_page(page)); + ptdesc_pte_dtor(virt_to_ptdesc((void *)page)); free_page (page); return 1; } else if (ptable_list[type].next != dp) {