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

2024-05-27 Thread Oscar Salvador
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 sz > if (pte_end < end) > end = pte_end; > > - pte = huge_ptep_get(pte

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

2024-05-27 Thread Oscar Salvador
On Mon, May 27, 2024 at 03:30:01PM +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 entry itself because there is no easy way to know it from the > content of the entry. > >

[PATCH v3] powerpc/perf: Set cpumode flags using sample address

2024-05-27 Thread Anjali K
Currently in some cases, when the sampled instruction address register latches to a specific address during sampling, the privilege bits captured in the sampled event register are incorrect. For example, a snippet from the perf report on a power10 system is: Overhead Address Command

[PATCH AUTOSEL 6.6 4/4] kprobe/ftrace: bail out if ftrace was killed

2024-05-27 Thread Sasha Levin
From: Stephen Brennan [ Upstream commit 1a7d0890dd4a502a202aaec792a6c04e6e049547 ] 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 wil

[PATCH AUTOSEL 6.9 5/5] kprobe/ftrace: bail out if ftrace was killed

2024-05-27 Thread Sasha Levin
From: Stephen Brennan [ Upstream commit 1a7d0890dd4a502a202aaec792a6c04e6e049547 ] 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 wil

[PATCH AUTOSEL 6.8 4/4] kprobe/ftrace: bail out if ftrace was killed

2024-05-27 Thread Sasha Levin
From: Stephen Brennan [ Upstream commit 1a7d0890dd4a502a202aaec792a6c04e6e049547 ] 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 wil

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

2024-05-27 Thread Oscar Salvador
On Mon, May 27, 2024 at 03:51:41PM +, Christophe Leroy wrote: > We could be is that worth the churn ? Probably not. > With patch 1 there was only one callsite. Yes, you are right here. > Here we have many callsites, and we also have huge_ptep_get_and_clear() > which already takes three arg

[PATCH AUTOSEL 4.19 1/2] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

[PATCH AUTOSEL 5.4 2/3] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

[PATCH AUTOSEL 4.19 2/2] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 5.10 7/7] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 5.4 3/3] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 5.10 6/7] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

[PATCH AUTOSEL 5.15 6/6] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 6.1 08/11] powerpc: make fadump resilient with memory add/remove events

2024-05-27 Thread Sasha Levin
From: Sourabh Jain [ Upstream commit c6c5b14dac0d1bd0da8b4d1d3b77f18eb9085fcb ] Due to changes in memory resources caused by either memory hotplug or online/offline events, the elfcorehdr, which describes the CPUs and memory of the crashed kernel to the kernel that collects the dump (known as se

[PATCH AUTOSEL 5.15 5/6] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

[PATCH AUTOSEL 6.6 15/16] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 6.1 10/11] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 6.6 11/16] powerpc: make fadump resilient with memory add/remove events

2024-05-27 Thread Sasha Levin
From: Sourabh Jain [ Upstream commit c6c5b14dac0d1bd0da8b4d1d3b77f18eb9085fcb ] Due to changes in memory resources caused by either memory hotplug or online/offline events, the elfcorehdr, which describes the CPUs and memory of the crashed kernel to the kernel that collects the dump (known as se

[PATCH AUTOSEL 6.1 09/11] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

[PATCH AUTOSEL 6.6 12/16] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

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 entry itself because there is no ea

[PATCH AUTOSEL 6.8 16/20] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

[PATCH AUTOSEL 6.9 22/23] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 6.9 19/23] powerpc/pseries: Enforce hcall result buffer validity and size

2024-05-27 Thread Sasha Levin
From: Nathan Lynch [ Upstream commit ff2e185cf73df480ec69675936c4ee75a445c3e4 ] plpar_hcall(), plpar_hcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no id

[PATCH AUTOSEL 6.8 15/20] powerpc: make fadump resilient with memory add/remove events

2024-05-27 Thread Sasha Levin
From: Sourabh Jain [ Upstream commit c6c5b14dac0d1bd0da8b4d1d3b77f18eb9085fcb ] Due to changes in memory resources caused by either memory hotplug or online/offline events, the elfcorehdr, which describes the CPUs and memory of the crashed kernel to the kernel that collects the dump (known as se

[PATCH AUTOSEL 6.8 19/20] powerpc/io: Avoid clang null pointer arithmetic warnings

2024-05-27 Thread Sasha Levin
From: Michael Ellerman [ Upstream commit 03c0f2c2b2220fc9cf8785cd7b61d3e71e24a366 ] With -Wextra clang warns about pointer arithmetic using a null pointer. When building with CONFIG_PCI=n, that triggers a warning in the IO accessors, eg: In file included from linux/arch/powerpc/include/asm/io

[PATCH AUTOSEL 6.9 18/23] powerpc: make fadump resilient with memory add/remove events

2024-05-27 Thread Sasha Levin
From: Sourabh Jain [ Upstream commit c6c5b14dac0d1bd0da8b4d1d3b77f18eb9085fcb ] Due to changes in memory resources caused by either memory hotplug or online/offline events, the elfcorehdr, which describes the CPUs and memory of the crashed kernel to the kernel that collects the dump (known as se

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

2024-05-27 Thread Peter Xu
On Mon, May 27, 2024 at 06:03:30AM +, Christophe Leroy wrote: > > > 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 > Documentatio

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

2024-05-27 Thread Peter Xu
On Fri, May 24, 2024 at 02:46:58PM +1000, Michael Ellerman wrote: > Christophe is a powerpc developer :) Yes, definitely. :) > > I'll help where I can, but I don't know the hugepd code that well, I've > never really worked on it before. Nick will hopefully also be able to > help, he at least kno

