From patchwork Tue Feb 2 11:05:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 12061375 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 B67A9C433E9 for ; Tue, 2 Feb 2021 11:06:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5DD8D64DBA for ; Tue, 2 Feb 2021 11:06:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DD8D64DBA 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 F1F476B0082; Tue, 2 Feb 2021 06:06:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EAD196B0083; Tue, 2 Feb 2021 06:06:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFF446B0085; Tue, 2 Feb 2021 06:06:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id B8B3D6B0082 for ; Tue, 2 Feb 2021 06:06:26 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7FE441EE6 for ; Tue, 2 Feb 2021 11:06:26 +0000 (UTC) X-FDA: 77773049172.05.anger86_091736d275ca Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 601791802EF05 for ; Tue, 2 Feb 2021 11:06:26 +0000 (UTC) X-HE-Tag: anger86_091736d275ca X-Filterd-Recvd-Size: 7422 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Feb 2021 11:06:25 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id gx20so2147610pjb.1 for ; Tue, 02 Feb 2021 03:06:25 -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=lMXxcBBy/xQXQTcochNJF8nT4LcHlfjkVSMPRZcRaCo=; b=P9X0tKzPVh3X8icAkA+hrs7C0DhgEL50Q07jTDYcmvewtx+OuFtIlQkHhp+Af4lqCo Z0/AtcMXsrVmsDoPDxUmtW9HeLGSfabpLVwOv/gjYwFHjM5Z5NB6nNyzBymirEmQsdVT Ra4urJDJ00vmsU2WWPnBiLbSUqnDt1Qj6Ii+V9/jKOaavs2rMuyXCLJT43EbLiXpY5Az CkPMSrv5YsS8k+Bfce7KxucoIq6pP9X3hRLRet9R4bD+IbPEmrh7nfpEUg7TpuhU3TAz 8qsbQgqp5nnldr8ua8LJ4if+RjNtzRVcT1GRbzdvo9uSkqYpOT8mZXZ3Pc43Kc9jwQv6 ElFA== 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=lMXxcBBy/xQXQTcochNJF8nT4LcHlfjkVSMPRZcRaCo=; b=TrHnoNDvs/ymsjqBAGQjbdCF9ABvZb+d7Q52b7x21WoXPBKVRJ67zoVp5AqQ6DS7bg ylS+L4zXQRe2hDYd1Er3oxUK+t5VrjpmcGmZU1lQXGmly46R2lylwIPFmKHfd0rJN6Sf AoEUC0qRISSfGXjWOuOaLhs02anmWdHwBjmk0zka7AFri3FJIfc4xwtZ5wCT1YQa0jZU 7OBCBxKfsNuZ8WmoXAi1f7/a9MlMqS/jzNaITqQe81CpjwWp3gNnDI+1rI9gOE1lKPou cgOLsOH1He9QjOoqTnD+sa8HbS7hgw+xuv1iN9BL0WXBzHYwoPMpTdkHcuBvXo6PGWbP Xzeg== X-Gm-Message-State: AOAM531hRR+VfHxA7pakVQqe7U5l9Mt8uxVLYtYJDj3KFE9PHqIoxz3m cGk0i+jKuiCJxs2JdtdqFn9H8Mndo0g= X-Google-Smtp-Source: ABdhPJw/k7SH87TT2sZ2Wk1zP4IJUTV/dg8VBxSGnAUMlbRhuSf540ulyZxyUqtyvfARihfiitoXyA== X-Received: by 2002:a17:902:d510:b029:de:72a4:ebf1 with SMTP id b16-20020a170902d510b02900de72a4ebf1mr22189608plg.11.1612263985005; Tue, 02 Feb 2021 03:06:25 -0800 (PST) Received: from bobo.ozlabs.ibm.com (60-242-11-44.static.tpgi.com.au. [60.242.11.44]) by smtp.gmail.com with ESMTPSA id g19sm3188979pfk.113.2021.02.02.03.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 03:06:24 -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 , Christoph Hellwig Subject: [PATCH v12 10/14] mm/vmalloc: provide fallback arch huge vmap support functions Date: Tue, 2 Feb 2021 21:05:11 +1000 Message-Id: <20210202110515.3575274-11-npiggin@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210202110515.3575274-1-npiggin@gmail.com> References: <20210202110515.3575274-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: 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 Reported-by: kernel test robot --- 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 00bd62bd701e..9f7b8b00101b 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -83,10 +83,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 /*