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 638EEC25B75 for ; Thu, 23 May 2024 19:40:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E2496B0088; Thu, 23 May 2024 15:40:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8926F6B008A; Thu, 23 May 2024 15:40:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75A9E6B008C; Thu, 23 May 2024 15:40:32 -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 58DBD6B0088 for ; Thu, 23 May 2024 15:40:32 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D947D16072C for ; Thu, 23 May 2024 19:40:31 +0000 (UTC) X-FDA: 82150677462.28.87C99DC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id CAC30160005 for ; Thu, 23 May 2024 19:40:29 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="UZ/hVB2d"; spf=pass (imf08.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716493229; 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=OCvWufVacLGgXuxtEqrctwgkg9qLQ+urbHg5QGQf0Ok=; b=UXrL9FhsZpS/TpxCqSBNpvzMueHDTgADXjZmDexZ2xmzkVSsHy/tlvce+pDY2qZcn+8pm5 KN6mxsR2fD2COePCrtF/yggU8+B1cGRG/erIFybm16cOfbe9G7ebTUm5EV6wDFKCzoOjsy MMI1XYf7MwMoWExuHxFuwSjx9MXUZSs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716493229; a=rsa-sha256; cv=none; b=sWuURkdPEi0cN6Ew0YaxnqJNMOyOc+dJw9xnzAFnuEWljdfkICXCgAqIgQ99FSUa8X7QN3 xpoJtaolG+z5RQuvz1Pk47ZEuvrEAz1StyRm7UcL56mHjbSyM3emDJ6uYh9c/m+CuP5TNU QOo5+6EaGYBDORltGjC5LK6m41xdtuM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="UZ/hVB2d"; spf=pass (imf08.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716493229; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OCvWufVacLGgXuxtEqrctwgkg9qLQ+urbHg5QGQf0Ok=; b=UZ/hVB2dnqJAyHWCXC0GQhuT7yHhrdl8lhHwaTyNK8vXyKOwPUKjAyLY6Sf5fJ4If7kM5l fSi75ygs8bw4XWe+0wrJQ36hjvatd+czOlBzxWHd2MiR8lN0aea3wWXxS5hmR/4L4SRyJH 962Yb+psJDAip9ivNabG3fSgmvEuIag= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-523-NzybYFFeM026ZVcztU2P3Q-1; Thu, 23 May 2024 15:40:25 -0400 X-MC-Unique: NzybYFFeM026ZVcztU2P3Q-1 Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3c99d052265so276993b6e.2 for ; Thu, 23 May 2024 12:40:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716493225; x=1717098025; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OCvWufVacLGgXuxtEqrctwgkg9qLQ+urbHg5QGQf0Ok=; b=Bdch1PtKIQAHnX3OCmmfTJbgnn+xS40PJpVIr0gebGw/mNRfzJmJeMlq0GkLiTM9/k rl7PjzzpGmGGRConLdTtLa9Wa6zxE4BkMO6EkKMqxT4T71Bj8Cj1o0CHY+bs/1LQ8OX3 Yx90PT7zR6mb6uH4sJ0HYv7cTMA1BzP9G3xa5E7AZQONP2aSJxOlRTq9ecXCm1MvlC72 Aw4XQ4RZMsGyI3mXXgD8oucBNamiKRnhHwS1VhONMEZI0uT1p1YMbEpO0D1Ve8nD5MPV leZ9T2xfH3J8tVmNH0baTJIjxw79evfmhcGctF4XOEs+jhRFSh6ZVKDyncLtoOKGKVAB VPJg== X-Forwarded-Encrypted: i=1; AJvYcCWL/oJx0eBwcTsMqmVny4H99E/MV9QcR+VhKKdRhieOBKoO76YsFx4zPzKBubU/3jAE93x4MNC5jGRaAn9p7Uzj8BU= X-Gm-Message-State: AOJu0YxxHBicGuJBW9nJdwsCDEaC/cALWNP4N+GGPWz1jJ0ejbM34U2i RRegB2Ts3US9IUn0VYX7kol3R4cGJBzM2/sNaFwB+j3vgPPxv2QRn+9LxYD5pXoBKg2v3cG6fEx BhQEZlNymKYUxqJTWpOuYWWBcifL3Cs8I8opQH5tJQnHZ1cB+ X-Received: by 2002:a05:6808:3087:b0:3c8:4cc6:4f0c with SMTP id 5614622812f47-3d1a966af20mr343310b6e.5.1716493224725; Thu, 23 May 2024 12:40:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5T0Za11sb8Fsxy+MXgLZp568ubN3owF+qKZJ+eJpG1Em8U4RQw4I+vJsVrvCB0c6vSaNEQg== X-Received: by 2002:a05:6808:3087:b0:3c8:4cc6:4f0c with SMTP id 5614622812f47-3d1a966af20mr343274b6e.5.1716493224004; Thu, 23 May 2024 12:40:24 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-792bf2a3e3esm1517490185a.68.2024.05.23.12.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 12:40:23 -0700 (PDT) Date: Thu, 23 May 2024 15:40:20 -0400 From: Peter Xu To: Christophe Leroy Cc: Andrew Morton , Jason Gunthorpe , Oscar Salvador , Michael Ellerman , Nicholas Piggin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [RFC PATCH v2 00/20] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64) Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspam-User: X-Stat-Signature: pasawacsq1hjifwwd6sai1z5yttk1emt X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CAC30160005 X-HE-Tag: 1716493229-220398 X-HE-Meta: U2FsdGVkX1+zTTEbIup3nYYp1K+RKPECcPocqNbt9ltUNe8iWGkBN8AmtsGk1cOI3ZyQaAon/ag/7ZxeYCDXdnkQSWds+dDjY7X0clOBzcilZExs2tKi/jbufQQ9RyL+FlznJUdZnIPXb/EiovrzFBNhBqHPkXgq5D94Z2Sj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fXTW52vHYVp6G5JkD9o8mVk67+wpp4S4QtdKbu/raEYmVXVYU5KdsEgEqL5XyQSnByuEY3IayWQFVSCl5g6UdfXIdDFI8aHUa+Zde/WFbJJkqY6XOsXRSPupW8bOHoufiRHIAGXgj2BIa2HLUYuIoTPTV5cbhuCHlu3SASI 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: On Fri, May 17, 2024 at 08:59:54PM +0200, Christophe Leroy wrote: > This is the continuation of the RFC v1 series "Reimplement huge pages > without hugepd on powerpc 8xx". It now get rid of hugepd completely > after handling also e500 and book3s/64 > > Unlike most architectures, powerpc 8xx HW requires a two-level > pagetable topology for all page sizes. So a leaf PMD-contig approach > is not feasible as such. > > Possible sizes are 4k, 16k, 512k and 8M. > > First level (PGD/PMD) covers 4M per entry. For 8M pages, two PMD entries > must point to a single entry level-2 page table. Until now that was > done using hugepd. This series changes it to use standard page tables > where the entry is replicated 1024 times on each of the two pagetables > refered by the two associated PMD entries for that 8M page. > > At the moment it has to look into each helper to know if the > hugepage ptep is a PTE or a PMD in order to know it is a 8M page or > a lower size. I hope this can me handled by core-mm in the future. > > For e500 and book3s/64 there are less constraints because it is not > tied to the HW assisted tablewalk like on 8xx, so it is easier to use > leaf PMDs (and PUDs). > > On e500 the supported page sizes are 4M, 16M, 64M, 256M and 1G. All at > PMD level on e500/32 and mix of PMD and PUD for e500/64. We encode page > size with 4 available bits in PTE entries. On e300/32 PGD entries size > is increases to 64 bits in order to allow leaf-PMD entries because PTE > are 64 bits on e500. > > On book3s/64 only the hash-4k mode is concerned. It supports 16M pages > as cont-PMD and 16G pages as cont-PUD. In other modes (radix-4k, radix-6k > and hash-64k) the sizes match with PMD and PUD sizes so that's just leaf > entries. > > Christophe Leroy (20): > mm: Provide pagesize to pmd_populate() > mm: Provide page size to pte_alloc_huge() > mm: Provide pmd to pte_leaf_size() > mm: Provide mm_struct and address to huge_ptep_get() > powerpc/mm: Allow hugepages without hugepd > powerpc/8xx: Fix size given to set_huge_pte_at() > powerpc/8xx: Rework support for 8M pages using contiguous PTE entries > powerpc/8xx: Simplify struct mmu_psize_def > powerpc/mm: Remove _PAGE_PSIZE > powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries > powerpc/mm: Complement huge_pte_alloc() for all non HUGEPD setups > powerpc/64e: Remove unneeded #ifdef CONFIG_PPC_E500 > powerpc/64e: Clean up impossible setups > powerpc/e500: Remove enc field from struct mmu_psize_def > powerpc/85xx: Switch to 64 bits PGD > powerpc/e500: Encode hugepage size in PTE bits > powerpc/e500: Use contiguous PMD instead of hugepd > powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD > powerpc/mm: Remove hugepd leftovers > mm: Remove CONFIG_ARCH_HAS_HUGEPD Great to see this series, thanks again Christophe. I requested for help on the lsfmm hugetlb unification session, but unfortunately I don't think there were Power people around.. I'd like to request help from Power developers again here on the list: it will be very appreciated if you can help have a look at this series. It's a direct dependent work to the hugetlb refactoring that we'll be working on, while it looks like the hugetlb refactoring is something the community as a whole would like to see in the near future. We don't want to add more Power-only CONFIG_ARCH_HAS_HUGEPD checks for hugetlb in any new code. Currently Oscar offered help on that hugetlb project, and Oscar will start to work on page_walk API refactoring. I guess currently the simple way is we'll work on top of Christophe's series. Some proper review on this series will definitely make it clearer on what we should do next. Thanks, -- Peter Xu