From patchwork Sat Jul 13 07:08:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13732365 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 330EDC3DA45 for ; Sat, 13 Jul 2024 07:09: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:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5LRP0hJwS2Ugsakg5xFhyVn1GG8pcOdIyOfc/GvCK+U=; b=QT0vpHX/SHC2q+ DHVSxjvZbFAMyBUI19/+0v+h/P1h7rGavb1ET/aFjeJ2ljoQj0rEwbXfwZUrz+IPU5uyUF4ICj5OZ Asbj44Wqqak+WXLsNfVbiWBql9ELoK66mVA5O3KXjVzuTtY24/NDt8YbFyWemRbAjXjPkE/F9TYXw 1WUs8mGm2vO62MUcT7wC+BsORuG/0hEVvjFmVOWRpSBc/z8t8qNmcNRDlPAp2RnBTbg474DaNJVRT LwfLuH7EDnYp3AAhoqklIlb+Zc4BPXbS9rnZ3RFMJ3gsD8AE1Di+mkMz9mvTOHogrUqS3EWXGUChV ZGofsIpxFOXcFAJHOIuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWsp-000000024k7-3nkB; Sat, 13 Jul 2024 07:09:27 +0000 Received: from pegase2.c-s.fr ([93.17.235.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWsU-000000024Wi-3Crc; Sat, 13 Jul 2024 07:09:08 +0000 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WLfhT746xz9sST; Sat, 13 Jul 2024 09:08:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EcLfv5DIvfXK; Sat, 13 Jul 2024 09:08:57 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WLfhT68YXz9sSS; Sat, 13 Jul 2024 09:08:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BFAF98B76C; Sat, 13 Jul 2024 09:08:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Ht0A52iiwZyr; Sat, 13 Jul 2024 09:08:57 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.195]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B32A58B764; Sat, 13 Jul 2024 09:08:56 +0200 (CEST) From: Christophe Leroy To: Andrew Morton Cc: Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Oscar Salvador , Peter Xu Subject: [PATCH v3 1/5] arch/x86: Drop own definition of pgd,p4d_leaf Date: Sat, 13 Jul 2024 09:08:23 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720854504; l=1436; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=jETqTIBrbMCiSKtThDBVuiOakjqQZl9LJXDhA4Uy90Y=; b=j42rjo6o36t5FwwD7Ik5HJFIbBLA/oCUlT32r6QXUQT1OdEHDQG6EX/TeG2Jo+q73BQzLaMAy OGmrGbcVS1wAtLcieRc2n/Q4O9B0lUFj2TyovGgx73fb20ZcQs3cJV8 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240713_000906_969285_144E8EE5 X-CRM114-Status: UNSURE ( 8.53 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Oscar Salvador We provide generic definitions of pXd_leaf in pgtable.h when the arch do not define their own, where the generic pXd_leaf always return false. Although x86 defines {pgd,p4d}_leaf, they end up being a no-op, so drop them and make them fallback to the generic one. Signed-off-by: Oscar Salvador Signed-off-by: Christophe Leroy Reviewed-by: Peter Xu --- arch/x86/include/asm/pgtable.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 65b8e5bb902c..772f778bac06 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -252,13 +252,6 @@ static inline unsigned long pgd_pfn(pgd_t pgd) return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT; } -#define p4d_leaf p4d_leaf -static inline bool p4d_leaf(p4d_t p4d) -{ - /* No 512 GiB pages yet */ - return 0; -} - #define pte_page(pte) pfn_to_page(pte_pfn(pte)) #define pmd_leaf pmd_leaf @@ -1396,9 +1389,6 @@ static inline bool pgdp_maps_userspace(void *__ptr) return (((ptr & ~PAGE_MASK) / sizeof(pgd_t)) < PGD_KERNEL_START); } -#define pgd_leaf pgd_leaf -static inline bool pgd_leaf(pgd_t pgd) { return false; } - #ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION /* * All top-level MITIGATION_PAGE_TABLE_ISOLATION page tables are order-1 pages From patchwork Sat Jul 13 07:08:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13732366 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 336A3C3DA42 for ; Sat, 13 Jul 2024 07:09:48 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8sOL5W6jLUzuTXWGu1UmyR5cnCBuWf/R9Scys219pN0=; b=s1pB0DAEMs6znt BXdtm8IfuaENnMVLyqQ2i7B8U10uuFrSKNjKNplRvRfzZpJtYMJMnLTGcNPUqqnsoqAv6bDnjDbIZ QpVms6vtr+/99YytRp3ojbbODs16OXMf+FAzP8zcuL/paiEx4P/UWrAkMLn2tJ7mTJJUzuXpKZYik w5izqOFVhG6eKjUUqPtBRbrONVBrhjUXcpcf12QHrBxldvS+q0nBrMfqYOI+bC8PhSeQbttGwMd/z C3EqRNmhpY2H48tS0y86Y9NJD78dPoW54G7CKCw7T1dDDwZA1jRukXzoUDfDFLtvjJEvFXdROmFh6 UgEm/GmACB2A93j/PQjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWt6-000000024sJ-3VKU; Sat, 13 Jul 2024 07:09:44 +0000 Received: from pegase2.c-s.fr ([93.17.235.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWsa-000000024a1-02Z8; Sat, 13 Jul 2024 07:09:14 +0000 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WLfhW0n1Bz9sSV; Sat, 13 Jul 2024 09:08:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NT0I5H53SC1G; Sat, 13 Jul 2024 09:08:59 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WLfhV6fGyz9sSS; Sat, 13 Jul 2024 09:08:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D26E98B76C; Sat, 13 Jul 2024 09:08:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0WXuODkIT-v3; Sat, 13 Jul 2024 09:08:58 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.195]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C367B8B77B; Sat, 13 Jul 2024 09:08:57 +0200 (CEST) From: Christophe Leroy To: Andrew Morton Cc: Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Peter Xu , Oscar Salvador Subject: [PATCH v3 2/5] mm: Remove pud_user() from asm-generic/pgtable-nopmd.h Date: Sat, 13 Jul 2024 09:08:24 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720854504; l=2533; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=iBVqoMJazAvRQUo1vTp2Zd43IQ2OKhUaCoVnbqsBTJ0=; b=jJMk8U4y7cgZ/vp8633dMxDk0wPNiAX4F6OCHO9eyw5ASH4oMHt8ifjkUfcz5Xn4tKjD9A2nJ JWThXhe1dp2BhqiFdgOfAEseuosECaD6ssSvIM65cfPqwfXUql7AiTb X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240713_000912_229216_5E50135C X-CRM114-Status: GOOD ( 12.62 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Commit 2c8a81dc0cc5 ("riscv/mm: fix two page table check related issues") added pud_user() in include/asm-generic/pgtable-nopmd.h But pud_user() only exists on ARM64 and RISCV and is not expected by any part of MM. Add the missing definition in arch/riscv/include/asm/pgtable-32.h and remove it from asm-generic/pgtable-nopmd.h A stub pud_user() is also required for ARM64 after commit ed928a3402d8 ("arm64/mm: fix page table check compile error for CONFIG_PGTABLE_LEVELS=2") Signed-off-by: Christophe Leroy Reviewed-by: Peter Xu Reviewed-by: Oscar Salvador --- v3: Added pud_user() for arm64 --- arch/arm64/include/asm/pgtable.h | 1 + arch/riscv/include/asm/pgtable-32.h | 5 +++++ include/asm-generic/pgtable-nopmd.h | 1 - 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index f8efbc128446..c818b3328704 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -812,6 +812,7 @@ static inline pmd_t *pud_pgtable(pud_t pud) #define pud_valid(pud) false #define pud_page_paddr(pud) ({ BUILD_BUG(); 0; }) +#define pud_user false /* Always 0 with folding */ #define pud_user_exec(pud) pud_user(pud) /* Always 0 with folding */ /* Match pmd_offset folding in */ diff --git a/arch/riscv/include/asm/pgtable-32.h b/arch/riscv/include/asm/pgtable-32.h index 00f3369570a8..37878ef37466 100644 --- a/arch/riscv/include/asm/pgtable-32.h +++ b/arch/riscv/include/asm/pgtable-32.h @@ -36,4 +36,9 @@ static const __maybe_unused int pgtable_l4_enabled; static const __maybe_unused int pgtable_l5_enabled; +static inline int pud_user(pud_t pud) +{ + return 0; +} + #endif /* _ASM_RISCV_PGTABLE_32_H */ diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index 8ffd64e7a24c..b01349a312fa 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -30,7 +30,6 @@ typedef struct { pud_t pud; } pmd_t; static inline int pud_none(pud_t pud) { return 0; } static inline int pud_bad(pud_t pud) { return 0; } static inline int pud_present(pud_t pud) { return 1; } -static inline int pud_user(pud_t pud) { return 0; } static inline int pud_leaf(pud_t pud) { return 0; } static inline void pud_clear(pud_t *pud) { } #define pmd_ERROR(pmd) (pud_ERROR((pmd).pud)) From patchwork Sat Jul 13 07:08:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13732367 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 720EDC3DA45 for ; Sat, 13 Jul 2024 07:10:06 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y0oew59AV1LHtqVGmjkObiwl3N5rrOF22/niy0uhC2A=; b=DfzFfgmLvsCgMM L3Iiv/n5MOOHtI+N681xqIXSN9MyehJCaQP5p1QdZQf+WhN9oKi5lFeJcB4XBgf83VwZagd/Cf40a JG/IdFjkEXUICoTQpUri9vdAadipPFJLCJmHKie72W4oWbSJA5HN5rkkk7yABtq5PDw1CswZ3I8ji 4cVkzpSQDc8J2DKRXTQyKnMvfpFVMeEPW0GrPlS8c/BpX9zMhJmgCwe82hUw1NuDhN44DE9PGYwDU p1uMuJQI66lLBXB/pt/5RHHXyGeutE2IdV2wZnj8uvmzwnkFEuz5SLlI44eMPMOgcyPqqxI2Dt7j7 6JYJaA0Uqykn9iIDz81Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWtP-0000000252g-2FCW; Sat, 13 Jul 2024 07:10:03 +0000 Received: from pegase2.c-s.fr ([93.17.235.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWsg-000000024eo-3eCS; Sat, 13 Jul 2024 07:09:20 +0000 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WLfhX1pTzz9sSW; Sat, 13 Jul 2024 09:09:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QGR30cHzyt9i; Sat, 13 Jul 2024 09:09:00 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WLfhW68VNz9sSS; Sat, 13 Jul 2024 09:08:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C0DA28B76C; Sat, 13 Jul 2024 09:08:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Is4Ot-2G3sfo; Sat, 13 Jul 2024 09:08:59 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.195]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CA20E8B764; Sat, 13 Jul 2024 09:08:58 +0200 (CEST) From: Christophe Leroy To: Andrew Morton Cc: Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org Subject: [PATCH v3 3/5] LoongArch: Do not define pud_leaf() when there is no PMD Date: Sat, 13 Jul 2024 09:08:25 +0200 Message-ID: <732f3bdff0eed9cadfd35c698fd625e6e6cd6a04.1720854135.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720854504; l=1137; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=RQbVBWOxUSgTrrtTd+PLaiyfFRNFBzohHDDwKNmlF88=; b=kyeTq4tTk01pp+vPiGqPZ3xAI/bTN/2nOUDzVVH38OHwoM7j5I4X1quNwT1FsruuJa0FOTAwZ rE5KJnkCyhRC1DTqMd1fiL38cWn3qM95rUdVmXFoo9KKFZEIFgqwdKA X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240713_000919_072354_72C3C1CF X-CRM114-Status: GOOD ( 10.72 ) 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org pud_leaf() is already provided by asm-generic/pgtable-nopmd.h Do not add a macro that hides and overrides the static inline definition in asm-generic/pgtable-nopmd.h. Signed-off-by: Christophe Leroy --- arch/loongarch/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h index 161dd6e10479..da91b2d8bc6f 100644 --- a/arch/loongarch/include/asm/pgtable.h +++ b/arch/loongarch/include/asm/pgtable.h @@ -207,6 +207,7 @@ static inline pmd_t *pud_pgtable(pud_t pud) #define pud_phys(pud) PHYSADDR(pud_val(pud)) #define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT)) +#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) #endif @@ -611,7 +612,6 @@ static inline long pmd_protnone(pmd_t pmd) #endif /* CONFIG_NUMA_BALANCING */ #define pmd_leaf(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) -#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) /* * We provide our own get_unmapped area to cope with the virtual aliasing From patchwork Sat Jul 13 07:08:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13732368 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 7083EC3DA42 for ; Sat, 13 Jul 2024 07:10:25 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7+UkY7LmaBf/r/VqVwv8rUyt4d2JhpZZGZstKrsiPms=; b=nsSxWPPrg4k/JS 4Y8DF9Gj5P6PtGPsO6GKTHgT/GYiMCspOagh2nDVNfPLyOtP34U9087nmeZWGEjGfIdgAtto6o+U9 c8DBvvYwcimQ+iqv7B8kvHYBMMUzvx+DcYmA0YSKEAWTqf8IXdKfnnGg21qkK9BI1d1VvThp74qK1 J4bLaG1BGm1OYHyOxN4MxOz1n5+XUtyNXXqh+2B+61wLT9KOlu0x61TQ/hYYFirOtiek1MJoqlC43 75cznvk8K12cLiah3UcoavCwiKUTzt8yqh963/Gpeg9i8ORB/QYzrU8Acro+3vLvuOjY8sYr46rL8 GHD6wN8fRwmOKMm1O+7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWth-000000025BC-1eNf; Sat, 13 Jul 2024 07:10:21 +0000 Received: from pegase2.c-s.fr ([93.17.235.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWsl-000000024gw-2bfo; Sat, 13 Jul 2024 07:09:25 +0000 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WLfhY1Ky4z9sSY; Sat, 13 Jul 2024 09:09:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A-AU9RRVGJNq; Sat, 13 Jul 2024 09:09:01 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WLfhX5qbsz9sSS; Sat, 13 Jul 2024 09:09:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B4D378B764; Sat, 13 Jul 2024 09:09:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id g1jIk9GeChEz; Sat, 13 Jul 2024 09:09:00 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.195]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C2AE78B77B; Sat, 13 Jul 2024 09:08:59 +0200 (CEST) From: Christophe Leroy To: Andrew Morton Cc: Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org Subject: [PATCH v3 4/5] mips: Do not define pud_leaf() when there is no PMD Date: Sat, 13 Jul 2024 09:08:26 +0200 Message-ID: <1cb28532d832b48b0a41f169615fec40546a5398.1720854135.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720854504; l=1388; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=+hQ+cxc/Ik0JwvL+Bfnn1kxrsZliqHaKk8FlBgA+6Fo=; b=PLrrIe9d7K8ajU9r5dWm0pYSfP8m3PYAmv4ou0R1F/fHVq5h7MJVKy8XI87mc+oO63w30Q/0N 999CdgHyAKNBeKPL3EK6axF0jxci7jZZYgenwddYCjhEEnjixrFTwoj X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240713_000923_836220_EC67B855 X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org pud_leaf() is already provided by asm-generic/pgtable-nopmd.h Do not add a macro that hides and overrides the static inline definition in asm-generic/pgtable-nopmd.h. Signed-off-by: Christophe Leroy --- arch/mips/include/asm/pgtable-64.h | 4 ++++ arch/mips/include/asm/pgtable.h | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index 401c1d9e4409..d2de4e2800be 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h @@ -294,6 +294,10 @@ static inline void pud_clear(pud_t *pudp) { pud_val(*pudp) = ((unsigned long) invalid_pmd_table); } + +#ifdef _PAGE_HUGE +#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) +#endif #endif #define pte_page(x) pfn_to_page(pte_pfn(x)) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index c29a551eb0ca..28233025f884 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -755,7 +755,6 @@ static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, #ifdef _PAGE_HUGE #define pmd_leaf(pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) -#define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) #endif #define gup_fast_permitted(start, end) (!cpu_has_dc_aliases) From patchwork Sat Jul 13 07:08:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13732369 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 09952C3DA42 for ; Sat, 13 Jul 2024 07:10:41 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vb5mUO3XaX9zo2v8klSVNyc5E+t7O5tNVMQA/Hg7OWA=; b=De1j3ViEfGCNOZ LWxElD/2SCO1DDlm6erEKrLTfuomhOC+7x+9zcEZ6nwKmpzJIct5fZrj13JH6osthuEfbkQ97LB9G sQOSzzVqZiQ7+JycsXqJvxdJgEJI5i2ivzPSnL0mxXhe8Nz+Tqn9xxt6itT1K4DGSJ7RimhYHfNYI BoOKZKXyK/98QYsz8/1Hovmq8Ypp2eG3lXpeUGfGZE7eW8S9sd3JyQ78vxO28meCQzxv79J1wd1dU hku81H47grLNGZleCQkt+csrlOVlOUoPLbaIsOHN8HAGUSKooRRs8jMc+Am3bfF8fvLhnIXpevOMZ ppLgu+/aHFmzN0ZiBD1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWty-000000025II-1tof; Sat, 13 Jul 2024 07:10:38 +0000 Received: from pegase2.c-s.fr ([93.17.235.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSWsp-000000024jW-2puG; Sat, 13 Jul 2024 07:09:29 +0000 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WLfhZ1Ccnz9sSb; Sat, 13 Jul 2024 09:09:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rBAPNnN2erdv; Sat, 13 Jul 2024 09:09:02 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WLfhY68WVz9sSS; Sat, 13 Jul 2024 09:09:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BCB5C8B764; Sat, 13 Jul 2024 09:09:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id U1NlTXZ3sw-T; Sat, 13 Jul 2024 09:09:01 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.233.195]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B6F798B76C; Sat, 13 Jul 2024 09:09:00 +0200 (CEST) From: Christophe Leroy To: Andrew Morton Cc: Christophe Leroy , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-arch@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Peter Xu Subject: [PATCH v3 5/5] mm: Add p{g/4}d_leaf() in asm-generic/pgtable-nop{4/u}d.h Date: Sat, 13 Jul 2024 09:08:27 +0200 Message-ID: <7b6f39f3cc9823e0a058b27f50ad4f47b2e10979.1720854135.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1720854504; l=2504; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=9cGeujZtX2c/zEf05hq/l7o1WBt5GJFv+9LPfky90p8=; b=MN2/woF7LqGhnWnq57H61zGqJsMcmtZviZwr/m6VoCoVv5XepEx+34tqeLFna5lL+rtgkoHC6 84JnWQ04MY8AFTasVOBH1guX6oXN81IRpiabqc6NIYejAVLsU1O2E4y X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240713_000927_890089_32736278 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Commit 2c8a81dc0cc5 ("riscv/mm: fix two page table check related issues") added pud_leaf() in include/asm-generic/pgtable-nopmd.h Do the same for p4d_leaf() and pgd_leaf() to avoid getting them erroneously defined by architectures that do not implement the related page level. Signed-off-by: Christophe Leroy Reviewed-by: Peter Xu --- v2: Added pXd_leaf macro as well in asm-generic/pgtable-nopXd.h to cohabit with the fallback --- include/asm-generic/pgtable-nop4d.h | 2 ++ include/asm-generic/pgtable-nopmd.h | 1 + include/asm-generic/pgtable-nopud.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/include/asm-generic/pgtable-nop4d.h b/include/asm-generic/pgtable-nop4d.h index 03b7dae47dd4..ed7ba008469f 100644 --- a/include/asm-generic/pgtable-nop4d.h +++ b/include/asm-generic/pgtable-nop4d.h @@ -21,6 +21,8 @@ typedef struct { pgd_t pgd; } p4d_t; static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pgd_present(pgd_t pgd) { return 1; } +static inline int pgd_leaf(pgd_t pgd) { return 0; } +#define pgd_leaf pgd_leaf static inline void pgd_clear(pgd_t *pgd) { } #define p4d_ERROR(p4d) (pgd_ERROR((p4d).pgd)) diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h index b01349a312fa..e178ace2e23e 100644 --- a/include/asm-generic/pgtable-nopmd.h +++ b/include/asm-generic/pgtable-nopmd.h @@ -31,6 +31,7 @@ static inline int pud_none(pud_t pud) { return 0; } static inline int pud_bad(pud_t pud) { return 0; } static inline int pud_present(pud_t pud) { return 1; } static inline int pud_leaf(pud_t pud) { return 0; } +#define pud_leaf pud_leaf static inline void pud_clear(pud_t *pud) { } #define pmd_ERROR(pmd) (pud_ERROR((pmd).pud)) diff --git a/include/asm-generic/pgtable-nopud.h b/include/asm-generic/pgtable-nopud.h index eb70c6d7ceff..655dfebea91c 100644 --- a/include/asm-generic/pgtable-nopud.h +++ b/include/asm-generic/pgtable-nopud.h @@ -28,6 +28,8 @@ typedef struct { p4d_t p4d; } pud_t; static inline int p4d_none(p4d_t p4d) { return 0; } static inline int p4d_bad(p4d_t p4d) { return 0; } static inline int p4d_present(p4d_t p4d) { return 1; } +static inline int p4d_leaf(p4d_t p4d) { return 0; } +#define p4d_leaf p4d_leaf static inline void p4d_clear(p4d_t *p4d) { } #define pud_ERROR(pud) (p4d_ERROR((pud).p4d))