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 D2A53C52D7B for ; Tue, 13 Aug 2024 12:50:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69D6C6B0089; Tue, 13 Aug 2024 08:50:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6269E6B0095; Tue, 13 Aug 2024 08:50:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 49FF06B0098; Tue, 13 Aug 2024 08:50:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 27F066B0089 for ; Tue, 13 Aug 2024 08:50:13 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9984AA07F9 for ; Tue, 13 Aug 2024 12:50:12 +0000 (UTC) X-FDA: 82447205064.03.98B4575 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by imf05.hostedemail.com (Postfix) with ESMTP id 3DA0910000B for ; Tue, 13 Aug 2024 12:50:09 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=ellerman.id.au header.s=201909 header.b=MbcVogWx; dmarc=none; spf=pass (imf05.hostedemail.com: domain of mpe@ellerman.id.au designates 150.107.74.76 as permitted sender) smtp.mailfrom=mpe@ellerman.id.au ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723553358; a=rsa-sha256; cv=none; b=rJXMAEscrOnZg/jYX5ybxoIbLt3VJUhb83Lslq26ogNlddrO2sCHEpEr8s12VaKBoX1D3V nFNR+XSYiLQOoJOnyrgca8oWlxBix02JPFGDhPUpn+bFmqF6DzkQWD+wU5erYeryT1B6NC BaGHeplRuavCyoT5FnpNK8bXGUe3140= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=ellerman.id.au header.s=201909 header.b=MbcVogWx; dmarc=none; spf=pass (imf05.hostedemail.com: domain of mpe@ellerman.id.au designates 150.107.74.76 as permitted sender) smtp.mailfrom=mpe@ellerman.id.au ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723553358; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3JTj5OrR4YCVo4xbpaM1+3vNhDyPwwq6JrLH7UwwKog=; b=03uFJOqYblYaoDMEMAeQV+H6eAEdWD1T+OeJ4pyUsLuSPHFdr7e6k8X/r7lXNNF+DwfJGc V5/aQbDW0XvjeBjP3v0w9HBB2ByQb2/mvTE2UAFiDdQX6mBzion25gyIftErZr1kdcF59T 8Pm1c/HjCeHe6pkB+q8vcAEyVQTPjU8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1723553406; bh=3JTj5OrR4YCVo4xbpaM1+3vNhDyPwwq6JrLH7UwwKog=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MbcVogWxm8B5kX2RxPVpBX6D+wT9QM6+TJf/xnYyEoTtHe/IusCt0b/jFusolJoDh 69bhGuVRAKsCELkguiBlzmEIyZu25DdDEpIGBUKl2LcHP6PvN6luAO1CYP04pxOu6R DYI8rd+STVQGe/6xBr9v8PjCwKW5vwCiVa89qYHjvOCy2OGHx7Qgicx7dP6plDnGZf ToDdNthdsM7avYVQ5oy3Py/CihGgg9iuqSfc9a6Hrc6kffElUkjx1YcC6tp6MLAnqF e4n04wp7/z+y0GD5e1MTOSLc/ShjXhJjB+gk8TbT/H6VM9w9OicIGpOc7pO8VvahIr +h5kFkHW0SgEw== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Wjrnm3Rq6z4w2R; Tue, 13 Aug 2024 22:50:04 +1000 (AEST) From: Michael Ellerman To: Peter Xu , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: "Kirill A . Shutemov" , Nicholas Piggin , David Hildenbrand , Matthew Wilcox , Andrew Morton , James Houghton , Huang Ying , "Aneesh Kumar K . V" , peterx@redhat.com, Vlastimil Babka , Rick P Edgecombe , Hugh Dickins , Borislav Petkov , Christophe Leroy , Rik van Riel , Dan Williams , Mel Gorman , x86@kernel.org, Ingo Molnar , linuxppc-dev@lists.ozlabs.org, Dave Hansen , Dave Jiang , Oscar Salvador , Thomas Gleixner Subject: Re: [PATCH v5 0/7] mm/mprotect: Fix dax puds In-Reply-To: <20240812181225.1360970-1-peterx@redhat.com> References: <20240812181225.1360970-1-peterx@redhat.com> Date: Tue, 13 Aug 2024 22:50:04 +1000 Message-ID: <87plqc1tab.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: 3DA0910000B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: nf53go61gz1w4r5mpo7wockw1q888c7u X-HE-Tag: 1723553409-667640 X-HE-Meta: U2FsdGVkX1+UEDolNT9qG8mAW9X3klzLbfbysQy1exby1b5XhmdRDpq/XHWjkxbpQGEn/116+Bv4247y9T/NKu4BQEU6TketUDCCWt4wca9LtWvQTnre/SfsrzbY6iixnUPi+20Y681wOUZMOkCJexcyDMYGUjpWMizzs2h3gLnIuujpU2QNszjF0wl4cANQ6ahZIKNK7Rggw9R/cnDCp89ranr/IBV/4SWPSI2maoW8RJxd2V3VR/258PCd975Nw7YB4+IWx+jMz+ZieGIm4DBOSYx+uszkpursc73Yhu7yMPu9CDrV3y0WPO20aY7av6yhBtbJCcfdnnPZ/ELRNrZw3tLuzqkv7QQ5JQ1ESl2o74fwX62Kq+A3zFl02Ryy4TIn0brut6AIyQypHqQ7Jk9M5SUMPv13yGYvFZkxW/kRjDMlcV/jplbEbcsbMuVqa3cCjosM8U6AIr3y0sNJyxhdHMEAS9a7R9DOA6ycgqxPnXA8cT1//H8WT/tllNtXPbRmxq9bWy9+m8b24BYtjvKQyVhV5xl7+Wbi/E4mYkB8zb2DyPEveA5et51LfBRh+Ha0heFIx3sy1PQ0t+pHTpMmih4Kr9x3SHBVHmbNKr3ZHTgl++WO2eIEEcwsQC172H9+f0q7l/Dvc4FH/I6adY72/Wy58o8IBWelcMqes2E1XYVYmaFAiWskI7cDKgS2zc4TICS+J/JI0iKV9kSeEtFZErTW262TGxXuZr4nZIphZPWsYI/LqocKmIvakJYa9aLwxL7/M/CnY1WdeXWdWmtasCMe5/xszp8Te07tlIIhwmjVQbpX6OI3AbhNnVB9BrzEi+ZWZPDStb/XLyrRHnZzOc4Pm5OCByAIUx09Dhy87zrZwE9Ycys3bVSX2eXg6pW7LZJ75/HLvSEiqBoqxzvt0Q+tUh96ueyg9l0wpnPSSKCxfq+4zo7jhB9QhRJ0aoA/kBMkAKleDNPALAI jXywNY3E JQbKLCytxev4gWvOdLyEB2Q82rISHvD/xWQhlbPcI8RItk8i71WOnzBV56fdkQqLEY6nuwPhPbaM0fUwo9anoZgP62Hwj6OiGjBKMKJJIF4F13emZ2VyjE5BieK8NJARV31imniCAJi2mWpD/u7wnuQFlRxd+044FVCcfA2nVxL5PPmNXMXDiiB1j0+wkPTBV6gXEQoxGLcyixxttOYt8JyUtY+hqKwlaZYY2pEUFPisgNMiKVbHu/UmHIYcqka1Mcy7xvySFgmq7mxg= 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: List-Subscribe: List-Unsubscribe: Peter Xu writes: > [Based on mm-unstable, commit 98808d08fc0f, Aug 7th. NOTE: it is > intentional to not have rebased to latest mm-unstable, as this is to > replace the queued v4] > > v5 Changelog: > - Rename patch subject "mm/x86: arch_check_zapped_pud()", add "Implement" [tglx] > - Mostly rewrote commit messages for the x86 patches, follow -tip rules [tglx] > - Line wrap fixes (to mostly avoid newlines when unnecessary) [tglx] > - English fixes [tglx] > - Fix a build issue only happens with i386 pae + clang > https://lore.kernel.org/r/202408111850.Y7rbVXOo-lkp@intel.com > > v1: https://lore.kernel.org/r/20240621142504.1940209-1-peterx@redhat.com > v2: https://lore.kernel.org/r/20240703212918.2417843-1-peterx@redhat.com > v3: https://lore.kernel.org/r/20240715192142.3241557-1-peterx@redhat.com > v4: https://lore.kernel.org/r/20240807194812.819412-1-peterx@redhat.com > > Dax supports pud pages for a while, but mprotect on puds was missing since > the start. This series tries to fix that by providing pud handling in > mprotect(). The goal is to add more types of pud mappings like hugetlb or > pfnmaps. This series paves way for it by fixing known pud entries. > > Considering nobody reported this until when I looked at those other types > of pud mappings, I am thinking maybe it doesn't need to be a fix for stable > and this may not need to be backported. I would guess whoever cares about > mprotect() won't care 1G dax puds yet, vice versa. I hope fixing that in > new kernels would be fine, but I'm open to suggestions. > > There're a few small things changed to teach mprotect work on PUDs. E.g. it > will need to start with dropping NUMA_HUGE_PTE_UPDATES which may stop > making sense when there can be more than one type of huge pte. OTOH, we'll > also need to push the mmu notifiers from pmd to pud layers, which might > need some attention but so far I think it's safe. For such details, please > refer to each patch's commit message. > > The mprotect() pud process should be straightforward, as I kept it as > simple as possible. There's no NUMA handled as dax simply doesn't support > that. There's also no userfault involvements as file memory (even if work > with userfault-wp async mode) will need to split a pud, so pud entry > doesn't need to yet know userfault's existance (but hugetlb entries will; > that's also for later). > > Tests > ===== > > What I did test: > > - cross-build tests that I normally cover [1] > > - smoke tested on x86_64 the simplest program [2] on dev_dax 1G PUD > mprotect() using QEMU's nvdimm emulations [3] and ndctl to create > namespaces with proper alignments, which used to throw "bad pud" but now > it'll run through all fine. I checked sigbus happens if with illegal > access on protected puds. > > - vmtests. > > What I didn't test: > > - fsdax: I wanted to also give it a shot, but only until then I noticed it > doesn't seem to be supported (according to dax_iomap_fault(), which will > always fallback on PUD_ORDER). I did remember it was supported before, I > could miss something important there.. please shoot if so. > > - userfault wp-async: I also wanted to test userfault-wp async be able to > split huge puds (here it's simply a clear_pud.. though), but it won't > work for devdax anyway due to not allowed to do smaller than 1G faults in > this case. So skip too. > > - Power, as no hardware on hand. Does it need some specific configuration, or just any Power machine will do? cheers