From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1811C433F5 for ; Mon, 27 Dec 2021 16:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231630AbhL0QAi (ORCPT ); Mon, 27 Dec 2021 11:00:38 -0500 Received: from mga14.intel.com ([192.55.52.115]:52627 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240030AbhL0P7y (ORCPT ); Mon, 27 Dec 2021 10:59:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640620794; x=1672156794; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=Qopi0GCbZb8D3tqnGHATwO1hv9M0cdIa+FRZv6opEto=; b=CU7xhaTCZMByetb9EFG7yF6dptQXGhV3L0pWaETGBguZOWK8W7RDHPEZ zvQts/HJU9I/awVwlb0/hKps6dvPMUaUbEpsH52qDvMIgMmUOZqCqoTno PCk/ho5pdC1eIHfTira04eIFe+0AMkkccWr5VUFdn40oSdfiH6SvxRPVl Fzfbh1jlKEmmYWCEU3T2j7G9jKIeCd5DqwOlicD3KJ5BJJu4pjL9PoXp0 oS8YUPjIwET4qHaK/aB73DrpW2qqflM26pVMJQfce6UjIAxOrcluUN3MQ ZxRtcM8Iiq1ZJeqNJWQ4oVmP7NfOtk6UkV/iL+7pBNcjkSzdXnPGtMPx9 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10209"; a="241441778" X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="241441778" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:17 -0800 X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="486053937" Received: from dannysua-mobl2.amr.corp.intel.com (HELO [10.212.232.47]) ([10.212.232.47]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:16 -0800 Subject: Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings To: Kefeng Wang , Jonathan Corbet , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org Cc: Nicholas Piggin , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Christophe Leroy , Matthew Wilcox References: <20211227145903.187152-1-wangkefeng.wang@huawei.com> <20211227145903.187152-4-wangkefeng.wang@huawei.com> From: Dave Hansen Message-ID: <70ff58bc-3a92-55c2-2da8-c5877af72e44@intel.com> Date: Mon, 27 Dec 2021 07:56:14 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211227145903.187152-4-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 12/27/21 6:59 AM, Kefeng Wang wrote: > This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE > support huge vmalloc mappings. In general, this seems interesting and the diff is simple. But, I don't see _any_ x86-specific data. I think the bare minimum here would be a few kernel compiles and some 'perf stat' data for some TLB events. > diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c > index 95fa745e310a..6bf5cb7d876a 100644 > --- a/arch/x86/kernel/module.c > +++ b/arch/x86/kernel/module.c > @@ -75,8 +75,8 @@ void *module_alloc(unsigned long size) > > p = __vmalloc_node_range(size, MODULE_ALIGN, > MODULES_VADDR + get_module_load_offset(), > - MODULES_END, gfp_mask, > - PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, > + MODULES_END, gfp_mask, PAGE_KERNEL, > + VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, NUMA_NO_NODE, > __builtin_return_address(0)); > if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { > vfree(p); To figure out what's going on in this hunk, I had to look at the cover letter (which I wasn't cc'd on). That's not great and it means that somebody who stumbles upon this in the code is going to have a really hard time figuring out what is going on. Cover letters don't make it into git history. This desperately needs a comment and some changelog material in *this* patch. But, even the description from the cover letter is sparse: > There are some disadvantages about this feature[2], one of the main > concerns is the possible memory fragmentation/waste in some scenarios, > also archs must ensure that any arch specific vmalloc allocations that > require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX) > use the VM_NO_HUGE_VMAP flag to inhibit larger mappings. That just says that x86 *needs* PAGE_SIZE allocations. But, what happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)? Will the subsequent permission changes just fragment the 2M mapping? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 387FEC433F5 for ; Mon, 27 Dec 2021 15:58:08 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JN2Pp4hwWz3c5q for ; Tue, 28 Dec 2021 02:58:06 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=jisFFYjc; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=intel.com (client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=dave.hansen@intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=jisFFYjc; dkim-atps=neutral Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JN2P149Hjz2yRf for ; Tue, 28 Dec 2021 02:57:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640620645; x=1672156645; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=Qopi0GCbZb8D3tqnGHATwO1hv9M0cdIa+FRZv6opEto=; b=jisFFYjcsMFGdhcNtR6u3V8vWmG643xpIVaBOx7i29GmKMFyYXdZzlPZ d/zNYbpzJxkO62/Jva0fgv5p5bSkNqhr4f3fkuSMyltE0JRe7muoNQBet r2wViAInfNYk0GeBnH9QrnQ98wjd79vd7Zyi0Ou+ItieRXlWlQZfEmkvS jfVd1GqoJlCWXF8MJARfkFVkyNF4LUzuSggsrDH0+TFB1Ya4U85/il4NR smHL+cN5qIc7qWtyCEGomJ0jlSXnK3B13/oEC3srqICZdk3Dmyif/NQnO xIia6Xn8xnn1bpcmA/OS55nQ/7imfJDBNWMvojWNiL+l8JOpwaYxLbBoZ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10209"; a="327552172" X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="327552172" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:17 -0800 X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="486053937" Received: from dannysua-mobl2.amr.corp.intel.com (HELO [10.212.232.47]) ([10.212.232.47]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:16 -0800 Subject: Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings To: Kefeng Wang , Jonathan Corbet , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org References: <20211227145903.187152-1-wangkefeng.wang@huawei.com> <20211227145903.187152-4-wangkefeng.wang@huawei.com> From: Dave Hansen Message-ID: <70ff58bc-3a92-55c2-2da8-c5877af72e44@intel.com> Date: Mon, 27 Dec 2021 07:56:14 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211227145903.187152-4-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Wilcox , Catalin Marinas , Dave Hansen , Nicholas Piggin , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Paul Mackerras , Thomas Gleixner , Will Deacon Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 12/27/21 6:59 AM, Kefeng Wang wrote: > This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE > support huge vmalloc mappings. In general, this seems interesting and the diff is simple. But, I don't see _any_ x86-specific data. I think the bare minimum here would be a few kernel compiles and some 'perf stat' data for some TLB events. > diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c > index 95fa745e310a..6bf5cb7d876a 100644 > --- a/arch/x86/kernel/module.c > +++ b/arch/x86/kernel/module.c > @@ -75,8 +75,8 @@ void *module_alloc(unsigned long size) > > p = __vmalloc_node_range(size, MODULE_ALIGN, > MODULES_VADDR + get_module_load_offset(), > - MODULES_END, gfp_mask, > - PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, > + MODULES_END, gfp_mask, PAGE_KERNEL, > + VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, NUMA_NO_NODE, > __builtin_return_address(0)); > if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { > vfree(p); To figure out what's going on in this hunk, I had to look at the cover letter (which I wasn't cc'd on). That's not great and it means that somebody who stumbles upon this in the code is going to have a really hard time figuring out what is going on. Cover letters don't make it into git history. This desperately needs a comment and some changelog material in *this* patch. But, even the description from the cover letter is sparse: > There are some disadvantages about this feature[2], one of the main > concerns is the possible memory fragmentation/waste in some scenarios, > also archs must ensure that any arch specific vmalloc allocations that > require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX) > use the VM_NO_HUGE_VMAP flag to inhibit larger mappings. That just says that x86 *needs* PAGE_SIZE allocations. But, what happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)? Will the subsequent permission changes just fragment the 2M mapping? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9C79C433EF for ; Mon, 27 Dec 2021 15:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5b2YHwcNUwXaOx3PJBiFXLnaOkO3ySyz+axaqb53PGw=; b=Cq3N1gChh7P+1foO2Sd3isz0BC xeFqMGigPaCJlKlcPBLo9KrZsaZ0ednBzHFznMOZTjgmBSZO62LwkpzvqgFYynSzUaHl3tr0aPV4B bl7yBvozwiFaqWInZypOZNmjyUnFv5e90rAvXbDvf9Ndfd7Nt40morqI5OQ9pnmoR7tPeRHTWSfLz tGTDHJTzIQlmOliuDgPpkYSoBBmQPUuPt1NBIpH/dKX731rVa3spPt7C1z9xrB/S3unxOMPCnoLy1 WXx3WpKMs0J2ZX5pZ/qfuhdFVg7ne6cS/KuJatFVDofioDEqJuNDngiswap2cigF9IWy9jKTJyP5r IwUxQgNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1sMI-00GwMZ-JQ; Mon, 27 Dec 2021 15:56:22 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1sMF-00GwLy-2V for linux-arm-kernel@lists.infradead.org; Mon, 27 Dec 2021 15:56:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640620579; x=1672156579; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=Qopi0GCbZb8D3tqnGHATwO1hv9M0cdIa+FRZv6opEto=; b=mA8JfAq98MSebpNPd0N25WbtomnvUi1gC0reSgwWY4TI2gyIznp0zNnA rrOWPkXPRH17919M9Myv716HGM6710j2y+lvU5GiqVS6iVSo/6b7sgu+m qbAJpAL2ZtcdQGi2buoJs8Z8ph0RGOq/SJpabv3jsc1gfN5cMIeg1oy5X c+QnCkPxTbaB1GQYchX4qfunQNSKh7guYNdOWVI/o/YsVb4YKltWZQjJt E9puXvXcARsoVVmjkhpQJ10jMxlkeA3EGVFCBVb6l4ZUIGwqKeced2XbW FL0gDUnXyVB7lrVWH0Y0m+3iPqmm2AdBiRso+Lf5pK0HAy2QE6/UpchKJ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10209"; a="304585208" X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="304585208" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:17 -0800 X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="486053937" Received: from dannysua-mobl2.amr.corp.intel.com (HELO [10.212.232.47]) ([10.212.232.47]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:16 -0800 Subject: Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings To: Kefeng Wang , Jonathan Corbet , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org Cc: Nicholas Piggin , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Christophe Leroy , Matthew Wilcox References: <20211227145903.187152-1-wangkefeng.wang@huawei.com> <20211227145903.187152-4-wangkefeng.wang@huawei.com> From: Dave Hansen Message-ID: <70ff58bc-3a92-55c2-2da8-c5877af72e44@intel.com> Date: Mon, 27 Dec 2021 07:56:14 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211227145903.187152-4-wangkefeng.wang@huawei.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211227_075619_225891_30C9B0DD X-CRM114-Status: GOOD ( 22.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/27/21 6:59 AM, Kefeng Wang wrote: > This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE > support huge vmalloc mappings. In general, this seems interesting and the diff is simple. But, I don't see _any_ x86-specific data. I think the bare minimum here would be a few kernel compiles and some 'perf stat' data for some TLB events. > diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c > index 95fa745e310a..6bf5cb7d876a 100644 > --- a/arch/x86/kernel/module.c > +++ b/arch/x86/kernel/module.c > @@ -75,8 +75,8 @@ void *module_alloc(unsigned long size) > > p = __vmalloc_node_range(size, MODULE_ALIGN, > MODULES_VADDR + get_module_load_offset(), > - MODULES_END, gfp_mask, > - PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, > + MODULES_END, gfp_mask, PAGE_KERNEL, > + VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, NUMA_NO_NODE, > __builtin_return_address(0)); > if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { > vfree(p); To figure out what's going on in this hunk, I had to look at the cover letter (which I wasn't cc'd on). That's not great and it means that somebody who stumbles upon this in the code is going to have a really hard time figuring out what is going on. Cover letters don't make it into git history. This desperately needs a comment and some changelog material in *this* patch. But, even the description from the cover letter is sparse: > There are some disadvantages about this feature[2], one of the main > concerns is the possible memory fragmentation/waste in some scenarios, > also archs must ensure that any arch specific vmalloc allocations that > require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX) > use the VM_NO_HUGE_VMAP flag to inhibit larger mappings. That just says that x86 *needs* PAGE_SIZE allocations. But, what happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)? Will the subsequent permission changes just fragment the 2M mapping? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel