Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1031770pxb; Fri, 21 Jan 2022 08:28:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPZncxa49tzpL+WvqlRE1haTeX1e4of0R03RHvNd/6iDGwBfgoe8cTa2URJYSiUg/+q9Ss X-Received: by 2002:a17:90a:e17:: with SMTP id v23mr1550411pje.130.1642782495075; Fri, 21 Jan 2022 08:28:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642782495; cv=none; d=google.com; s=arc-20160816; b=TFB+SKVwkOFwpbt9Ae9og66EbQ/ptlaoEfSKEEAz8CpZJeFMb0VqvN3bH6OEN3qsEN 0b4ZHhV6ojZ80eqCNRbN6js1bQY1Sw6v6STbx7itatp2itgSb13wPrPT6kAI/cse9TZL C79fld7yP93/Z4eiwFzv01LFT5e63TFheJ9XQG1lP3xBXul6++JjeRDozLLlEhp1k4v2 amL73Nk0cBreb6spOOdQlOB3b5qCl6jy3mgBjcanaZtWr9wVc5AfjJMAGKqOrqRKrQ4a Cir4+ApMCXGvKo6WZbbDbhUkGPAnATJYdkmiZPUDTpGWwCj/0gojPXKMvVck4B5P2yhv FGnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=AKF/m4crRjUPKaEVyR47iJWpF9556rhB20qICdT0XMw=; b=IfyXUS2cd6LxZneACV0JScjEIY7qSey2QQWeMS6mMq4sppGr0PkBrkglQ3AyIGqfOr qTYQC528Su1TBWBQw5Yt6WbyfOSY8YhtaaUacWnCq5LcRY/VbwwDxXysRn/D6/Lhy5Gq UaA6g/t4xTo1i3eMIux5BM2wUobWU0+X+G+AKo4jQKivOmOVS6Zz4EHVkv4tvfaa+r0L k+AXJe8vGbriwFPG9tv/kga/7Wx+A+QS/XgdGQ8yCmqGq7qW2MNn/qRiGnB7t4pQCK9j UG4lBdo1X8DRu2MlOVMqFJI+phFKofMcDPirB3eAOL99CgzQyn9GNYkyOHv1MGxUi8ap FArg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gAmqQ4rY; 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 l64si4653271pge.871.2022.01.21.08.28.02; Fri, 21 Jan 2022 08:28:15 -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=20210112 header.b=gAmqQ4rY; 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 S1346487AbiASERp (ORCPT + 99 others); Tue, 18 Jan 2022 23:17:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235242AbiASERo (ORCPT ); Tue, 18 Jan 2022 23:17:44 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8D0AC061574; Tue, 18 Jan 2022 20:17:43 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id m8-20020a17090a4d8800b001b4f361964fso1373593pjh.3; Tue, 18 Jan 2022 20:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=AKF/m4crRjUPKaEVyR47iJWpF9556rhB20qICdT0XMw=; b=gAmqQ4rYYDr653fs21as+JGb8WVc3EmyhbYjx0q2IQ5dWwJZKJ4GnqrquUtrvSB9OB yrB2KyU4M340MMrv250jTVTm9egqTgMtoitKsWrnZig7xF0hOskKydBZPGefcGE0csbP AiWdymunWo98bs9atvLMSPnGTL+cKj+CVfnPBiHWx4Exxb8VTZv3RGeCwPszEkMQiHOl 7RVADXLKYlCe8CIcbja61x2w0JRXJUjn5z1wkaIVivzwlVoMaedV2Yu12vPxNe4yUID6 AI9KiKUKOHS2QOSPlOzLqKoMbfHEMjJecKbks82ZSv6NLKRWAaGowwlsYIP1sXYCr2Nk XDhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=AKF/m4crRjUPKaEVyR47iJWpF9556rhB20qICdT0XMw=; b=zZekgZJ11lWQ3RsoWrRewO5IAPPZ2rW7l93c2S51mXNUBf/SkOEAO0Ifb1oOcJezxr sOhrtGhLMB2pj4npCxy/52wxrEUJ+UIsiXUHxkTzd5COs2MuIl94nPLmjjd/WZi45ETV c68wzD+IuAL8dMBArMiFK88QQ3bkzKLRR+zkZUPzogdK1cjZ5Odp0O7cuKe8SQLRQIPk NLhuSs9Y8dKbQ7v3AnAHyh0T2N7VBdTdCfVANJz+2TJrcgEdiCUufOhqmk9ORFYUvSiE qkK75qHQYwwRp0rsop+vxczZrFhdvXnOAF00VqDjvx6gx/6ABHMEYu4A9pePTxtJmRpM LH4Q== X-Gm-Message-State: AOAM532/FSglE71MJ8tHlOqviQEQ9a7bNeOFT6fDg9s8dLV7pkmHDsni cfsbWwl0eHi+43juY/fyd+Y= X-Received: by 2002:a17:902:6b89:b0:149:7aa8:d98c with SMTP id p9-20020a1709026b8900b001497aa8d98cmr30797727plk.72.1642565863190; Tue, 18 Jan 2022 20:17:43 -0800 (PST) Received: from localhost (193-116-82-75.tpgi.com.au. [193.116.82.75]) by smtp.gmail.com with ESMTPSA id n5sm18226822pfo.39.2022.01.18.20.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 20:17:42 -0800 (PST) Date: Wed, 19 Jan 2022 14:17:37 +1000 From: Nicholas Piggin Subject: Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings To: Andrew Morton , Jonathan Corbet , Dave Hansen , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Kefeng Wang , x86@kernel.org Cc: Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Michael Ellerman , Paul Mackerras , Thomas Gleixner , Will Deacon , Matthew Wilcox References: <20211227145903.187152-1-wangkefeng.wang@huawei.com> <20211227145903.187152-4-wangkefeng.wang@huawei.com> <70ff58bc-3a92-55c2-2da8-c5877af72e44@intel.com> <3858de1f-cdbc-ff52-2890-4254d0f48b0a@huawei.com> <31a75f95-6e6e-b640-2d95-08a95ea8cf51@intel.com> <1642472965.lgfksp6krp.astroid@bobo.none> <4488d39f-0698-7bfd-b81c-1e609821818f@intel.com> In-Reply-To: <4488d39f-0698-7bfd-b81c-1e609821818f@intel.com> MIME-Version: 1.0 Message-Id: <1642565468.c0jax91tvn.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Dave Hansen's message of January 19, 2022 3:28 am: > On 1/17/22 6:46 PM, Nicholas Piggin wrote: >>> This all sounds very fragile to me. Every time a new architecture woul= d >>> get added for huge vmalloc() support, the developer needs to know to go >>> find that architecture's module_alloc() and add this flag. >> This is documented in the Kconfig. >>=20 >> # >> # Archs that select this would be capable of PMD-sized vmaps (i.e., >> # arch_vmap_pmd_supported() returns true), and they must make no assum= ptions >> # that vmalloc memory is mapped with PAGE_SIZE ptes. The VM_NO_HUGE_VM= AP flag >> # can be used to prohibit arch-specific allocations from using hugepag= es to >> # help with this (e.g., modules may require it). >> # >> config HAVE_ARCH_HUGE_VMALLOC >> depends on HAVE_ARCH_HUGE_VMAP >> bool >>=20 >> Is it really fair to say it's *very* fragile? Surely it's reasonable to=20 >> read the (not very long) documentation ad understand the consequences fo= r >> the arch code before enabling it. >=20 > Very fragile or not, I think folks are likely to get it wrong. It would > be nice to have it default *everyone* to safe and slow and make *sure* It's not safe to enable though. That's the problem. If it was just=20 modules then you'd have a point but it could be anything. > they go look at the architecture modules code itself before enabling > this for modules. This is required not just for modules for the whole arch code, it has to be looked at and decided this will work. > Just from that Kconfig text, I don't think I'd know off the top of my > head what do do for x86, or what code I needed to go touch. You have to make sure arch/x86 makes no assumptions that vmalloc memory is backed by PAGE_SIZE ptes. If you can't do that then you shouldn't=20 enable the option. The option can not explain it any more because any arch could do anything with its mappings. The module code is an example, not the recipe. Thanks, Nick