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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B64B7C433F5 for ; Wed, 19 Jan 2022 04:17:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F37796B0071; Tue, 18 Jan 2022 23:17:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE6B96B0073; Tue, 18 Jan 2022 23:17:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAE696B0074; Tue, 18 Jan 2022 23:17:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id CA2BD6B0071 for ; Tue, 18 Jan 2022 23:17:44 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 74864181E8E9E for ; Wed, 19 Jan 2022 04:17:44 +0000 (UTC) X-FDA: 79045728048.15.E4A7166 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf01.hostedemail.com (Postfix) with ESMTP id 2543140004 for ; Wed, 19 Jan 2022 04:17:44 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so1431327pjp.0 for ; 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=ggdFLPWb/x/cBN6Jgeoyvbbt5DmiUAo6EdfD8i3xfOHtm0xU4jHwyIehNkVsUbvINS PkeXk4G1q1cH0oc75g5niweIHIX0AGAwh1Q5Jnik4Xj3ThnZcGEE51u3olqshQACALkA kk/NbuT8QsFnxbZQ+iMLzENXgKEZYYJXV/8GNhAKdk4X+eeUlxdrHFXll8PGncGHRZ6V jbRKczcWIf3UHYpeScH+O6ot4Jk3wBDw4lyU3CMFQC3WgCxcED5asC3cYpDBLiYCEnsf 6ZW0ogGQMWHZqOGS9V2zDVjaguo6DI3bO//eGIqPqL1E0bcewOcDyu0d3YWHSFJ1kXT7 UmXQ== X-Gm-Message-State: AOAM533ofqMDNGOSMsZ6onnx9ncUcwLjyTVtvGAepYv3uBrT7CLDMoy2 iSKIFnALDZiE40hmyQHWwrs= X-Google-Smtp-Source: ABdhPJx3OvhLmFtcmBgPOWtTOgtFz5eNT+qAc0Hg/uqwpDFNuWOOlw66tKXtoYn5ZRQ3+6wnEZ9b/A== 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 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 2543140004 X-Stat-Signature: sjnusxc8tg99ps7759capuyufycfmhpz Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=gAmqQ4rY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf01.hostedemail.com: domain of npiggin@gmail.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=npiggin@gmail.com X-HE-Tag: 1642565864-56933 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: 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