From patchwork Tue Jan 26 04:45:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 12045217 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 C269CC43381 for ; Tue, 26 Jan 2021 04:46:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 70D7722B2C for ; Tue, 26 Jan 2021 04:46:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70D7722B2C 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 0D9608D0087; Mon, 25 Jan 2021 23:46:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0882F8D0076; Mon, 25 Jan 2021 23:46:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE09F8D0087; Mon, 25 Jan 2021 23:46:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id D7D968D0076 for ; Mon, 25 Jan 2021 23:46:37 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9E3BC180ACF9A for ; Tue, 26 Jan 2021 04:46:37 +0000 (UTC) X-FDA: 77746690434.26.jeans05_1a066d12758b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 76D3F1804B65A for ; Tue, 26 Jan 2021 04:46:37 +0000 (UTC) X-HE-Tag: jeans05_1a066d12758b X-Filterd-Recvd-Size: 5749 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Jan 2021 04:46:36 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id g15so1508721pjd.2 for ; Mon, 25 Jan 2021 20:46:36 -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=HXs4Cj6o6shYfoax70RVYzCwBDZMrsiR3W07FJlkL80=; b=em2ETLc2fmMNWMdsL7a3G9C/i2KTlvjJT7ObdcOF6dTxLJN4UJJF3wzgBFleaf53AT +brJms1nV0OiCanP6bfpsVN2ia/GEYy+ccuiWozVTDcWecdk0KIATFDQlZ39OQO0/Kca scrYlMQV+lAJAIB9Nn2lK939PFP+YnSMedpEA9aA4px/tOJFiwoTWEbBbyOawAP26zXh wc32fL8hdoqR6jPo3mfxcPbkjMa8tHoM9HdPHK8IlQugbRXoL2W3KKbknEvcp+iJvwfO XWld+RkeESUtoiUNVhst5HZrkyn0mPS0nb0LkOGND9BXhUfYdRrxZ0+bPEJXqchqshYh BCUA== 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=HXs4Cj6o6shYfoax70RVYzCwBDZMrsiR3W07FJlkL80=; b=OTZNWMOV9d8OzVe0Er7dX/c1XZU7oeQ2VDVvONQeYcUHOhlcsGeeTDXgzKTODKCEQR f0ElQSrksUPJ62Iv3XphgFceUjIz6u4QW7M52zz/oEK6wahMqZQi7E4htVKHNQ24l1Z4 u3P1Cj4BbGa4EBqjyU/y9DGHe3RtjhgUsXdOCGOHSXq+lmQReMImpli9LSjul0x91IX4 8a3bzPtwYYjDFCHbn+6kL/pi0FltjlHMJ/d4k5Bru0u3bBQVR5lyJRwzK0UT6+Pg/45R 2SAh54Mo5z93ZAKzMhyTlwg9nprR0id8YcwpBgKF3Oz/kZBr+xk5UebAOTEkwnT+QniM nybQ== X-Gm-Message-State: AOAM532I23ODi2UDj5rSJZhirNyJXOIpO6udf7zlPyxMVk2/ywe9B0s0 TN/C5GZ3uNfG9g/3jNb4ZCHeivsMKa0= X-Google-Smtp-Source: ABdhPJx2FC7TaGsOZdYSD6/GYNfkxxHgUEWaT66Dp7jYgo96FrqrcmfF5Lm5CEJMTTzSqN0js60PAw== X-Received: by 2002:a17:90b:1b50:: with SMTP id nv16mr3816102pjb.153.1611636396072; Mon, 25 Jan 2021 20:46:36 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 20:46:35 -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 Subject: [PATCH v11 13/13] powerpc/64s/radix: Enable huge vmalloc mappings Date: Tue, 26 Jan 2021 14:45:10 +1000 Message-Id: <20210126044510.2491820-14-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: Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Nicholas Piggin Acked-by: Michael Ellerman --- .../admin-guide/kernel-parameters.txt | 2 ++ arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/module.c | 21 +++++++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a10b545c2070..d62df53e5200 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3225,6 +3225,8 @@ nohugeiomap [KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings. + nohugevmalloc [PPC] Disable kernel huge vmalloc mappings. + nosmt [KNL,S390] Disable symmetric multithreading (SMT). Equivalent to smt=1. diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 107bb4319e0e..781da6829ab7 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -181,6 +181,7 @@ config PPC select GENERIC_GETTIMEOFDAY select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU + select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14 select HAVE_ARCH_KASAN_VMALLOC if PPC32 && PPC_PAGE_SHIFT <= 14 diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c index a211b0253cdb..07026335d24d 100644 --- a/arch/powerpc/kernel/module.c +++ b/arch/powerpc/kernel/module.c @@ -87,13 +87,26 @@ int module_finalize(const Elf_Ehdr *hdr, return 0; } -#ifdef MODULES_VADDR void *module_alloc(unsigned long size) { + unsigned long start = VMALLOC_START; + unsigned long end = VMALLOC_END; + +#ifdef MODULES_VADDR BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); + start = MODULES_VADDR; + end = MODULES_END; +#endif + + /* + * Don't do huge page allocations for modules yet until more testing + * is done. STRICT_MODULE_RWX may require extra work to support this + * too. + */ - return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, GFP_KERNEL, - PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE, + return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL, + PAGE_KERNEL_EXEC, + VM_NO_HUGE_VMAP | VM_FLUSH_RESET_PERMS, + NUMA_NO_NODE, __builtin_return_address(0)); } -#endif