[PATCH v5 18/18] mm: Remove CONFIG_ARCH_HAS_HUGEPD

2024-06-10 Thread Christophe Leroy
powerpc was the only user of CONFIG_ARCH_HAS_HUGEPD and doesn't use it anymore, so remove all related code. Signed-off-by: Christophe Leroy Acked-by: Oscar Salvador --- v4: Rebased on v6.10-rc1 --- include/linux/hugetlb.h | 6 -- mm/Kconfig | 10 --- mm/gup.c

[PATCH v5 17/18] powerpc/mm: Remove hugepd leftovers

2024-06-10 Thread Christophe Leroy
All targets have now opted out of CONFIG_ARCH_HAS_HUGEPD so remove left over code. Signed-off-by: Christophe Leroy Acked-by: Oscar Salvador --- v5: Fix a forgotten #endif which ended up in following patch --- arch/powerpc/include/asm/hugetlb.h | 7 - arch/powerpc/include/asm/page.h

[PATCH v5 16/18] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-06-10 Thread Christophe Leroy
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

[PATCH v5 15/18] powerpc/e500: Use contiguous PMD instead of hugepd

2024-06-10 Thread Christophe Leroy
. This works because the pagesize bits are in the last 12 bits and page tables are 4k aligned. On e500/64, use highest bit which is always 1 on PxD (Because PxD contains virtual address of a kernel memory) and always 0 on PTEs because not all bits of RPN are used/possible. Signed-off-by: Christophe Leroy

[PATCH v5 14/18] powerpc/e500: Free r10 for FIND_PTE

2024-06-10 Thread Christophe Leroy
Move r13 load after the call to FIND_PTE, and use r13 instead of r10 for storing fault address. This will allow using r10 freely in FIND_PTE in following patch to handle hugepage size. Signed-off-by: Christophe Leroy --- v5: New --- arch/powerpc/kernel/head_85xx.S | 30

[PATCH v5 13/18] powerpc/e500: Don't pre-check write access on data TLB error

2024-06-10 Thread Christophe Leroy
Don't pre-check write access on read-only pages on data TLB error. Load the TLB anyway and take a DSI exception when it happens. This avoids reading SPRN_ESR at every data TLB error exception. Signed-off-by: Christophe Leroy --- v5: New --- arch/powerpc/kernel/head_85xx.S | 15

[PATCH v5 12/18] powerpc/e500: Encode hugepage size in PTE bits

2024-06-10 Thread Christophe Leroy
removed. It is not the value expected in the PTE in that field, but only e6500 performs HW based TLB loading and the e6500 reference manual explicitely says that this field is ignored. Also add pte_huge_size() which will be used later. Signed-off-by: Christophe Leroy --- v5: Use PAGE SIZE field

[PATCH v5 11/18] powerpc/e500: Switch to 64 bits PGD on 85xx (32 bits)

2024-06-09 Thread Christophe Leroy
At the time being when CONFIG_PTE_64BIT is selected, PTE entries are 64 bits but PGD entries are still 32 bits. In order to allow leaf PMD entries, switch the PGD to 64 bits entries. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/pgtable-types.h | 4 arch/powerpc/kernel

[PATCH v5 10/18] powerpc/e500: Remove enc and ind fields from struct mmu_psize_def

2024-06-09 Thread Christophe Leroy
enc field is hidden behind BOOK3E_PAGESZ_XX macros, and when you look closer you realise that this field is nothing else than the value of shift minus ten. So remove enc field and calculate tsize from shift field. Also remove inc field which is unused. Signed-off-by: Christophe Leroy Reviewed

[PATCH v5 09/18] powerpc/8xx: Simplify struct mmu_psize_def

2024-06-09 Thread Christophe Leroy
On 8xx, only the shift field is used in struct mmu_psize_def Remove other fields and related macros. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch

[PATCH v5 08/18] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-06-09 Thread Christophe Leroy
it is addressing an 8M page, this is required for the HW tablewalk assistance. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: - Move huge_ptep_get() for a more readable commit diff - Flag PMD as 8Mbytes in set_huge_pte_at() - Define __pte_leaf_size() - Change pte_update

[PATCH v5 07/18] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-06-09 Thread Christophe Leroy
set_huge_pte_at() expects the size of the hugepage as an int, not the psize which is the index of the page definition in table mmu_psize_defs[] Fixes: 935d4f0c6dc8 ("mm: hugetlb: add huge page size param to set_huge_pte_at()") Signed-off-by: Christophe Leroy Reviewed-by: Osca

[PATCH v5 06/18] powerpc/mm: Allow hugepages without hugepd

2024-06-09 Thread Christophe Leroy
In preparation of implementing huge pages on powerpc 8xx without hugepd, enclose hugepd related code inside an ifdef CONFIG_ARCH_HAS_HUGEPD This also allows removing some stubs. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: - Prepare huge_pte_alloc() for full standard

[PATCH v5 05/18] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries

