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

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

2024-05-17 Thread Christophe Leroy
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. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/nohash/tlb.c | 13 - 1 file changed, 13 deletions(-) diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm

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

2024-05-17 Thread Christophe Leroy
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_alloc() to support any standard cont-PxD setup. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/hugetlbpage.c | 25 - 1

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

2024-05-17 Thread Christophe Leroy
() are used on real pointers and not on on-stack copies. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/pgtable.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index 59f0d7706d2f..51ee508eeb5b 100644

[RFC PATCH v2 09/20] powerpc/mm: Remove _PAGE_PSIZE

2024-05-17 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 --- arch/powerpc/include/asm/nohash/32/pte-40x.h | 3 --- arch/powerpc/include/asm/nohash/32/pte-44x.h

[RFC PATCH v2 08/20] powerpc/8xx: Simplify struct mmu_psize_def

2024-05-17 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 --- arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32

Re: [PATCH v3 3/5] powerpc/64: Convert patch_instruction() to patch_u32()

2024-05-13 Thread Christophe Leroy
Le 14/05/2024 à 04:59, Benjamin Gray a écrit : > On Tue, 2024-04-23 at 15:09 +0530, Naveen N Rao wrote: >> On Mon, Mar 25, 2024 at 04:53:00PM +1100, Benjamin Gray wrote: >>> This use of patch_instruction() is working on 32 bit data, and can >>> fail >>> if the data looks like a prefixed

Re: [PATCH bpf v3] powerpc/bpf: enforce full ordering for ATOMIC operations with BPF_FETCH

2024-05-13 Thread Christophe Leroy
:r7=0) > Observation SB+atomic_add+fetch Never 0 9 > > [1] https://www.kernel.org/doc/Documentation/memory-barriers.txt > [2] https://www.kernel.org/doc/Documentation/atomic_t.txt > > Fixes: 65112709115f ("powerpc/bpf/64: add support for BPF_ATOMIC bitwise > operations"

Re: [PATCH bpf v2] powerpc/bpf: enforce full ordering for ATOMIC operations with BPF_FETCH

