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 894C7C30658 for ; Tue, 2 Jul 2024 13:26:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28D416B00A2; Tue, 2 Jul 2024 09:26:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 23D376B00A3; Tue, 2 Jul 2024 09:26:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 105186B00A4; Tue, 2 Jul 2024 09:26:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E6F476B00A2 for ; Tue, 2 Jul 2024 09:26:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8D254A217D for ; Tue, 2 Jul 2024 13:26:26 +0000 (UTC) X-FDA: 82294886772.28.5A07FA6 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by imf24.hostedemail.com (Postfix) with ESMTP id 2D40C18001D for ; Tue, 2 Jul 2024 13:26:22 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ellerman.id.au header.s=201909 header.b="aDQg/cO3"; spf=pass (imf24.hostedemail.com: domain of mpe@ellerman.id.au designates 150.107.74.76 as permitted sender) smtp.mailfrom=mpe@ellerman.id.au; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719926761; 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=UGTwS/DKg+8pMXk0DI9KdA5PsJ49u27dDjQ27xdvrOo=; b=lZm66mc+cfeGJilq6BDtVULTtEwSC4XMi4Pyfpx3+Swk+/RAW4WY3EHc9OHWA/h+CphFhV /6+mAd7fbTSaeNxD8VCPKTffkhrmPvgUptbAKhCLSbxRaGSe01aQeTlzECwbZZYDBwG699 nrooRuN41jlouX8EimJfTdWtpaU1NpA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719926761; a=rsa-sha256; cv=none; b=P6LX7BERmZpB44C5D+kHLo/Rn5cG6MYC0GgdUMPRwmmfX28AHejCHZ0KQgLGNfNcHGm034 FMrIyhCTVO7orha5yCgp4+VNS/yt8Xbe2N7XOX6RBa5ODypvJcP9PUSmbKMDnjw5v1sk4a B9NOHa0dss4Af7d6vxMqaFOyns9rh7k= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ellerman.id.au header.s=201909 header.b="aDQg/cO3"; spf=pass (imf24.hostedemail.com: domain of mpe@ellerman.id.au designates 150.107.74.76 as permitted sender) smtp.mailfrom=mpe@ellerman.id.au; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1719926780; bh=UGTwS/DKg+8pMXk0DI9KdA5PsJ49u27dDjQ27xdvrOo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aDQg/cO3ChtGupOyDrsKCvhp3Wj5I2zvRwE5aNcedmdk8tx+t0nZ35mD2Sgfglk6c wHyzUcEsUkk2oK/1dwxn4IPMeJRBlIItgOXUp2hIKqm72RVwTLM6EtDPKhn+hgM0IE 77bDh5Dfs5fDf2kMOHjqXSGuyyHMM2ZTDZmTzx/XS4oatFogUOUQCqA29oc6sCaUss zVteowZUNrEuQv3HVz2TIIwaVqJIw5szCFxnN6EWj4TXxb2GIWb+zDlw2i7ovRVWnP rIpmwVkonUgH1purEDe7D8IcnUQrGitkCcRUSWpcbf27m/JpC4Ax1XIp0shJHPFvD1 +aJKCunhITUCA== 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) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4WD3Zz5DnTz4wny; Tue, 2 Jul 2024 23:26:19 +1000 (AEST) From: Michael Ellerman To: Christophe Leroy , Andrew Morton , Jason Gunthorpe , Peter Xu , Oscar Salvador , Nicholas Piggin Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v6 21/23] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD In-Reply-To: <23f3fe9e8fe37cb164a369850d4569dddf359fdf.1719240269.git.christophe.leroy@csgroup.eu> References: <23f3fe9e8fe37cb164a369850d4569dddf359fdf.1719240269.git.christophe.leroy@csgroup.eu> Date: Tue, 02 Jul 2024 23:26:19 +1000 Message-ID: <87plrwj56s.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2D40C18001D X-Stat-Signature: idr7pxonc6efqubutawcmxsybh8nmyzx X-HE-Tag: 1719926782-418539 X-HE-Meta: U2FsdGVkX19BjRTA4MOHbwqDjQEe8yxc1VVBfnzq3NN5PD+a1EuSE3tAsJQ2RPbM2dTd/GGZig3sIzgzh4Q1lB/n8p9kovo8qUwPhAzzIeeT16LQzqob6HH9MknbTV8fqF/z0djdTF+fsIWXa3vbM40cN0b8uj+6l+5G3AYVEtI2NdbsnxTP3oXEvKJ4+U1sZ6Ry1j1LsMBe9TIUppH1RWcmY6dB3Z9ATA2bYpA/eDl8R6FWGeal+uVOCMNgBywBOxg9EsF8hyn6fEOGocu2sH++fa8W5ecVSHn+MYrhBnfjDiGV6V2vCjatQVYecGYklGgYQFHJFkIgD1jZ+t8yQFDFqrEz4EyI8dt+830iES1LEf8UZOExAyU8h1sptHJJpzJpdmtLOb+VCw8Ie1Ku5+csxI+enfnQr2iRCR50dkHcLrd4ZSxG65CpPGQhg/SabzHc8FsuI6aFG6/gFV2YzO50PiDzFmHxeA+/1o7K/N4OY2xj0ooUCCYuHZAnsjOSN0KXJ3NUoOu/SbUd3PRQGThOpQNC1vmrHLuRno4vBc9KOVsInfaglFxW2vBLT5gB7ParrpFTkxYIO+q5lULrxEEZlRJTXKXt7idibQSEdt9SBHkLNmGqZl9+V3crTdVErpRDkgovMvyVPm9jP/X8jiAlf6YnQ1hjPvduGsrNaylwmER02hXTWADb2JmBFI0oIffbCfSbFjItRzB0iuBuAjTPyR185K0pVfxFLwBPa4yIxZatffXX6hus9+oFOVVoVnVep3cdUX1iiX6ZMwo3LZ2pVL+OxZwN/GFWg3/o2nntktU4Bz3RteyMb4mb2FUnQrjwD9Al1+9Oxbtb+CGVQcGtQnrc2U0NfRgkDNDA94ri7fTYu4m8f1z5gEdd73HpravtTe1MIJQYSda4AmzhfyVBXwzpv08sDtDXLy5lPp4ukZyq2OGEw+d8jksAWr1cL1cQffMspkXu/FSeLaZ IxgI5lQO RbeM9H7T83A2XbHfLAQJT97vOaeVJyYaUnt/ZW5fZGLe3xU/QWDGUzkTyiW9JeyF6jDooOSZEHPSSAHSuIepQ0FykclpBqtgBcLSEE5+Fu/Hku5/9NeE8+qaLOv81rmKDe664nEbHCKv57kavapdNExbI6BPYFSQtDqdpQCHUgE94m4ZAdQEYoMqKpHsyT/6w/qh/Inymm3Mh3Us6bO/VeVRotA== 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: Christophe Leroy writes: > On book3s/64, the only user of hugepd is hash in 4k mode. > > All other setups (hash-64, radix-4, radix-64) use leaf PMD/PUD. > > Rework hash-4k to use contiguous PMD and PUD instead. > > In that setup there are only two huge page sizes: 16M and 16G. > > 16M sits at PMD level and 16G at PUD level. > > pte_update doesn't know page size, lets use the same trick as > hpte_need_flush() to get page size from segment properties. That's > not the most efficient way but let's do that until callers of > pte_update() provide page size instead of just a huge flag. > > Signed-off-by: Christophe Leroy > --- > v3: > - Add missing pmd_leaf_size() and pud_leaf_size() > - More cleanup in hugetlbpage_init() > - Take a page fault when DIRTY or ACCESSED is missing on hash-4 hugepage > > v4: Rebased on v6.10-rc1 > > v6: Added a WARN_ON_ONCE() in hash__pte_update() in case the pagesize is unexpected. > --- > arch/powerpc/include/asm/book3s/64/hash-4k.h | 15 ------ > arch/powerpc/include/asm/book3s/64/hash.h | 40 +++++++++++++--- > arch/powerpc/include/asm/book3s/64/hugetlb.h | 38 --------------- > .../include/asm/book3s/64/pgtable-4k.h | 47 ------------------- > .../include/asm/book3s/64/pgtable-64k.h | 20 -------- > arch/powerpc/include/asm/book3s/64/pgtable.h | 22 +++++++-- > arch/powerpc/include/asm/hugetlb.h | 4 ++ > .../powerpc/include/asm/nohash/hugetlb-e500.h | 4 -- > arch/powerpc/include/asm/page.h | 8 ---- > arch/powerpc/mm/book3s64/hash_utils.c | 11 +++-- > arch/powerpc/mm/book3s64/hugetlbpage.c | 10 ++++ > arch/powerpc/mm/book3s64/pgtable.c | 12 ----- > arch/powerpc/mm/hugetlbpage.c | 26 ---------- > arch/powerpc/mm/pgtable.c | 2 +- > arch/powerpc/platforms/Kconfig.cputype | 1 - > 15 files changed, 74 insertions(+), 186 deletions(-) > delete mode 100644 arch/powerpc/include/asm/book3s/64/pgtable-4k.h This looks good to me. I've run a few tests on it and haven't seen any issues. I also dumped the page tables of a test program and checked they looked sensible. And I checked that the hash insert path is actually inserting a huge page entry (of course it is, but just to be sure). On mainline using a hugepd page hits the first warning in try_grab_folio() (via gup_hugepd()) and hangs the process. I haven't seen that reported (it goes back to v6.5), so my impression is hugepd on hash-4k is essentially unused these days. This series is an improvement on that, so let's get it into mm-unstable for some wider testing. Acked-by: Michael Ellerman (powerpc) cheers