2024-06-09 Thread Christophe Leroy
00 00 li r3,0 c8: 38 21 00 20 addi r1,r1,32 cc: 4e 80 00 20 blr Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: Removed p4dp and pudp locals for PPC32 and add a comment. v4: Properly set pdshift on PPC32 case v5: Enhanced commit mes

[PATCH v5 04/18] powerpc/mm: Remove _PAGE_PSIZE

2024-06-09 Thread Christophe Leroy
_PAGE_PSIZE macro is never used outside the place it is defined and is used only on 8xx and e500. Remove indirection, remove it and use its content directly. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/pte-40x.h | 3 --- arch/powerpc

[PATCH v5 03/18] mm: Provide mm_struct and address to huge_ptep_get()

2024-06-09 Thread Christophe Leroy
the pmd. In order to be consistent with huge_ptep_get_and_clear(), give mm and address to huge_ptep_get(). Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v2: Add missing changes in arch implementations v3: Fixed a comment in ARM and missing changes in S390 v4: Fix missing or bad

[PATCH v5 01/18] powerpc/64e: Remove unused IBM HTW code [SQUASHED]

2024-06-09 Thread Christophe Leroy
500_book3e - exc_[data|indstruction]_tlb_miss_bolted_book3e Which means the default handlers are never used. Remove those, and use the bolted handlers (PPC_HTW_NONE) by default. Signed-off-by: Michael Ellerman Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/mmu-e500.h |

[PATCH v5 02/18] mm: Define __pte_leaf_size() to also take a PMD entry

2024-06-09 Thread Christophe Leroy
not interested in the PMD arguments are not impacted. Only define a default pte_leaf_size() when __pte_leaf_size() is not defined to make sure nobody adds new calls to pte_leaf_size() in the core. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: Don't change pte_leaf_size

[PATCH v5 00/18] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

2024-06-09 Thread Christophe Leroy
on top of v6.10-rc1 Global changes in v3: - Removed patches 1 and 2 - Squashed patch 11 into patch 5 - Replaced patches 12 and 13 with a series from Michael - Reordered patches a bit to have more general patches up front For more details on changes, see in each patch. Christophe Leroy (17): mm

Re: [PATCH V3 05/14] tools/perf: Add disasm_line__parse to parse raw instruction for powerpc

2024-06-08 Thread Christophe Leroy
Le 06/06/2024 à 08:33, Namhyung Kim a écrit : > Hello, > > On Sat, Jun 01, 2024 at 11:39:32AM +0530, Athira Rajeev wrote: >> Currently, the perf tool infrastructure disasm_line__parse function to >> parse disassembled line. >> >> Example snippet from objdump: >> objdump --start-address=

Re: [RFC PATCH v4 12/16] powerpc/e500: Encode hugepage size in PTE bits

2024-05-29 Thread Christophe Leroy
Le 29/05/2024 à 12:09, Oscar Salvador a écrit : > On Wed, May 29, 2024 at 09:49:48AM +0000, Christophe Leroy wrote: >> Doesn't really matter if it's PUD or PMD at this point. On a 32 bits >> kernel it will be all PMD while on a 64 bits kernel it is both PMD and PUD. >>

Re: [RFC PATCH v4 14/16] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-29 Thread Christophe Leroy
Le 29/05/2024 à 11:23, Oscar Salvador a écrit : > On Mon, May 27, 2024 at 03:30:12PM +0200, Christophe Leroy wrote: >> 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. >> >> Rew

Re: [RFC PATCH v4 13/16] powerpc/e500: Use contiguous PMD instead of hugepd

