From patchwork Tue Jan 26 04:45:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 12045207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6E22C433E0 for ; Tue, 26 Jan 2021 04:46:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 89F2622B2C for ; Tue, 26 Jan 2021 04:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89F2622B2C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1C6128D0082; Mon, 25 Jan 2021 23:46:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 181878D0076; Mon, 25 Jan 2021 23:46:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03B048D0082; Mon, 25 Jan 2021 23:46:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id E26DF8D0076 for ; Mon, 25 Jan 2021 23:46:11 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A9CB8824999B for ; Tue, 26 Jan 2021 04:46:11 +0000 (UTC) X-FDA: 77746689342.06.place63_0e0f07b2758b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 845EC1003D4DD for ; Tue, 26 Jan 2021 04:46:11 +0000 (UTC) X-HE-Tag: place63_0e0f07b2758b X-Filterd-Recvd-Size: 6541 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Jan 2021 04:46:10 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id e9so1518514pjj.0 for ; Mon, 25 Jan 2021 20:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=80Po72abxrqXJsVTjT2d7/68A0xoEHKX9fHFXJoIAvk=; b=viLXuq+pOoJhiIJfe3V53L70i2VCM5Kx2zpp1vzlriFsS7XnMzjIeGHXf6XeUUnQqL DT4NxshjZo/ZsM40oISLUsEiIrY7A+chXuVUfRv6f7vz7lPqLMi4JHdIOZX79O01P/Ap fTfsPaI3F3k1d1EMB9lC6vuzdt49EadkfQIxASWs3/kIiQ+6zYj5lp8MIsyUYvr7XfSZ bYpVRMV4hT3l0TGn0y+IPpyvkUcDpcMJHQxkZ/gGwLh8CRj/V3sZCkHjEQYOmNrJmvKe T3GjSk+u/NVlYDadRweAx8D7mH96FsmQUc+D106H0+5DYwUUbGkaGldFSiMPfxQjOE5y 6LKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=80Po72abxrqXJsVTjT2d7/68A0xoEHKX9fHFXJoIAvk=; b=Ve2CcCW1RNSi5m1jag/JYc2vqG904Vm4DXPxWw8EwnPemRuT5ljgpBbp4m0VUuwEM9 StTJiar4yN7kyZ0zrrjDv/JecdiSG6St7um/UC5M86FYXadHBzPLycrvYxoICqH9nwC+ sd5fkpk3HxWOvj+HcpLNzB/OFfZ/YN/vKovMlrR4lwKTNBo9gNBxt3OvXx40ssz7LUyv D9ldLOtQquxm3BsIAnG3BnYrhIYcV71GLyltJgwllmYm2CHs4RpBvNWS0OdsKYsmaY1D 6KSsHxLr90sxmfyQLOWunwqAo8gtH8RV1bETSQw1EVE0RUFjzhPSiL4bKw+htLQJTQA3 mNwg== X-Gm-Message-State: AOAM532sye0+8G6sQS9d4U8F+o67VkqX9VUuaSzF8PnXCKqCVhU0BTZq RB63ixYGFKs7bW+w2FZ3pWH8j49je94= X-Google-Smtp-Source: ABdhPJx0MEaL9UthAXE+lEl19XW53SVj2As+HvUb7kW+EEQDhe4oaMJEGdAx5EmAU394pBr2oTER/A== X-Received: by 2002:a17:90b:19c7:: with SMTP id nm7mr4133639pjb.20.1611636370000; Mon, 25 Jan 2021 20:46:10 -0800 (PST) Received: from bobo.ozlabs.ibm.com (192.156.221.203.dial.dynamic.acc50-nort-cbr.comindico.com.au. [203.221.156.192]) by smtp.gmail.com with ESMTPSA id 68sm19272293pfg.90.2021.01.25.20.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 20:46:09 -0800 (PST) From: Nicholas Piggin To: linux-mm@kvack.org, Andrew Morton Cc: Nicholas Piggin , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Jonathan Cameron , Christoph Hellwig , Christophe Leroy , Rick Edgecombe , Ding Tianhong , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Subject: [PATCH v11 08/13] x86: inline huge vmap supported functions Date: Tue, 26 Jan 2021 14:45:05 +1000 Message-Id: <20210126044510.2491820-9-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210126044510.2491820-1-npiggin@gmail.com> References: <20210126044510.2491820-1-npiggin@gmail.com> MIME-Version: 1.0 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: This allows unsupported levels to be constant folded away, and so p4d_free_pud_page can be removed because it's no longer linked to. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x86@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Nicholas Piggin --- arch/x86/include/asm/vmalloc.h | 22 +++++++++++++++++++--- arch/x86/mm/ioremap.c | 21 --------------------- arch/x86/mm/pgtable.c | 13 ------------- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/arch/x86/include/asm/vmalloc.h b/arch/x86/include/asm/vmalloc.h index 094ea2b565f3..e714b00fc0ca 100644 --- a/arch/x86/include/asm/vmalloc.h +++ b/arch/x86/include/asm/vmalloc.h @@ -1,13 +1,29 @@ #ifndef _ASM_X86_VMALLOC_H #define _ASM_X86_VMALLOC_H +#include #include #include #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP -bool arch_vmap_p4d_supported(pgprot_t prot); -bool arch_vmap_pud_supported(pgprot_t prot); -bool arch_vmap_pmd_supported(pgprot_t prot); +static inline bool arch_vmap_p4d_supported(pgprot_t prot) +{ + return false; +} + +static inline bool arch_vmap_pud_supported(pgprot_t prot) +{ +#ifdef CONFIG_X86_64 + return boot_cpu_has(X86_FEATURE_GBPAGES); +#else + return false; +#endif +} + +static inline bool arch_vmap_pmd_supported(pgprot_t prot) +{ + return boot_cpu_has(X86_FEATURE_PSE); +} #endif #endif /* _ASM_X86_VMALLOC_H */ diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index fbaf0c447986..12c686c65ea9 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -481,27 +481,6 @@ void iounmap(volatile void __iomem *addr) } EXPORT_SYMBOL(iounmap); -#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP -bool arch_vmap_p4d_supported(pgprot_t prot) -{ - return false; -} - -bool arch_vmap_pud_supported(pgprot_t prot) -{ -#ifdef CONFIG_X86_64 - return boot_cpu_has(X86_FEATURE_GBPAGES); -#else - return false; -#endif -} - -bool arch_vmap_pmd_supported(pgprot_t prot) -{ - return boot_cpu_has(X86_FEATURE_PSE); -} -#endif - /* * Convert a physical pointer to a virtual kernel pointer for /dev/mem * access diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index f6a9e2e36642..d27cf69e811d 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c @@ -780,14 +780,6 @@ int pmd_clear_huge(pmd_t *pmd) return 0; } -/* - * Until we support 512GB pages, skip them in the vmap area. - */ -int p4d_free_pud_page(p4d_t *p4d, unsigned long addr) -{ - return 0; -} - #ifdef CONFIG_X86_64 /** * pud_free_pmd_page - Clear pud entry and free pmd page. @@ -861,11 +853,6 @@ int pmd_free_pte_page(pmd_t *pmd, unsigned long addr) #else /* !CONFIG_X86_64 */ -int pud_free_pmd_page(pud_t *pud, unsigned long addr) -{ - return pud_none(*pud); -} - /* * Disable free page handling on x86-PAE. This assures that ioremap() * does not update sync'd pmd entries. See vmalloc_sync_one().