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 B3436ECAAD3 for ; Sun, 4 Sep 2022 11:49:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A73D8D0038; Sun, 4 Sep 2022 07:49:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 257048D0030; Sun, 4 Sep 2022 07:49:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 145C08D0038; Sun, 4 Sep 2022 07:49:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 056C48D0030 for ; Sun, 4 Sep 2022 07:49:42 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C849F1C615D for ; Sun, 4 Sep 2022 11:49:41 +0000 (UTC) X-FDA: 79874233362.02.BD6825E Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by imf24.hostedemail.com (Postfix) with ESMTP id A7C2D180080 for ; Sun, 4 Sep 2022 11:49:40 +0000 (UTC) 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 ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4ML91C2gWQz4xD3; Sun, 4 Sep 2022 21:49:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1662292176; bh=bKqRG6bbjWf4+zXv++X3GOUqHw+5BEUesl1XOH03L+I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Uw7YffOgZPnmgBp6TK63LEy7ghgapx/1/o+S2lrTttIriH8Uf6Aw+fA0CvnhCfJob QR5u4nvxWn4iof9YBgdEMN6abL3KvBiuubuLIpoqLE4PWNBwj7YCF3LL6NGY5wK+YF 2/eEjU3GK4QyMwwYACESiGHFBBPg2ZYnDq8y3pTSwi6HXQUOoxRiirooaSCPbAhcGt rBKeM1INkwFt3rs1V9zpJLnJzZJAEJ/B4/tmHUlJ0scCd1B/0szive/CEac8iTLdal VdAGUPRkl+tNL1Bzryy54iXUXYEvcZVziJGYwmtCJR7FeXamkFuhYZYYFRB/FHnNnf j0Jy4shd5wK1Q== From: Michael Ellerman To: Christophe Leroy , David Hildenbrand , Mike Kravetz Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linux-ia64@vger.kernel.org" , Baolin Wang , "Aneesh Kumar K . V" , Naoya Horiguchi , Muchun Song , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" Subject: Re: [PATCH] hugetlb: simplify hugetlb handling in follow_page_mask In-Reply-To: References: <20220829234053.159158-1-mike.kravetz@oracle.com> <608934d4-466d-975e-6458-34a91ccb4669@redhat.com> <739dc825-ece3-a59f-adc5-65861676e0ae@redhat.com> <323fdb0f-c5a5-e0e5-1ff4-ab971bc295cc@redhat.com> Date: Sun, 04 Sep 2022 21:49:34 +1000 Message-ID: <87ilm3tl4h.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ellerman.id.au header.s=201909 header.b=Uw7YffOg; 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662292181; a=rsa-sha256; cv=none; b=aK+6aRGsExRD63Teq/CNeDDFVnkPfCOtkI2eV3qtw8EsjwiWLqBEH9vlr5Z5noKPAI/sqc MhOIojvarOORWHuat/OQsLVYymXULiIX5Nx+BBM+DD8k0T/A1SkAMKrBg1AEHmx599NKf2 e0+Yhe7q57MnngIhXZdSqk8vNfXhunk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662292181; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bKqRG6bbjWf4+zXv++X3GOUqHw+5BEUesl1XOH03L+I=; b=7k3cdVOofyLmUVQ4trxRrdgY/K2Tz21XxAxrmRSoGLSdCar6HT+b5VeKBMYWvc9C/Cn2VG XekyqbayPiwJ9rT3VHhMH2QgtcYuQyMveqkriVBqrdp0jEsHGbLt1dmueWjOcpLJ0VClIR caAKNdEPauwX3CHQyCfqgHznibEcdNs= X-Rspamd-Queue-Id: A7C2D180080 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ellerman.id.au header.s=201909 header.b=Uw7YffOg; 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 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: few7hc54wu7t1n5ubyjs1abwyew7bpxu X-HE-Tag: 1662292180-415760 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: Christophe Leroy writes: > +Resending with valid powerpc list address > > Le 02/09/2022 =C3=A0 20:52, David Hildenbrand a =C3=A9crit=C2=A0: >>>>> Adding Christophe on Cc: >>>>> >>>>> Christophe do you know if is_hugepd is true for all hugetlb entries, = not >>>>> just hugepd? > > is_hugepd() is true if and only if the directory entry points to a huge=20 > page directory and not to the normal lower level directory. > > As far as I understand if the directory entry is not pointing to any=20 > lower directory but is a huge page entry, pXd_leaf() is true. Yes. Though historically it's pXd_huge() which is used to test that, which is gated by CONFIG_HUGETLB_PAGE. The leaf versions are newer and test whether the entry is a PTE regardless of whether CONFIG_HUGETLB_PAGE is enabled. Which is needed for PTDUMP if the kernel mapping uses huge pages independently of CONFIG_HUGETLB_PAGE, which is true on at least powerpc. >>>>> >>>>> On systems without hugepd entries, I guess ptdump skips all hugetlb e= ntries. >>>>> Sigh! > > As far as I can see, ptdump_pXd_entry() handles the pXd_leaf() case. > >>>> >>>> IIUC, the idea of ptdump_walk_pgd() is to dump page tables even outside >>>> VMAs (for debugging purposes?). >>>> >>>> I cannot convince myself that that's a good idea when only holding the >>>> mmap lock in read mode, because we can just see page tables getting >>>> freed concurrently e.g., during concurrent munmap() ... while holding >>>> the mmap lock in read we may only walk inside VMA boundaries. >>>> >>>> That then raises the questions if we're only calling this on special M= Ms >>>> (e.g., init_mm) whereby we cannot really see concurrent munmap() and >>>> where we shouldn't have hugetlb mappings or hugepd entries. > > At least on powerpc, PTDUMP handles only init_mm. > > Hugepage are used at least on powerpc 8xx for linear memory mapping, see > > commit 34536d780683 ("powerpc/8xx: Add a function to early map kernel=20 > via huge pages") > commit cf209951fa7f ("powerpc/8xx: Map linear memory with huge pages") > > hugepds may also be used in the future to use huge pages for vmap and=20 > vmalloc, see commit a6a8f7c4aa7e ("powerpc/8xx: add support for huge=20 > pages on VMAP and VMALLOC") > > As far as I know, ppc64 also use huge pages for VMAP and VMALLOC, see > > commit d909f9109c30 ("powerpc/64s/radix: Enable HAVE_ARCH_HUGE_VMAP") > commit 8abddd968a30 ("powerpc/64s/radix: Enable huge vmalloc mappings") 64-bit also uses huge pages for the kernel linear mapping (aka. direct mapping), and on newer systems (>=3D Power9) those also appear in the kernel page tables. cheers