From patchwork Sun Jan 24 08:22:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 12042161 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,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 2A0DFC433E0 for ; Sun, 24 Jan 2021 08:23:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C2C1E22838 for ; Sun, 24 Jan 2021 08:23:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2C1E22838 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 5C6E26B0023; Sun, 24 Jan 2021 03:23:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5260E6B0024; Sun, 24 Jan 2021 03:23:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EE976B0025; Sun, 24 Jan 2021 03:23:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id 23C206B0023 for ; Sun, 24 Jan 2021 03:23:42 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E7CD2363F for ; Sun, 24 Jan 2021 08:23:41 +0000 (UTC) X-FDA: 77739979842.16.plant96_3c04f162757b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id C9E5B100E690C for ; Sun, 24 Jan 2021 08:23:41 +0000 (UTC) X-HE-Tag: plant96_3c04f162757b X-Filterd-Recvd-Size: 6561 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Sun, 24 Jan 2021 08:23:41 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id kx7so6458961pjb.2 for ; Sun, 24 Jan 2021 00:23:41 -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=JYIpc/oqm/sAsWgaVw4nIYbYX6wxnaKxqEtZNm7YbjwC4PE+yNUmVWfFFc7/DDS1vu 3Bvb2n4Lkhye1htDxYySk01BKuFM42hGfIYYp/NSXryeL6E+Voz4SH123INkddKD0IBL Kqyr/eoCmpBjxN++rd5vW/WXKaozCgA4xl6bXF4b8ZYx64nHsbskvRHVLhXNSzxzHocQ wxRHD0kk3MvwDPGLuNi9tIE20PB+2I42NP6a6n8eSVI+UF0EM09H06R1p8Ny1J5sk1Wh 0nxk5XGh4iImvCFUaIO5Iy+J3AqypcC/fRSz/vfCtV/aTL23HF2BthbLHhB4rU0r8dai GszA== 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=BxVsDHYscTl+rkAJwKJp1r/6QPGsHxvDPN63vrJAEuikcGt686TUGsYZiLWmNNwMO+ dIVA1zvquiwe4ZBsajIPnE1CoHUhUdSkkMvlO/fPfOuWncnQBEokmeY/BmDKahTdY5tA 4uZX3WzN2Sgux46QThnX7Xs5ExEjHRbAE+3vL7nrVLXPc2XpbffvVdKl2esvti6uzhXF vDBkG7tJE2NBhqrJdy9ak5JLznrsXS5FAGpkEGib4cuDPAZVN5GosJHqPqYnN38ag1ln qCNQkjlrmjlNE92ySRkj5/SjXtEdCRHkWVnTUTfb/XCM2uAWJuDjN3zIU2ODZNWGGfgZ hJLQ== X-Gm-Message-State: AOAM533Okc3h+4L3cqbA7e4H2A65rAiTZ3GE8Aw3+2coat8dADlFM2p5 YojhgHy6YiUpfdICoa9vO0cc0Sh42Nk= X-Google-Smtp-Source: ABdhPJyGxzt4jp0pHuRp4lsmYaC1aRXlAB8zf0kpATtdtfUdYJZXoyFDyRHWsaQurt0XqhzPzOtL+w== X-Received: by 2002:a17:902:9f89:b029:dc:3032:e439 with SMTP id g9-20020a1709029f89b02900dc3032e439mr1132590plq.35.1611476620596; Sun, 24 Jan 2021 00:23:40 -0800 (PST) Received: from bobo.ozlabs.ibm.com ([124.170.13.62]) by smtp.gmail.com with ESMTPSA id gb12sm11799757pjb.51.2021.01.24.00.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Jan 2021 00:23:40 -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, Zefan Li , Jonathan Cameron , Christoph Hellwig , Christophe Leroy , Rick Edgecombe , Ding Tianhong , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Subject: [PATCH v10 08/12] x86: inline huge vmap supported functions Date: Sun, 24 Jan 2021 18:22:26 +1000 Message-Id: <20210124082230.2118861-9-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210124082230.2118861-1-npiggin@gmail.com> References: <20210124082230.2118861-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().