2024-05-13 Thread Christophe Leroy
Le 08/05/2024 à 13:54, Puranjay Mohan a écrit : > [Vous ne recevez pas souvent de courriers de puran...@kernel.org. Découvrez > pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > The Linux Kernel Memory Model [1][2] requires RMW operations that have a > return

Re: [PATCH bpf] powerpc/bpf: enforce full ordering for ATOMIC operations with BPF_FETCH

2024-05-13 Thread Christophe Leroy
Le 08/05/2024 à 07:05, Michael Ellerman a écrit : > Puranjay Mohan writes: >> The Linux Kernel Memory Model [1][2] requires RMW operations that have a >> return value to be fully ordered. >> >> BPF atomic operations with BPF_FETCH (including BPF_XCHG and >> BPF_CMPXCHG) return a value back so

Re: About the code updte of the arc/linux/arch/beta/kernel/irq_64.c

2024-05-10 Thread Christophe Leroy
Hi Xia, Le 01/05/2024 à 08:22, 赵夏 a écrit : > Hi Christophe, > >   I identified that the function named "arch_local_irq_restore" of the > file irq_64.c was updated by you frequently in the last two years. You mean arch/powerpc/kernel/irq_64.c I guess ? I don't think I "frequently" changed

Re: [PATCH 1/2] radix/kfence: map __kfence_pool at page granularity

2024-05-07 Thread Christophe Leroy
Le 24/04/2024 à 13:09, Hari Bathini a écrit : > When KFENCE is enabled, total system memory is mapped at page level > granularity. But in radix MMU mode, ~3GB additional memory is needed > to map 100GB of system memory at page level granularity when compared > to using 2MB direct mapping. This

Re: [PATCH 6/7] powerpc: Replace CONFIG_4xx with CONFIG_44x

2024-05-07 Thread Christophe Leroy
Le 06/05/2024 à 14:51, Michael Ellerman a écrit : > Replace 4xx usage with 44x, and replace 4xx_SOC with 44x. You can go one step further because CONFIG_44x implies CONFIG_BOOKE, see

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

2024-05-07 Thread Christophe Leroy
Le 06/05/2024 à 14:19, Athira Rajeev a écrit : > There are cases where define a global register variable and associate it > with a specified register. Example, in powerpc, two registers are > defined to represent variable: > 1. r13: represents local_paca > register struct paca_struct *local_paca

Re: [PATCH V2 7/9] tools/perf: Update instruction tracking with add instruction

2024-05-07 Thread Christophe Leroy
Le 06/05/2024 à 14:19, Athira Rajeev a écrit : > Update instruction tracking with add instruction. Apart from "mr" > instruction, the register state is carried on by other insns, ie, > "add, addi, addis". Since these are not memory instructions and doesn't > fall in the range of (32 to 63), add

Re: [PATCH V2 6/9] tools/perf: Update instruction tracking for powerpc

2024-05-07 Thread Christophe Leroy
Le 06/05/2024 à 14:19, Athira Rajeev a écrit : > Add instruction tracking function "update_insn_state_powerpc" for > powerpc. Example sequence in powerpc: > > ld r10,264(r3) > mr r31,r3 > < > ld r9,312(r31) Your approach looks fragile. mr is a simplified instruction which in

Re: [PATCH V2 5/9] tools/perf: Update parameters for reg extract functions to use raw instruction on powerpc

2024-05-07 Thread Christophe Leroy
Le 06/05/2024 à 14:19, Athira Rajeev a écrit : > Use the raw instruction code and macros to identify memory instructions, > extract register fields and also offset. The implementation addresses > the D-form, X-form, DS-form instructions. Two main functions are added. > New parse function

Re: [PATCH V2 4/9] tools/perf: Add support to capture and parse raw instruction in objdump

2024-05-07 Thread Christophe Leroy
Le 06/05/2024 à 14:19, Athira Rajeev a écrit : > Add support to capture and parse raw instruction in objdump. What's the purpose of using 'objdump' for reading raw instructions ? Can't they be read directly without invoking 'objdump' ? It looks odd to me to use objdump to provide readable

Re: [PATCH v3] kprobe/ftrace: bail out if ftrace was killed

2024-05-06 Thread Christophe Leroy
Le 01/05/2024 à 18:29, Stephen Brennan a écrit : > If an error happens in ftrace, ftrace_kill() will prevent disarming > kprobes. Eventually, the ftrace_ops associated with the kprobes will be > freed, yet the kprobes will still be active, and when triggered, they > will use the freed memory,

Re: [PATCH v4 14/15] kprobes: remove dependency on CONFIG_MODULES

2024-04-19 Thread Christophe Leroy
Le 19/04/2024 à 17:49, Mike Rapoport a écrit : > Hi Masami, > > On Thu, Apr 18, 2024 at 06:16:15AM +0900, Masami Hiramatsu wrote: >> Hi Mike, >> >> On Thu, 11 Apr 2024 19:00:50 +0300 >> Mike Rapoport wrote: >> >>> From: "Mike Rapoport (IBM)" >>> >>> kprobes depended on CONFIG_MODULES because

Re: [0/2] powerpc/powernv/vas: Adjustments for two function implementations

2024-04-16 Thread Christophe Leroy
Le 16/04/2024 à 14:14, Markus Elfring a écrit : >> This is explicit in Kernel documentation: >> >> /** >>* kfree - free previously allocated memory >>* @object: pointer returned by kmalloc() or kmem_cache_alloc() >>* >>* If @object is NULL, no operation is performed. >>*/ >>

Re: [0/2] powerpc/powernv/vas: Adjustments for two function implementations

2024-04-16 Thread Christophe Leroy
Le 16/04/2024 à 13:11, Michael Ellerman a écrit : > Markus Elfring writes: >>> A few update suggestions were taken into account >>> from static source code analysis. >>> >>> Markus Elfring (2): >> >> I would appreciate a bit more information about the reasons >> why this patch series was

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

2024-04-16 Thread Christophe Leroy
Le 15/04/2024 à 21:12, Christophe Leroy a écrit : > > > Le 12/04/2024 à 16:30, Peter Xu a écrit : >> On Fri, Apr 12, 2024 at 02:08:03PM +0000, Christophe Leroy wrote: >>> >>> >>> Le 11/04/2024 à 18:15, Peter Xu a écrit : >>>> On Mon, M

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

2024-04-15 Thread Christophe Leroy
Le 12/04/2024 à 16:30, Peter Xu a écrit : > On Fri, Apr 12, 2024 at 02:08:03PM +0000, Christophe Leroy wrote: >> >> >> Le 11/04/2024 à 18:15, Peter Xu a écrit : >>> On Mon, Mar 25, 2024 at 01:38:40PM -0300, Jason Gunthorpe wrote: >>>> On Mon, Mar 25,

Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG

2024-04-15 Thread Christophe Leroy
Le 15/04/2024 à 17:35, Arnd Bergmann a écrit : > On Mon, Apr 15, 2024, at 04:19, Michael Ellerman wrote: >> "Arnd Bergmann" writes: >>> On Thu, Apr 11, 2024, at 11:27, Adrian Hunter wrote: >>>> On 11/04/24 11:22, Christophe Leroy wrote: >>>>

Re: [PATCH v3 00/12] mm/gup: Unify hugetlb, part 2

2024-04-12 Thread Christophe Leroy
Le 10/04/2024 à 21:58, Peter Xu a écrit : >> >> e500 has two modes: 32 bits and 64 bits. >> >> For 32 bits: >> >> 8xx is the only one handling it through HW-assisted pagetable walk hence >> requiring a 2-level whatever the pagesize is. > > Hmm I think maybe finally I get it.. > > I think the

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

2024-04-12 Thread Christophe Leroy
Le 11/04/2024 à 18:15, Peter Xu a écrit : > On Mon, Mar 25, 2024 at 01:38:40PM -0300, Jason Gunthorpe wrote: >> On Mon, Mar 25, 2024 at 03:55:53PM +0100, Christophe Leroy wrote: >>> This series reimplements hugepages with hugepd on powerpc 8xx. >>> >>> Unlik

Re: [RFC PATCH 2/7] mm: vmalloc: don't account for number of nodes for HUGE_VMAP allocations

2024-04-12 Thread Christophe Leroy
Le 11/04/2024 à 18:05, Mike Rapoport a écrit : > From: "Mike Rapoport (IBM)" > > vmalloc allocations with VM_ALLOW_HUGE_VMAP that do not explictly > specify node ID will use huge pages only if size_per_node is larger than > PMD_SIZE. > Still the actual allocated memory is not distributed

Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG

2024-04-11 Thread Christophe Leroy
Le 11/04/2024 à 10:12, Christophe Leroy a écrit : > > > Le 11/04/2024 à 09:16, Adrian Hunter a écrit : >> On 11/04/24 10:04, Arnd Bergmann wrote: >>> On Wed, Apr 10, 2024, at 17:32, Adrian Hunter wrote: >>>> BUG() does not return, and arch implementa

Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG

2024-04-11 Thread Christophe Leroy
Le 11/04/2024 à 09:16, Adrian Hunter a écrit : > On 11/04/24 10:04, Arnd Bergmann wrote: >> On Wed, Apr 10, 2024, at 17:32, Adrian Hunter wrote: >>> BUG() does not return, and arch implementations of BUG() use unreachable() >>> or other non-returning code. However with !CONFIG_BUG, the default

Re: [PATCH v3 00/12] mm/gup: Unify hugetlb, part 2

2024-04-10 Thread Christophe Leroy
Le 10/04/2024 à 17:28, Peter Xu a écrit : > On Tue, Apr 09, 2024 at 08:43:55PM -0300, Jason Gunthorpe wrote: >> On Fri, Apr 05, 2024 at 05:42:44PM -0400, Peter Xu wrote: >>> In short, hugetlb mappings shouldn't be special comparing to other huge pXd >>> and large folio (cont-pXd) mappings for

Re: [PATCH] powerpc: align memory_limit to 16MB in early_parse_mem

2024-04-10 Thread Christophe Leroy
Le 10/04/2024 à 17:22, Joel Savitz a écrit : > [Vous ne recevez pas souvent de courriers de jsav...@redhat.com. Découvrez > pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] > > On Mon, Apr 1, 2024 at 10:17 AM Joel Savitz wrote: >> >> On Tue, Mar 26, 2024 at 12:45 

Re: [PATCH] cpufreq: Covert to exit callback returning void

2024-04-10 Thread Christophe Leroy
Le 10/04/2024 à 15:42, lizhe a écrit : > > Hi, >      I have already tested it, it is functioning properly, Please review. > > *Lizhe* > >                      Thanks > Please don't top-post, see

Re: [RESEND PATCH net v4 1/2] soc: fsl: qbman: Always disable interrupts when taking cgr_lock

2024-04-09 Thread Christophe Leroy
Hi Vladimir, Le 19/02/2024 à 16:30, Vladimir Oltean a écrit : > Hi Sean, > > On Thu, Feb 15, 2024 at 11:23:26AM -0500, Sean Anderson wrote: >> smp_call_function_single disables IRQs when executing the callback. To >> prevent deadlocks, we must disable IRQs when taking cgr_lock elsewhere. >> This

Re: [PATCH 2/2] MAINTAINERS: Make cxl obsolete

2024-04-08 Thread Christophe Leroy
Le 09/04/2024 à 06:37, Michael Ellerman a écrit : > Andrew Donnellan writes: >> The cxl driver is no longer actively maintained and we intend to remove it >> in a future kernel release. Change its status to obsolete, and update the >> sysfs ABI documentation accordingly. >> >> Signed-off-by:

Re: [FSL P50x0] Kernel 6.9-rc1 compiling issue

2024-04-04 Thread Christophe Leroy
Hi Christian, hi Hari, Le 04/04/2024 à 19:44, Christian Zigotzky a écrit : > Shall we use CONFIG_CRASH_DUMP to get int crashing_cpu = -1;? > > Further information: > https://lists.ozlabs.org/pipermail/linuxppc-dev/2024-March/269985.html >

Re: [PATCH 1/2] powerpc: Apply __always_inline to interrupt_{enter,exit}_prepare()

2024-04-04 Thread Christophe Leroy
will inheret instrumentation from their caller. > > KCSAN kernels were observed to compile without inlining these routines, > which would lead to grief on NMI handlers. > > Signed-off-by: Rohan McLure Reviewed-by: Christophe Leroy > --- > arch/powerpc/include/asm/interru

Re: [PATCH 2/2] powerpc/64: Only warn for kuap locked when KCSAN not present

2024-04-04 Thread Christophe Leroy
Le 04/04/2024 à 06:45, Rohan McLure a écrit : > Arbitrary instrumented locations, including syscall handlers, can call > arch_local_irq_restore() transitively when KCSAN is enabled, and in turn > also replay_soft_interrupts_irqrestore(). The precondition on entry to > this routine that is

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

2024-04-03 Thread Christophe Leroy
Le 27/03/2024 à 17:57, Jason Gunthorpe a écrit : > On Wed, Mar 27, 2024 at 09:58:35AM +0000, Christophe Leroy wrote: >>> Just general remarks on the ones with huge pages: >>> >>>hash 64k and hugepage 16M/16G >>>radix 64k/radix hugepage 2M/

Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback

2024-04-03 Thread Christophe Leroy
Le 03/04/2024 à 15:07, Jason Gunthorpe a écrit : > On Wed, Apr 03, 2024 at 12:26:43PM +0000, Christophe Leroy wrote: >> >> >> Le 03/04/2024 à 14:08, Jason Gunthorpe a écrit : >>> On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: >>>> On Tu

Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback

2024-04-03 Thread Christophe Leroy
Le 03/04/2024 à 14:08, Jason Gunthorpe a écrit : > On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: >> On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote: >>> On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote: >>> I actually tested this without hitting the issue

Re: [PATCH 01/34] powerpc/fsl-soc: hide unused const variable

2024-04-03 Thread Christophe Leroy
_PARAVIRT for hcalls") > Signed-off-by: Arnd Bergmann Reviewed-by: Christophe Leroy > --- > arch/powerpc/sysdev/fsl_msi.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c > index 8e6c84df4ca1..

Re: [PATCH v3 2/2] powerpc/bpf: enable kfunc call

2024-04-02 Thread Christophe Leroy
Le 02/04/2024 à 12:58, Hari Bathini a écrit : > Currently, bpf jit code on powerpc assumes all the bpf functions and > helpers to be kernel text. This is false for kfunc case, as function > addresses can be module addresses as well. So, ensure module addresses > are supported to enable kfunc

Re: [PATCH v3 1/2] powerpc64/bpf: fix tail calls for PCREL addressing

2024-04-02 Thread Christophe Leroy
Le 02/04/2024 à 12:58, Hari Bathini a écrit : > With PCREL addressing, there is no kernel TOC. So, it is not setup in > prologue when PCREL addressing is used. But the number of instructions > to skip on a tail call was not adjusted accordingly. That resulted in > not so obvious failures while

Re: [PATCH v11 00/11] Support page table check PowerPC

2024-03-29 Thread Christophe Leroy
Le 28/03/2024 à 08:57, Christophe Leroy a écrit : > > > Le 28/03/2024 à 07:52, Christophe Leroy a écrit : >> >> >> Le 28/03/2024 à 05:55, Rohan McLure a écrit : >>> Support page table check on all PowerPC platforms. This works by >>> serialising

Re: [PATCH v11 00/11] Support page table check PowerPC

2024-03-28 Thread Christophe Leroy
Le 28/03/2024 à 07:52, Christophe Leroy a écrit : > > > Le 28/03/2024 à 05:55, Rohan McLure a écrit : >> Support page table check on all PowerPC platforms. This works by >> serialising assignments, reassignments and clears of page table >> entries at ea

Re: [PATCH v11 00/11] Support page table check PowerPC

2024-03-28 Thread Christophe Leroy
Le 28/03/2024 à 05:55, Rohan McLure a écrit : > Support page table check on all PowerPC platforms. This works by > serialising assignments, reassignments and clears of page table > entries at each level in order to ensure that anonymous mappings > have at most one writable consumer, and likewise

Re: [PATCH v11 09/11] poweprc: mm: Implement *_user_accessible_page() for ptes

2024-03-27 Thread Christophe Leroy
Le 28/03/2024 à 05:55, Rohan McLure a écrit : > Page table checking depends on architectures providing an > implementation of p{te,md,ud}_user_accessible_page. With > refactorisations made on powerpc/mm, the pte_access_permitted() and > similar methods verify whether a userland page is

Re: [PATCH v11 08/11] powerpc: mm: Add pud_pfn() stub

2024-03-27 Thread Christophe Leroy
Le 28/03/2024 à 05:55, Rohan McLure a écrit : > The page table check feature requires that pud_pfn() be defined > on each consuming architecture. Since only 64-bit, Book3S platforms > allow for hugepages at this upper level, and since the calling code is > gated by a call to

  1   2   3   4   5   6   7   8   9   10   >