Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp206210pxb; Tue, 2 Feb 2021 03:10:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB4pS0l58GwtKRKZqCfnlWRYq3sm3ZvBzp2cQQZ0OoLUUxgKJrE4aZxMVfRc97Gg4fsHJn X-Received: by 2002:a17:906:ace:: with SMTP id z14mr22078099ejf.53.1612264229048; Tue, 02 Feb 2021 03:10:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612264229; cv=none; d=google.com; s=arc-20160816; b=qy7dWpUUTsdB2WlnRnZfOlJotYA7f3r4C+8qTlZ25cEfDcrbdhbypxlWgRYQnvswUB 3Nz3QcJbbo/St/YlOzfd6dOiJy1m+EThpN9Pt+T69lnCiMuAcJaNBMv5rsIbRTYbbIcH Jn8eNGjGm7TLunaJWc0XgIc4mpPVoFZt+PYHKFwAro0u3AuwUesrJkGULEmVtn817KXj IZPJSVJuxaradQeIiPjhNvYhF5csIhfmoee7tdC6WLijkt6B33fSK5wXcu+xXQ+1xn8e J42jeswaMBCTL08iMtvCFdJUgcTiOcCQs1oDSrlOqO4qINYN9MzeDX3fCNTw9wF2eHV8 8jGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lMXxcBBy/xQXQTcochNJF8nT4LcHlfjkVSMPRZcRaCo=; b=DmUuhnzpmiBKtVayl5WBkCmmbOp8dO4c2FlQtDtoqbqH+z3y6cXvwd/ZgGSymngWRn 1q7ppIOyH+PimRzAj2Us7aiuL8/xiY6uj7Svbfswn2j/UcjWRGVgFUSj+/x/CFTNtEJM CwYJwj4wGAjcDqCGcx6k0mi068CsXpVI6ClPB1PGHHEL8HduZJ466vtueqOmsUOt9xog vVn1xznZdvOtXW/TzIEwfL0ryzNp2Btt0ifo4dJMPWiHZq2jZ4koQngjt3uyhP6SXp4f UMBdMOiBY3U+EJO4LD7Rgl77dkPls2XReqoFbFk5slaeZpk8SpRbYvkorGLqlmFfPlFO KPAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P9X0tKzP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si12125108eje.528.2021.02.02.03.10.04; Tue, 02 Feb 2021 03:10:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P9X0tKzP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229624AbhBBLIe (ORCPT + 99 others); Tue, 2 Feb 2021 06:08:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230168AbhBBLHF (ORCPT ); Tue, 2 Feb 2021 06:07:05 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E9FDC06174A; Tue, 2 Feb 2021 03:06:25 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id l18so2137419pji.3; 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=RaLS6UmFZOP+wSGS/0y0L0wVEqcvJDbReywGQ+u3CwOavaYDJKNcHH8fCtKPCiRRCF vGYbn/efzCjIoCn+UT5L4HdKi6Fjwh5thU8V1U8UfLqrgdgVUDWA4DBP/nuqIzLx/NJ+ JQxiGNh4WQDk+LqwEs5t6mm3C/SoHsitcc+/AsC/ns5rf48Ukd2G2v6VppgUSt5wlfb5 ZkRlU/QEjp4ClLV/3+jLwBbvgeyQ1q1qgNDVzBlZ+8YGC4qZU9/32ON98rnxgWbPu6bu 033w3Zi4StIUWk8KVTGSUS+JmxC2ikt0CUV+MQMc9xKXGTQeFABHa6GgH+3CkVdoFaB3 hMig== X-Gm-Message-State: AOAM533x1Qeojrj4dGP0p4RI01VbTklVekb2R3v++/hsqEWUN2aBswgJ lHXTgczB1upoLfEw5eGUw8I= 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 /* -- 2.23.0