2024-05-29 Thread Christophe Leroy
Le 29/05/2024 à 10:49, Oscar Salvador a écrit : > [Vous ne recevez pas souvent de courriers de osalva...@suse.com. D?couvrez > pourquoi ceci est important ? https://aka.ms/LearnAboutSenderIdentification ] > > On Mon, May 27, 2024 at 03:30:11PM +0200, Christophe Leroy wrote: >

Re: [RFC PATCH v4 12/16] powerpc/e500: Encode hugepage size in PTE bits

2024-05-29 Thread Christophe Leroy
Le 29/05/2024 à 10:05, Oscar Salvador a écrit : > [Vous ne recevez pas souvent de courriers de osalva...@suse.com. D?couvrez > pourquoi ceci est important ? https://aka.ms/LearnAboutSenderIdentification ] > > On Mon, May 27, 2024 at 03:30:10PM +0200, Christophe Leroy wrote: >&

Re: [RFC PATCH v4 08/16] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-05-29 Thread Christophe Leroy
Le 29/05/2024 à 10:02, Oscar Salvador a écrit : > [Vous ne recevez pas souvent de courriers de osalva...@suse.com. D?couvrez > pourquoi ceci est important ? https://aka.ms/LearnAboutSenderIdentification ] > > On Mon, May 27, 2024 at 03:30:06PM +0200, Christophe Leroy wrote: >&g

Re: [PATCH v2 1/2] memory: fsl_ifc: Make FSL_IFC config visible and selectable

2024-05-28 Thread Christophe Leroy
Le 28/05/2024 à 14:28, Esben Haabendal a écrit : > [Vous ne recevez pas souvent de courriers de es...@geanix.com. Découvrez > pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > While use of fsl_ifc driver with NAND flash is fine, as the fsl_ifc_nand > driver

Re: [RFC PATCH v4 03/16] mm: Provide mm_struct and address to huge_ptep_get()

2024-05-28 Thread Christophe Leroy
Le 28/05/2024 à 07:41, Oscar Salvador a écrit : > On Mon, May 27, 2024 at 03:30:01PM +0200, Christophe Leroy wrote: >> --- a/mm/gup.c >> +++ b/mm/gup.c >> @@ -547,7 +547,7 @@ static int gup_hugepte(struct vm_area_struct *vma, pte_t >> *ptep, unsigned long s

Re: [RFC PATCH v3 08/16] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-05-28 Thread Christophe Leroy
Le 27/05/2024 à 14:10, Oscar Salvador a écrit : > On Sun, May 26, 2024 at 11:22:28AM +0200, Christophe Leroy wrote: >> In order to fit better with standard Linux page tables layout, add >> support for 8M pages using contiguous PTE entries in a standard >> pa

Re: [RFC PATCH v3 03/16] mm: Provide mm_struct and address to huge_ptep_get()

2024-05-27 Thread Christophe Leroy
Le 27/05/2024 à 13:19, Oscar Salvador a écrit : > On Sun, May 26, 2024 at 11:22:23AM +0200, Christophe Leroy wrote: >> On powerpc 8xx huge_ptep_get() will need to know whether the given >> ptep is a PTE entry or a PMD entry. This cannot be known with the >> PMD

[RFC PATCH v4 16/16] mm: Remove CONFIG_ARCH_HAS_HUGEPD

2024-05-27 Thread Christophe Leroy
powerpc was the only user of CONFIG_ARCH_HAS_HUGEPD and doesn't use it anymore, so remove all related code. Signed-off-by: Christophe Leroy --- v4: Rebased on v6.10-rc1 --- arch/powerpc/mm/hugetlbpage.c | 1 - include/linux/hugetlb.h | 6 -- mm/Kconfig| 10 -- mm

[RFC PATCH v4 06/16] powerpc/mm: Allow hugepages without hugepd

2024-05-27 Thread Christophe Leroy
In preparation of implementing huge pages on powerpc 8xx without hugepd, enclose hugepd related code inside an ifdef CONFIG_ARCH_HAS_HUGEPD This also allows removing some stubs. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: - Prepare huge_pte_alloc() for full standard

[RFC PATCH v4 09/16] powerpc/8xx: Simplify struct mmu_psize_def

2024-05-27 Thread Christophe Leroy
On 8xx, only the shift field is used in struct mmu_psize_def Remove other fields and related macros. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch

[RFC PATCH v4 05/16] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries

2024-05-27 Thread Christophe Leroy
() are used on real pointers and not on on-stack copies. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: Removed p4dp and pudp locals for PPC32 and add a comment. v4: Properly set pdshift on PPC32 case --- arch/powerpc/mm/pgtable.c | 11 ++- 1 file changed, 10

[RFC PATCH v4 15/16] powerpc/mm: Remove hugepd leftovers

2024-05-27 Thread Christophe Leroy
All targets have now opted out of CONFIG_ARCH_HAS_HUGEPD so remove left over code. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/hugetlb.h | 7 - arch/powerpc/include/asm/page.h | 6 - arch/powerpc/include/asm/pgtable-be-types.h | 10 - arch/powerpc

[RFC PATCH v4 13/16] powerpc/e500: Use contiguous PMD instead of hugepd

2024-05-27 Thread Christophe Leroy
. On e500/32, all are at PGD/PMD level and can be handled as cont-PMD. On e500/64, smaller ones are on PMD while bigger ones are on PUD. Again, they can easily be handled as cont-PMD and cont-PUD instead of hugepd. Signed-off-by: Christophe Leroy --- v3: Add missing pmd_leaf_size() and pud_leaf_size

[RFC PATCH v4 11/16] powerpc/e500: Switch to 64 bits PGD on 85xx (32 bits)

2024-05-27 Thread Christophe Leroy
At the time being when CONFIG_PTE_64BIT is selected, PTE entries are 64 bits but PGD entries are still 32 bits. In order to allow leaf PMD entries, switch the PGD to 64 bits entries. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/pgtable-types.h | 4 arch/powerpc/kernel

[RFC PATCH v4 04/16] powerpc/mm: Remove _PAGE_PSIZE

2024-05-27 Thread Christophe Leroy
_PAGE_PSIZE macro is never used outside the place it is defined and is used only on 8xx and e500. Remove indirection, remove it and use its content directly. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/pte-40x.h | 3 --- arch/powerpc

[RFC PATCH v4 14/16] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-27 Thread Christophe Leroy
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

[RFC PATCH v4 10/16] powerpc/e500: Remove enc and ind fields from struct mmu_psize_def

2024-05-27 Thread Christophe Leroy
enc field is hidden behind BOOK3E_PAGESZ_XX macros, and when you look closer you realise that this field is nothing else than the value of shift minus ten. So remove enc field and calculate tsize from shift field. Also remove inc field which is unused. Signed-off-by: Christophe Leroy Reviewed

[RFC PATCH v4 12/16] powerpc/e500: Encode hugepage size in PTE bits

2024-05-27 Thread Christophe Leroy
Use U0-U3 bits to encode hugepage size, more exactly page shift. As we start using hugepages at shift 21 (2Mbytes), substract 20 so that it fits into 4 bits. That may change in the future if we want to use smaller hugepages. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash

[RFC PATCH v4 08/16] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-05-27 Thread Christophe Leroy
it is addressing an 8M page, this is required for the HW tablewalk assistance. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: - Move huge_ptep_get() for a more readable commit diff - Flag PMD as 8Mbytes in set_huge_pte_at() - Define __pte_leaf_size() - Change pte_update

[RFC PATCH v4 07/16] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-05-27 Thread Christophe Leroy
set_huge_pte_at() expects the size of the hugepage as an int, not the psize which is the index of the page definition in table mmu_psize_defs[] Fixes: 935d4f0c6dc8 ("mm: hugetlb: add huge page size param to set_huge_pte_at()") Signed-off-by: Christophe Leroy Reviewed-by: Osca

[RFC PATCH v4 03/16] mm: Provide mm_struct and address to huge_ptep_get()

2024-05-27 Thread Christophe Leroy
the pmd. In order to be consistent with huge_ptep_get_and_clear(), give mm and address to huge_ptep_get(). Signed-off-by: Christophe Leroy --- v2: Add missing changes in arch implementations v3: Fixed a comment in ARM and missing changes in S390 v4: Fix missing or bad changes in mm/hugetlb.c

[RFC PATCH v4 00/16] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

2024-05-27 Thread Christophe Leroy
nges in v3: - Removed patches 1 and 2 - Squashed patch 11 into patch 5 - Replaced patches 12 and 13 with a series from Michael - Reordered patches a bit to have more general patches up front For more details on changes, see in each patch. Christophe Leroy (15): mm: Define __pte_leaf_size() to

[RFC PATCH v4 02/16] mm: Define __pte_leaf_size() to also take a PMD entry

2024-05-27 Thread Christophe Leroy
not interested in the PMD arguments are not impacted. Only define a default pte_leaf_size() when __pte_leaf_size() is not defined to make sure nobody adds new calls to pte_leaf_size() in the core. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- v3: Don't change pte_leaf_size

[RFC PATCH v4 01/16] powerpc/64e: Remove unused IBM HTW code [SQUASHED]

2024-05-27 Thread Christophe Leroy
500_book3e - exc_[data|indstruction]_tlb_miss_bolted_book3e Which means the default handlers are never used. Remove those, and use the bolted handlers (PPC_HTW_NONE) by default. Signed-off-by: Michael Ellerman Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/mmu-e500.h |

Re: [PATCH v2 12/14] mm/treewide: Remove pXd_huge()

2024-05-27 Thread Christophe Leroy
Le 18/03/2024 à 21:04, pet...@redhat.com a écrit : > From: Peter Xu > > This API is not used anymore, drop it for the whole tree. Some documentation remain in v6.10-rc1: $ git grep -w p.d_huge Documentation/mm/arch_pgtable_helpers.rst:| pmd_huge | Tests a HugeTLB mapped PMD

Re: [RFC PATCH v3 05/16] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries

2024-05-26 Thread Christophe Leroy
Le 27/05/2024 à 06:55, Oscar Salvador a écrit : > On Sun, May 26, 2024 at 11:22:25AM +0200, Christophe Leroy wrote: >> Building on 32 bits with pmd_leaf() not returning always false leads >> to the following error: >> >>CC arch/powerpc/mm/pgtable.o &

Re: [RFC PATCH 4/8] mm: Provide mm_struct and address to huge_ptep_get()

2024-05-26 Thread Christophe Leroy
Le 25/03/2024 à 17:35, Jason Gunthorpe a écrit : > On Mon, Mar 25, 2024 at 03:55:57PM +0100, Christophe Leroy wrote: > >> arch/arm64/include/asm/hugetlb.h | 2 +- >> fs/hugetlbfs/inode.c | 2 +- >> fs/proc/task_mmu.c | 8 +++-

[RFC PATCH v3 15/16] powerpc/mm: Remove hugepd leftovers

2024-05-26 Thread Christophe Leroy
All targets have now opted out of CONFIG_ARCH_HAS_HUGEPD so remove left over code. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/hugetlb.h | 7 - arch/powerpc/include/asm/page.h | 6 - arch/powerpc/include/asm/pgtable-be-types.h | 10 - arch/powerpc

[RFC PATCH v3 16/16] mm: Remove CONFIG_ARCH_HAS_HUGEPD

2024-05-26 Thread Christophe Leroy
powerpc was the only user of CONFIG_ARCH_HAS_HUGEPD and doesn't use it anymore, so remove all related code. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/hugetlbpage.c | 1 - include/linux/hugetlb.h | 6 -- mm/Kconfig| 10 mm/gup.c

[RFC PATCH v3 13/16] powerpc/e500: Use contiguous PMD instead of hugepd

2024-05-26 Thread Christophe Leroy
. On e500/32, all are at PGD/PMD level and can be handled as cont-PMD. On e500/64, smaller ones are on PMD while bigger ones are on PUD. Again, they can easily be handled as cont-PMD and cont-PUD instead of hugepd. Signed-off-by: Christophe Leroy --- v3: Add missing pmd_leaf_size() and pud_leaf_size

Re: [RFC PATCH 1/8] mm: Provide pagesize to pmd_populate()

2024-05-26 Thread Christophe Leroy
Le 25/03/2024 à 17:19, Jason Gunthorpe a écrit : > On Mon, Mar 25, 2024 at 03:55:54PM +0100, Christophe Leroy wrote: >> Unlike many architectures, powerpc 8xx hardware tablewalk requires >> a two level process for all page sizes, allthough second level only >> has one entr

[RFC PATCH v3 14/16] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-26 Thread Christophe Leroy
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

[RFC PATCH v3 11/16] powerpc/e500: Switch to 64 bits PGD on 85xx (32 bits)

2024-05-26 Thread Christophe Leroy
At the time being when CONFIG_PTE_64BIT is selected, PTE entries are 64 bits but PGD entries are still 32 bits. In order to allow leaf PMD entries, switch the PGD to 64 bits entries. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/pgtable-types.h | 4 arch/powerpc/kernel

[RFC PATCH v3 10/16] powerpc/e500: Remove enc and ind fields from struct mmu_psize_def

2024-05-26 Thread Christophe Leroy
enc field is hidden behind BOOK3E_PAGESZ_XX macros, and when you look closer you realise that this field is nothing else than the value of shift minus ten. So remove enc field and calculate tsize from shift field. Also remove inc field which is unused. Signed-off-by: Christophe Leroy Reviewed

[RFC PATCH v3 12/16] powerpc/e500: Encode hugepage size in PTE bits

2024-05-26 Thread Christophe Leroy
Use U0-U3 bits to encode hugepage size, more exactly page shift. As we start using hugepages at shift 21 (2Mbytes), substract 20 so that it fits into 4 bits. That may change in the future if we want to use smaller hugepages. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash

[RFC PATCH v3 02/16] mm: Define __pte_leaf_size() to also take a PMD entry

2024-05-26 Thread Christophe Leroy
not interested in the PMD arguments are not impacted. Only define a default pte_leaf_size() when __pte_leaf_size() is not defined to make sure nobody adds new calls to pte_leaf_size() in the core. Signed-off-by: Christophe Leroy --- v3: Don't change pte_leaf_size() to not impact other architectures

[RFC PATCH v3 01/16] powerpc/64e: Remove unused IBM HTW code [SQUASHED]

2024-05-26 Thread Christophe Leroy
500_book3e - exc_[data|indstruction]_tlb_miss_bolted_book3e Which means the default handlers are never used. Remove those, and use the bolted handlers (PPC_HTW_NONE) by default. Signed-off-by: Michael Ellerman Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/mmu-e500.h |

[RFC PATCH v3 03/16] mm: Provide mm_struct and address to huge_ptep_get()

2024-05-26 Thread Christophe Leroy
the pmd. In order to be consistent with huge_ptep_get_and_clear(), give mm and address to huge_ptep_get(). Signed-off-by: Christophe Leroy --- v2: Add missing changes in arch implementations v3: Fixed a comment in ARM and missing changes in S390 --- arch/arm/include/asm/hugetlb-3level.h | 4

[RFC PATCH v3 00/16] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

2024-05-26 Thread Christophe Leroy
h a series from Michael - Reordered patches a bit to have more general patches up front For more details on changes, see in each patch. Christophe Leroy (15): mm: Define __pte_leaf_size() to also take a PMD entry mm: Provide mm_struct and address to huge_ptep_get() powerpc/mm: Remove _

[RFC PATCH v3 06/16] powerpc/mm: Allow hugepages without hugepd

2024-05-26 Thread Christophe Leroy
In preparation of implementing huge pages on powerpc 8xx without hugepd, enclose hugepd related code inside an ifdef CONFIG_ARCH_HAS_HUGEPD This also allows removing some stubs. Signed-off-by: Christophe Leroy --- v3: - Prepare huge_pte_alloc() for full standard topology, not only for 2-level

[RFC PATCH v3 08/16] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-05-26 Thread Christophe Leroy
it is addressing an 8M page, this is required for the HW tablewalk assistance. Signed-off-by: Christophe Leroy --- v3: - Move huge_ptep_get() for a more readable commit diff - Flag PMD as 8Mbytes in set_huge_pte_at() - Define __pte_leaf_size() - Change pte_update() instead of all huge callers

[RFC PATCH v3 07/16] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-05-26 Thread Christophe Leroy
set_huge_pte_at() expects the size of the hugepage as an int, not the psize which is the index of the page definition in table mmu_psize_defs[] Fixes: 935d4f0c6dc8 ("mm: hugetlb: add huge page size param to set_huge_pte_at()") Signed-off-by: Christophe Leroy --- arch/powerpc/mm/no

[RFC PATCH v3 04/16] powerpc/mm: Remove _PAGE_PSIZE

2024-05-26 Thread Christophe Leroy
_PAGE_PSIZE macro is never used outside the place it is defined and is used only on 8xx and e500. Remove indirection, remove it and use its content directly. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/pte-40x.h | 3 --- arch/powerpc

[RFC PATCH v3 05/16] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries

2024-05-26 Thread Christophe Leroy
() are used on real pointers and not on on-stack copies. Signed-off-by: Christophe Leroy --- v3: Removed p4dp and pudp locals for PPC32 and add a comment. --- arch/powerpc/mm/pgtable.c | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c

[RFC PATCH v3 09/16] powerpc/8xx: Simplify struct mmu_psize_def

2024-05-26 Thread Christophe Leroy
On 8xx, only the shift field is used in struct mmu_psize_def Remove other fields and related macros. Signed-off-by: Christophe Leroy Reviewed-by: Oscar Salvador --- arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch

Re: [RFC PATCH v2 15/20] powerpc/85xx: Switch to 64 bits PGD

2024-05-25 Thread Christophe Leroy
Le 25/05/2024 à 06:54, Oscar Salvador a écrit : > On Fri, May 17, 2024 at 09:00:09PM +0200, Christophe Leroy wrote: >> In order to allow leaf PMD entries, switch the PGD to 64 bits entries. >> >> Signed-off-by: Christophe Leroy > > I do not quite understand this

Re: [RFC PATCH v2 11/20] powerpc/mm: Complement huge_pte_alloc() for all non HUGEPD setups

2024-05-25 Thread Christophe Leroy
Le 25/05/2024 à 06:29, Oscar Salvador a écrit : > On Fri, May 17, 2024 at 09:00:05PM +0200, Christophe Leroy wrote: >> huge_pte_alloc() for non-HUGEPD targets is reserved for 8xx at the >> moment. In order to convert other targets for non-HUGEPD, complement >> huge_pte_a

Re: [RFC PATCH v2 10/20] powerpc/mm: Fix __find_linux_pte() on 32 bits with PMD leaf entries

2024-05-25 Thread Christophe Leroy
Le 25/05/2024 à 06:12, Oscar Salvador a écrit : > On Fri, May 17, 2024 at 09:00:04PM +0200, Christophe Leroy wrote: >> Building on 32 bits with pmd_leaf() not returning always false leads >> to the following error: > > I am curious though. > pmd_leaf is only defined in

Re: [PATCH V2 8/9] tools/perf: Add support to find global register variables using find_data_type_global_reg

2024-05-24 Thread Christophe Leroy
Le 24/05/2024 à 14:17, Athira Rajeev a écrit : > > >> On 7 May 2024, at 3:33 PM, Christophe Leroy >> wrote: >> >> >> >> Le 06/05/2024 à 14:19, Athira Rajeev a écrit : >>> There are cases where define a global register variable and

Re: [RFC PATCH v2 07/20] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-05-24 Thread Christophe Leroy
Le 24/05/2024 à 12:02, Oscar Salvador a écrit : > On Fri, May 17, 2024 at 09:00:01PM +0200, Christophe Leroy wrote: >> In order to fit better with standard Linux page tables layout, add >> support for 8M pages using contiguous PTE entries in a standard >> pa

Re: [RFC PATCH v2 12/20] powerpc/64e: Remove unneeded #ifdef CONFIG_PPC_E500

2024-05-24 Thread Christophe Leroy
Le 24/05/2024 à 09:31, Michael Ellerman a écrit : > Christophe Leroy writes: >> When it is a nohash/64 it can't be anything else than >> CONFIG_PPC_E500 so remove the #ifdef as they are always true. > > I have a series doing some similar cleanups, I'll post it. We can deci

Re: [RFC PATCH v2 06/20] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-05-22 Thread Christophe Leroy
+Peter Z. who added that commit. Le 22/05/2024 à 10:32, Christophe Leroy a écrit : > > > Le 21/05/2024 à 11:26, Oscar Salvador a écrit : >> On Tue, May 21, 2024 at 10:48:21AM +1000, Michael Ellerman wrote: >>> Yeah I can. Does it actually cause a bug

Re: [RFC PATCH v2 03/20] mm: Provide pmd to pte_leaf_size()

2024-05-22 Thread Christophe Leroy
Le 21/05/2024 à 11:39, Oscar Salvador a écrit : > On Fri, May 17, 2024 at 08:59:57PM +0200, Christophe Leroy wrote: >> On powerpc 8xx, when a page is 8M size, the information is in the PMD >> entry. So provide it to pte_leaf_size(). >> >> Signed-off-by: Christophe Ler

Re: [RFC PATCH v2 18/20] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-22 Thread Christophe Leroy
Le 22/05/2024 à 03:13, Nicholas Piggin a écrit : > On Tue May 21, 2024 at 2:43 AM AEST, Christophe Leroy wrote: >> >> >> Le 20/05/2024 à 14:54, Nicholas Piggin a écrit : >>> On Sat May 18, 2024 at 5:00 AM AEST, Christophe Leroy wrote: >>>> On book3s/64,

Re: [RFC PATCH 0/8] Reimplement huge pages without hugepd on powerpc 8xx

2024-05-22 Thread Christophe Leroy
Le 17/05/2024 à 16:27, Oscar Salvador a écrit : > On Mon, Mar 25, 2024 at 03:55:53PM +0100, Christophe Leroy wrote: >> This series reimplements hugepages with hugepd on powerpc 8xx. >> >> Unlike most architectures, powerpc 8xx HW requires a two-level >> pagetable topo

Re: [RFC PATCH v2 06/20] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-05-22 Thread Christophe Leroy
Le 20/05/2024 à 19:42, Oscar Salvador a écrit : > On Mon, May 20, 2024 at 04:31:39PM +0000, Christophe Leroy wrote: >> Hi Oscar, hi Michael, >> >> Le 20/05/2024 à 11:14, Oscar Salvador a écrit : >>> On Fri, May 17, 2024 at 09:00:00PM +0200, Christophe Leroy wrote:

Re: [RFC PATCH v2 01/20] mm: Provide pagesize to pmd_populate()

2024-05-22 Thread Christophe Leroy
Le 21/05/2024 à 13:57, Oscar Salvador a écrit : > On Mon, May 20, 2024 at 04:24:51PM +0000, Christophe Leroy wrote: >> I had a quick look at that document and it seems to provide a good >> summary of MMU features and principles. However there are some >> theoriti

Re: [RFC PATCH v2 06/20] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-05-22 Thread Christophe Leroy
Le 21/05/2024 à 11:26, Oscar Salvador a écrit : > On Tue, May 21, 2024 at 10:48:21AM +1000, Michael Ellerman wrote: >> Yeah I can. Does it actually cause a bug at runtime (I assume so)? > > No, currently set_huge_pte_at() from 8xx ignores the 'sz' parameter. > But it will be used after this

Re: [RFC PATCH v2 18/20] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-20 Thread Christophe Leroy
Le 20/05/2024 à 14:54, Nicholas Piggin a écrit : > On Sat May 18, 2024 at 5:00 AM AEST, Christophe Leroy wrote: >> 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

Re: [RFC PATCH v2 06/20] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-05-20 Thread Christophe Leroy
Hi Oscar, hi Michael, Le 20/05/2024 à 11:14, Oscar Salvador a écrit : > On Fri, May 17, 2024 at 09:00:00PM +0200, Christophe Leroy wrote: >> set_huge_pte_at() expects the real page size, not the psize which is > > "expects the size of the huge page" sounds bettter?

Re: [RFC PATCH v2 01/20] mm: Provide pagesize to pmd_populate()

2024-05-20 Thread Christophe Leroy
Le 20/05/2024 à 11:01, Oscar Salvador a écrit : > On Fri, May 17, 2024 at 08:59:55PM +0200, Christophe Leroy wrote: >> Unlike many architectures, powerpc 8xx hardware tablewalk requires >> a two level process for all page sizes, allthough second level only >> has one entr

Re: [RFC PATCH v2 00/20] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

2024-05-18 Thread Christophe Leroy
Le 17/05/2024 à 21:06, Jason Gunthorpe a écrit : > 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 &g

[RFC PATCH v2 00/20] Reimplement huge pages without hugepd on powerpc (8xx, e500, book3s/64)

2024-05-17 Thread Christophe Leroy
s 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 a

[RFC PATCH v2 05/20] powerpc/mm: Allow hugepages without hugepd

2024-05-17 Thread Christophe Leroy
In preparation of implementing huge pages on powerpc 8xx without hugepd, enclose hugepd related code inside an ifdef CONFIG_ARCH_HAS_HUGEPD This also allows removing some stubs. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/pgalloc.h | 2 -- arch/powerpc/include/asm

[RFC PATCH v2 03/20] mm: Provide pmd to pte_leaf_size()

2024-05-17 Thread Christophe Leroy
On powerpc 8xx, when a page is 8M size, the information is in the PMD entry. So provide it to pte_leaf_size(). Signed-off-by: Christophe Leroy --- arch/arm64/include/asm/pgtable.h | 2 +- arch/powerpc/include/asm/nohash/32/pte-8xx.h | 2 +- arch/riscv/include/asm/pgtable.h

[RFC PATCH v2 04/20] mm: Provide mm_struct and address to huge_ptep_get()

2024-05-17 Thread Christophe Leroy
the pmd. In order to be consistent with huge_ptep_get_and_clear(), give mm and address to huge_ptep_get(). Signed-off-by: Christophe Leroy --- v2: Add missing changes in arch implementations --- arch/arm/include/asm/hugetlb-3level.h | 2 +- arch/arm64/include/asm/hugetlb.h | 2 +- arch/arm64

[RFC PATCH v2 06/20] powerpc/8xx: Fix size given to set_huge_pte_at()

2024-05-17 Thread Christophe Leroy
set_huge_pte_at() expects the real page size, not the psize which is the index of the page definition in table mmu_psize_defs[] Fixes: 935d4f0c6dc8 ("mm: hugetlb: add huge page size param to set_huge_pte_at()") Signed-off-by: Christophe Leroy --- arch/powerpc/mm/nohash/8xx.c | 3 +

[RFC PATCH v2 02/20] mm: Provide page size to pte_alloc_huge()

2024-05-17 Thread Christophe Leroy
In order to be able to flag the PMD entry with _PMD_HUGE_8M on powerpc 8xx, provide page size to pte_alloc_huge() and use it through the newly introduced pte_alloc_size(). Signed-off-by: Christophe Leroy --- arch/arm64/mm/hugetlbpage.c | 2 +- arch/parisc/mm/hugetlbpage.c | 2 +- arch

[RFC PATCH v2 07/20] powerpc/8xx: Rework support for 8M pages using contiguous PTE entries

2024-05-17 Thread Christophe Leroy
it is addressing an 8M page, this is required for the HW tablewalk assistance. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 - arch/powerpc/include/asm/hugetlb.h| 11 +++- .../include/asm/nohash/32/hugetlb-8xx.h | 54

[RFC PATCH v2 01/20] mm: Provide pagesize to pmd_populate()

2024-05-17 Thread Christophe Leroy
for use by pte_alloc_huge(). When an architecture doesn't provide pmd_populate_size(), pmd_populate() is used as a fallback. Signed-off-by: Christophe Leroy --- include/linux/mm.h | 12 +++- mm/filemap.c | 2 +- mm/internal.h | 2 +- mm/memory.c| 19

[RFC PATCH v2 20/20] mm: Remove CONFIG_ARCH_HAS_HUGEPD

2024-05-17 Thread Christophe Leroy
powerpc was the only user of CONFIG_ARCH_HAS_HUGEPD and doesn't use it anymore, so remove all related code. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/hugetlbpage.c | 1 - include/linux/hugetlb.h | 6 -- mm/Kconfig| 10 mm/gup.c

[RFC PATCH v2 19/20] powerpc/mm: Remove hugepd leftovers

2024-05-17 Thread Christophe Leroy
All targets have now opted out of CONFIG_ARCH_HAS_HUGEPD so remove left over code. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/hugetlb.h | 7 - arch/powerpc/include/asm/page.h | 6 - arch/powerpc/include/asm/pgtable-be-types.h | 10 - arch/powerpc

[RFC PATCH v2 18/20] powerpc/64s: Use contiguous PMD/PUD instead of HUGEPD

2024-05-17 Thread Christophe Leroy
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 --- arch/powerpc/include

[RFC PATCH v2 17/20] powerpc/e500: Use contiguous PMD instead of hugepd

2024-05-17 Thread Christophe Leroy
. On e500/32, all are at PGD/PMD level and can be handled as cont-PMD. On e500/64, smaller ones are on PMD while bigger ones are on PUD. Again, they can easily be handled as cont-PMD and cont-PUD instead of hugepd. Signed-off-by: Christophe Leroy --- .../powerpc/include/asm/nohash/hugetlb-e500.h | 32

[RFC PATCH v2 16/20] powerpc/e500: Encode hugepage size in PTE bits

2024-05-17 Thread Christophe Leroy
Use U0-U3 bits to encode hugepage size, more exactly page shift. As we start using hugepages at shift 21 (2Mbytes), substract 20 so that it fits into 4 bits. That may change in the future if we want to use smaller hugepages. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash

[RFC PATCH v2 15/20] powerpc/85xx: Switch to 64 bits PGD

2024-05-17 Thread Christophe Leroy
In order to allow leaf PMD entries, switch the PGD to 64 bits entries. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/pgtable-types.h | 4 arch/powerpc/kernel/head_85xx.S | 10 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/powerpc

[RFC PATCH v2 14/20] powerpc/e500: Remove enc field from struct mmu_psize_def

2024-05-17 Thread Christophe Leroy
enc field is hidden behind BOOK3E_PAGESZ_XX macros, and when you look closer you realise that this field is nothing else than the value of shift minus ten. So remove enc field and calculate tsize from shift field. Also remove inc filed which is unused. Signed-off-by: Christophe Leroy --- arch

[RFC PATCH v2 13/20] powerpc/64e: Clean up impossible setups

2024-05-17 Thread Christophe Leroy
All E500 have MMU_FTR_TYPE_FSL_E. So remove all impossible combinations. This leads to removing PPC_HTW_IBM and related exceptions. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/mmu-e500.h | 1 - arch/powerpc/mm/nohash/tlb.c | 148 arch

  1   2   3   4   5   6   7   8   9   10   >