From patchwork Wed Mar 17 06:23:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 12144897 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 D0E43C433E0 for ; Wed, 17 Mar 2021 06:25:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5EBD864FA8 for ; Wed, 17 Mar 2021 06:25:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5EBD864FA8 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 F20DC6B0073; Wed, 17 Mar 2021 02:25:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF7636B0082; Wed, 17 Mar 2021 02:25:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D72226B0083; Wed, 17 Mar 2021 02:25:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0103.hostedemail.com [216.40.44.103]) by kanga.kvack.org (Postfix) with ESMTP id BE51C6B0073 for ; Wed, 17 Mar 2021 02:25:33 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7D4A1815B for ; Wed, 17 Mar 2021 06:25:33 +0000 (UTC) X-FDA: 77928379746.01.E68BCC0 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf07.hostedemail.com (Postfix) with ESMTP id 169BDA0009DA for ; Wed, 17 Mar 2021 06:25:32 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id bt4so528199pjb.5 for ; Tue, 16 Mar 2021 23:25:32 -0700 (PDT) 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=oZYPzoCQS87jB7WmWdNUk0Mp+gSQWT5jT3H4y8xrQ2c=; b=TemPJTyQirvubOQVp3MTVqgduToCHRC+WNtWDBd6YrW98l1Pd+GeF5AvIKJwKAnEFa yoWOuLxS2MA+6CX8FJxOiK2ys/TT5n4G6fkmV7xRVbBVqBss3vGasubJo06SqMRyMcEC rUAxNhjzINp1/H7KVCEMcIAtX29iO4FV0nKYYbflWw+F34Vnxre2juX4Xpw0AX/kfJQp SEBRqHX0rVUPuOmzT35UM+FwVicG7cWE0RYYldxgae5QjWiIMZeQCqQyxtkA1izVvi5s BYCSCPYJwBDLG3YCkSIY9ln+PCe3pj3SchbvdduAJ/OIKyStEpLtwlTuzqiZ4jIgo5Y2 3sQg== 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=oZYPzoCQS87jB7WmWdNUk0Mp+gSQWT5jT3H4y8xrQ2c=; b=SqyJr7rzoSEsJy/VxNroU+eSrhBhnlwPbqn8+k8r9+7tFc0MdE1D40VIDgmw+PY45O QSzRW0b03XdL2L39OeGHGBJCIbPW25c3hh27WVLDBHjtBeuu0DltlILNBhU6xrt7u/0c em9bZMDWlpBT3lsj+Mcbj3ywOlWdkgUU7UEeas2H7ONMVQDelE87QU+zhcRO1oNJonAg DSeWG4QMMNMyrAzMjOC6QVb2lPFDd8Iw85pAupbO6pyCmEtCwAbROhWIFzxqdyrzhqQF YUveDXlwAbDYr3YuLwUBFaNuvfB1wXnBv3hVY+L3VUTYpg7/8UTph+eMdUBUABvCC0JB HE1g== X-Gm-Message-State: AOAM531Dr2CVOFVYid1A1SYbuJZw6r8VWHCPEwclUH5oRnuY1xflnIgN qYENZz2b8z2+V8d6SPFrZCoPu9wMJ0o= X-Google-Smtp-Source: ABdhPJxtEqE1tM+WOJOAPCcFt+4coTsAHZiBsWq0FVUjYiDsAWrpBV0tiygByrlVKECbzjDzhh0yOg== X-Received: by 2002:a17:90a:a898:: with SMTP id h24mr2906137pjq.9.1615962331915; Tue, 16 Mar 2021 23:25:31 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (58-6-239-121.tpgi.com.au. [58.6.239.121]) by smtp.gmail.com with ESMTPSA id s19sm17959620pfh.168.2021.03.16.23.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Mar 2021 23:25:31 -0700 (PDT) From: Nicholas Piggin To: linux-mm@kvack.org, Andrew Morton Cc: Nicholas Piggin , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Jonathan Cameron , Christoph Hellwig , Christophe Leroy , Rick Edgecombe , Ding Tianhong , Christoph Hellwig Subject: [PATCH v13 10/14] mm/vmalloc: provide fallback arch huge vmap support functions Date: Wed, 17 Mar 2021 16:23:58 +1000 Message-Id: <20210317062402.533919-11-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210317062402.533919-1-npiggin@gmail.com> References: <20210317062402.533919-1-npiggin@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 169BDA0009DA X-Stat-Signature: ftyr37ijjbtiahsxufomdp13wmkoscyd Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mail-pj1-f49.google.com; client-ip=209.85.216.49 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615962332-378804 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: If an architecture doesn't support a particular page table level as a huge vmap page size then allow it to skip defining the support query function. Suggested-by: Christoph Hellwig Signed-off-by: Nicholas Piggin --- arch/arm64/include/asm/vmalloc.h | 7 +++---- arch/powerpc/include/asm/vmalloc.h | 7 +++---- arch/x86/include/asm/vmalloc.h | 13 +++++-------- include/linux/vmalloc.h | 24 ++++++++++++++++++++---- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/arch/arm64/include/asm/vmalloc.h b/arch/arm64/include/asm/vmalloc.h index fc9a12d6cc1a..7a22aeea9bb5 100644 --- a/arch/arm64/include/asm/vmalloc.h +++ b/arch/arm64/include/asm/vmalloc.h @@ -4,11 +4,8 @@ #include #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP -static inline bool arch_vmap_p4d_supported(pgprot_t prot) -{ - return false; -} +#define arch_vmap_pud_supported arch_vmap_pud_supported static inline bool arch_vmap_pud_supported(pgprot_t prot) { /* @@ -19,11 +16,13 @@ static inline bool arch_vmap_pud_supported(pgprot_t prot) !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS); } +#define arch_vmap_pmd_supported arch_vmap_pmd_supported static inline bool arch_vmap_pmd_supported(pgprot_t prot) { /* See arch_vmap_pud_supported() */ return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS); } + #endif #endif /* _ASM_ARM64_VMALLOC_H */ diff --git a/arch/powerpc/include/asm/vmalloc.h b/arch/powerpc/include/asm/vmalloc.h index 3f0c153befb0..4c69ece52a31 100644 --- a/arch/powerpc/include/asm/vmalloc.h +++ b/arch/powerpc/include/asm/vmalloc.h @@ -5,21 +5,20 @@ #include #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP -static inline bool arch_vmap_p4d_supported(pgprot_t prot) -{ - return false; -} +#define arch_vmap_pud_supported arch_vmap_pud_supported static inline bool arch_vmap_pud_supported(pgprot_t prot) { /* HPT does not cope with large pages in the vmalloc area */ return radix_enabled(); } +#define arch_vmap_pmd_supported arch_vmap_pmd_supported static inline bool arch_vmap_pmd_supported(pgprot_t prot) { return radix_enabled(); } + #endif #endif /* _ASM_POWERPC_VMALLOC_H */ diff --git a/arch/x86/include/asm/vmalloc.h b/arch/x86/include/asm/vmalloc.h index e714b00fc0ca..49ce331f3ac6 100644 --- a/arch/x86/include/asm/vmalloc.h +++ b/arch/x86/include/asm/vmalloc.h @@ -6,24 +6,21 @@ #include #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP -static inline bool arch_vmap_p4d_supported(pgprot_t prot) -{ - return false; -} +#ifdef CONFIG_X86_64 +#define arch_vmap_pud_supported arch_vmap_pud_supported 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 } +#endif +#define arch_vmap_pmd_supported arch_vmap_pmd_supported 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/include/linux/vmalloc.h b/include/linux/vmalloc.h index 4b897a4a408b..82b45e1f28ff 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -78,10 +78,26 @@ struct vmap_area { }; }; -#ifndef CONFIG_HAVE_ARCH_HUGE_VMAP -static inline bool arch_vmap_p4d_supported(pgprot_t prot) { return false; } -static inline bool arch_vmap_pud_supported(pgprot_t prot) { return false; } -static inline bool arch_vmap_pmd_supported(pgprot_t prot) { return false; } +/* archs that select HAVE_ARCH_HUGE_VMAP should override one or more of these */ +#ifndef arch_vmap_p4d_supported +static inline bool arch_vmap_p4d_supported(pgprot_t prot) +{ + return false; +} +#endif + +#ifndef arch_vmap_pud_supported +static inline bool arch_vmap_pud_supported(pgprot_t prot) +{ + return false; +} +#endif + +#ifndef arch_vmap_pmd_supported +static inline bool arch_vmap_pmd_supported(pgprot_t prot) +{ + return false; +} #endif /*