[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/g

[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 topo

[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/po

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

2024-05-27 Thread Christophe Leroy
Building on 32 bits with pmd_leaf() not returning always false leads to the following error: CC arch/powerpc/mm/pgtable.o arch/powerpc/mm/pgtable.c: In function '__find_linux_pte': arch/powerpc/mm/pgtable.c:506:1: error: function may return address of local variable [-Werror=return-local-a

[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/inclu

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

2024-05-27 Thread Christophe Leroy
e500 supports many page sizes among which the following size are implemented in the kernel at the time being: 4M, 16M, 64M, 256M, 1G. On e500, TLB miss for hugepages is exclusively handled by SW even on e6500 which has HW assistance for 4k pages, so there are no constraints like on the 8xx. On e5

[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/head

[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/incl

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

2024-05-27 Thread Christophe Leroy
On book3s/64, the only user of hugepd is hash in 4k mode. All other setups (hash-64, radix-4, radix-64) use leaf PMD/PUD. Rework hash-4k to use contiguous PMD and PUD instead. In that setup there are only two huge page sizes: 16M and 16G. 16M sits at PMD level and 16G at PUD level. pte_update

[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-b

[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/hu

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

2024-05-27 Thread Christophe Leroy
In order to fit better with standard Linux page tables layout, add support for 8M pages using contiguous PTE entries in a standard page table. Page tables will then be populated with 1024 similar entries and two PMD entries will point to that page table. The PMD entries also get a flag to tell it

[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: Oscar Salvador --- arc

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

2024-05-27 Thread Christophe Leroy
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 entry itself because there is no easy way to know it from the content of the entry. So huge_ptep_get() will need to know either the size of the page or get the p

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

2024-05-27 Thread Christophe Leroy
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 Also see https://github.com/linuxppc/issues/issues/483 Unlike most architectures, powerpc 8xx HW requires a two-level pa

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

2024-05-27 Thread Christophe Leroy
On powerpc 8xx, when a page is 8M size, the information is in the PMD entry. So allow architectures to provide __pte_leaf_size() instead of pte_leaf_size() and provide the PMD entry to that function. When __pte_leaf_size() is not defined, define it as a pte_leaf_size() so that architectures not in

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

2024-05-27 Thread Christophe Leroy
From: Michael Ellerman This is a squash of series from Michael https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20240524073141.1637736-1-...@ellerman.id.au/ The nohash HTW_IBM (Hardware Table Walk) code is unused since support for A2 was removed in commit fb5a515704d7 ("powerpc: Remove p

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

2024-05-27 Thread Oscar Salvador
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 > page table. Page tables will then be populated with 1024 similar > entries and two PMD entries w

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

2024-05-27 Thread Oscar Salvador
On Sun, May 26, 2024 at 11:22:26AM +0200, Christophe Leroy wrote: > 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 Revie

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

2024-05-27 Thread Oscar Salvador
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 > arch/powerpc/mm/pgtable.c: In function '__find_linux_pte': > arch/powerpc/mm/pgtable.c:506:1:

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

2024-05-27 Thread Oscar Salvador
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 entry itself because there is no easy way to know it from the > content of the entry. > >

Re: [PATCH v2] powerpc/perf: Set cpumode flags using sample address

2024-05-27 Thread Anjali K
On 24/05/24 12:55, Michael Ellerman wrote: > Hi Anjali, > > Anjali K writes: >> Currently in some cases, when the sampled instruction address register >> latches to a specific address during sampling, there is an inconsistency >> in the privilege bits captured in the sampled event register. >

[PATCH] powerpc/eeh: avoid possible crash when edev->pdev changes

2024-05-27 Thread Ganesh Goudar
If a PCI device is removed during eeh_pe_report_edev(), edev->pdev will change and can cause a crash, hold the PCI rescan/remove lock while taking a copy of edev->pdev. Signed-off-by: Ganesh Goudar --- arch/powerpc/kernel/eeh_pe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerp

Re: [PATCH v15 00/16] Add audio support in v4l2 framework

2024-05-27 Thread Jaroslav Kysela
On 16. 05. 24 16:50, Jaroslav Kysela wrote: On 15. 05. 24 22:33, Nicolas Dufresne wrote: In GFX, they solve this issue with fences. That allow setting up the next operation in the chain before the data has been produced. The fences look really nicely and seem more modern. It should be possib