Re: [PATCH v2 3/4] PCI/AER: Fetch information for FTrace

2024-02-02 Thread Wang, Qingshun
On Fri, Feb 02, 2024 at 10:01:40AM -0800, Dan Williams wrote: > Wang, Qingshun wrote: > > Fetch and store the data of 3 more registers: "Link Status", "Device > > Control 2", and "Advanced Error Capabilities and Control". This data is > > needed for external observation to better understand ANFE.

[PATCH] powerpc/pseries/papr-sysparm: use u8 arrays for payloads

2024-02-02 Thread Nathan Lynch via B4 Relay
From: Nathan Lynch Some PAPR system parameter values are formatted by firmware as nul-terminated strings (e.g. LPAR name, shared processor attributes). But the values returned for other parameters, such as processor module info and TLB block invalidate characteristics, are binary data with

Re: [PATCH linux-next 1/3] x86, crash: don't nest CONFIG_CRASH_DUMP ifdef inside CONFIG_KEXEC_CODE ifdef scope

2024-02-02 Thread Nathan Chancellor
This series resolves the build issues I was seeing. Please feel free to carry Tested-by: Nathan Chancellor # build forward if there are any more revisions without drastic changes. On Mon, Jan 29, 2024 at 09:50:31PM +0800, Baoquan He wrote: > Michael pointed out that the #ifdef

Re: [PATCH RFC/RFT v2 4/4] riscv: Stop emitting preventive sfence.vma for new userspace mappings with Svvptc

2024-02-02 Thread Alexandre Ghiti
On Fri, Feb 2, 2024 at 4:42 PM Alexandre Ghiti wrote: > > Hi Andrea, > > On Thu, Feb 1, 2024 at 4:03 PM Andrea Parri wrote: > > > > On Wed, Jan 31, 2024 at 04:59:29PM +0100, Alexandre Ghiti wrote: > > > The preventive sfence.vma were emitted because new mappings must be made > > > visible to the

Re: [PATCH v2 3/4] PCI/AER: Fetch information for FTrace

2024-02-02 Thread Dan Williams
Wang, Qingshun wrote: > Fetch and store the data of 3 more registers: "Link Status", "Device > Control 2", and "Advanced Error Capabilities and Control". This data is > needed for external observation to better understand ANFE. > > Signed-off-by: "Wang, Qingshun" > --- >

[PATCH v2] powerpc/64: Set task pt_regs->link to the LR value on scv entry

2024-02-02 Thread Naveen N Rao
Nysal reported that userspace backtraces are missing in offcputime bcc tool. As an example: $ sudo ./bcc/tools/offcputime.py -uU Tracing off-CPU time (us) of user threads by user stack... Hit Ctrl-C to end. ^C write -python (9107) 8

Re: [PATCH RFC/RFT v2 4/4] riscv: Stop emitting preventive sfence.vma for new userspace mappings with Svvptc

2024-02-02 Thread Alexandre Ghiti
Hi Andrea, On Thu, Feb 1, 2024 at 4:03 PM Andrea Parri wrote: > > On Wed, Jan 31, 2024 at 04:59:29PM +0100, Alexandre Ghiti wrote: > > The preventive sfence.vma were emitted because new mappings must be made > > visible to the page table walker but Svvptc guarantees that xRET act as > > a fence,

Re: Re: [PATCH] powerpc/64: Set LR to a non-NULL value in task pt_regs on scv entry

2024-02-02 Thread Naveen N Rao
On Fri, Feb 02, 2024 at 01:02:39PM +1100, Michael Ellerman wrote: > Segher Boessenkool writes: > > Hi! > > > > On Thu, Jan 25, 2024 at 05:12:28PM +0530, Naveen N Rao wrote: > >> diff --git a/arch/powerpc/kernel/interrupt_64.S > >> b/arch/powerpc/kernel/interrupt_64.S > >> index

Re: [mainline] [linux-next] [6.8-rc1] [FC] [DLPAR] OOps kernel crash after performing dlpar remove test

2024-02-02 Thread Robin Murphy
On 02/02/2024 7:11 am, Tasmiya Nalatwad wrote: Greetings, I have tried reverting some latest commits and tested the issue. I see reverting below commit hits to some other problem which was reported earlier and the patch for fixing that issue is under review 1. Reverted commit : commit

Re: [kvm-unit-tests PATCH v2 1/9] (arm|powerpc|s390x): Makefile: Fix .aux.o generation

2024-02-02 Thread Andrew Jones
On Fri, Feb 02, 2024 at 04:57:32PM +1000, Nicholas Piggin wrote: > Using all prerequisites for the source file results in the build > dying on the second time around with: > > gcc: fatal error: cannot specify ‘-o’ with ‘-c’, ‘-S’ or ‘-E’ with multiple > files > > This is due to auxinfo.h

Re: [PATCH v2] powerpc: iommu: Bring back table group release_ownership() call

2024-02-02 Thread Joerg Roedel
On Fri, Jan 26, 2024 at 09:09:18AM -0600, Shivaprasad G Bhat wrote: > The commit 2ad56efa80db ("powerpc/iommu: Setup a default domain and > remove set_platform_dma_ops") refactored the code removing the > set_platform_dma_ops(). It missed out the table group > release_ownership() call which would

[PATCH v5 25/25] arm64/mm: Automatically fold contpte mappings

2024-02-02 Thread Ryan Roberts
There are situations where a change to a single PTE could cause the contpte block in which it resides to become foldable (i.e. could be repainted with the contiguous bit). Such situations arise, for example, when user space temporarily changes protections, via mprotect, for individual pages, such

[PATCH v5 24/25] arm64/mm: __always_inline to improve fork() perf

2024-02-02 Thread Ryan Roberts
As set_ptes() and wrprotect_ptes() become a bit more complex, the compiler may choose not to inline them. But this is critical for fork() performance. So mark the functions, along with contpte_try_unfold() which is called by them, as __always_inline. This is worth ~1% on the fork() microbenchmark

[PATCH v5 23/25] arm64/mm: Implement pte_batch_hint()

2024-02-02 Thread Ryan Roberts
When core code iterates over a range of ptes and calls ptep_get() for each of them, if the range happens to cover contpte mappings, the number of pte reads becomes amplified by a factor of the number of PTEs in a contpte block. This is because for each call to ptep_get(), the implementation must

[PATCH v5 22/25] mm: Add pte_batch_hint() to reduce scanning in folio_pte_batch()

2024-02-02 Thread Ryan Roberts
Some architectures (e.g. arm64) can tell from looking at a pte, if some follow-on ptes also map contiguous physical memory with the same pgprot. (for arm64, these are contpte mappings). Take advantage of this knowledge to optimize folio_pte_batch() so that it can skip these ptes when scanning to

[PATCH v5 21/25] arm64/mm: Implement new [get_and_]clear_full_ptes() batch APIs

2024-02-02 Thread Ryan Roberts
Optimize the contpte implementation to fix some of the exit/munmap/dontneed performance regression introduced by the initial contpte commit. Subsequent patches will solve it entirely. During exit(), munmap() or madvise(MADV_DONTNEED), mappings must be cleared. Previously this was done 1 PTE at a

[PATCH v5 20/25] arm64/mm: Implement new wrprotect_ptes() batch API

2024-02-02 Thread Ryan Roberts
Optimize the contpte implementation to fix some of the fork performance regression introduced by the initial contpte commit. Subsequent patches will solve it entirely. During fork(), any private memory in the parent must be write-protected. Previously this was done 1 PTE at a time. But the

[PATCH v5 18/25] arm64/mm: Split __flush_tlb_range() to elide trailing DSB

2024-02-02 Thread Ryan Roberts
Split __flush_tlb_range() into __flush_tlb_range_nosync() + __flush_tlb_range(), in the same way as the existing flush_tlb_page() arrangement. This allows calling __flush_tlb_range_nosync() to elide the trailing DSB. Forthcoming "contpte" code will take advantage of this when clearing the young

[PATCH v5 19/25] arm64/mm: Wire up PTE_CONT for user mappings

2024-02-02 Thread Ryan Roberts
With the ptep API sufficiently refactored, we can now introduce a new "contpte" API layer, which transparently manages the PTE_CONT bit for user mappings. In this initial implementation, only suitable batches of PTEs, set via set_ptes(), are mapped with the PTE_CONT bit. Any subsequent

[PATCH v5 14/25] arm64/mm: ptep_clear_flush_young(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 13/25] arm64/mm: ptep_test_and_clear_young(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 12/25] arm64/mm: ptep_get_and_clear(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 11/25] arm64/mm: pte_clear(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 10/25] arm64/mm: set_ptes()/set_pte_at(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 09/25] arm64/mm: set_pte(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 16/25] arm64/mm: ptep_set_access_flags(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 15/25] arm64/mm: ptep_set_wrprotect(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 17/25] arm64/mm: ptep_get(): New layer to manage contig bit

2024-02-02 Thread Ryan Roberts
Create a new layer for the in-table PTE manipulation APIs. For now, The existing API is prefixed with double underscore to become the arch-private API and the public API is just a simple wrapper that calls the private API. The public API implementation will subsequently be used to transparently

[PATCH v5 07/25] x86/mm: Convert pte_next_pfn() to pte_advance_pfn()

2024-02-02 Thread Ryan Roberts
Core-mm needs to be able to advance the pfn by an arbitrary amount, so improve the API to do so and change the name. Signed-off-by: Ryan Roberts --- arch/x86/include/asm/pgtable.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h

[PATCH v5 05/25] arm64/mm: Convert pte_next_pfn() to pte_advance_pfn()

2024-02-02 Thread Ryan Roberts
Core-mm needs to be able to advance the pfn by an arbitrary amount, so improve the API to do so and change the name. Signed-off-by: Ryan Roberts --- arch/arm64/include/asm/pgtable.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h

[PATCH v5 06/25] powerpc/mm: Convert pte_next_pfn() to pte_advance_pfn()

2024-02-02 Thread Ryan Roberts
Core-mm needs to be able to advance the pfn by an arbitrary amount, so improve the API to do so and change the name. Signed-off-by: Ryan Roberts --- arch/powerpc/mm/pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/pgtable.c

[PATCH v5 08/25] mm: Remove pte_next_pfn() and replace with pte_advance_pfn()

2024-02-02 Thread Ryan Roberts
Now that the architectures are converted over to pte_advance_pfn(), we can remove the pte_next_pfn() wrapper and convert the callers to call pte_advance_pfn(). Signed-off-by: Ryan Roberts --- include/linux/pgtable.h | 9 + mm/memory.c | 4 ++-- 2 files changed, 3

[PATCH v5 04/25] arm/mm: Convert pte_next_pfn() to pte_advance_pfn()

2024-02-02 Thread Ryan Roberts
Core-mm needs to be able to advance the pfn by an arbitrary amount, so improve the API to do so and change the name. Signed-off-by: Ryan Roberts --- arch/arm/mm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index

[PATCH v5 03/25] mm: Make pte_next_pfn() a wrapper around pte_advance_pfn()

2024-02-02 Thread Ryan Roberts
The goal is to be able to advance a PTE by an arbitrary number of PFNs. So introduce a new API that takes a nr param. We are going to remove pte_next_pfn() and replace it with pte_advance_pfn(). As a first step, implement pte_next_pfn() as a wrapper around pte_advance_pfn() so that we can

[PATCH v5 02/25] mm: thp: Batch-collapse PMD with set_ptes()

2024-02-02 Thread Ryan Roberts
Refactor __split_huge_pmd_locked() so that a present PMD can be collapsed to PTEs in a single batch using set_ptes(). This should improve performance a little bit, but the real motivation is to remove the need for the arm64 backend to have to fold the contpte entries. Instead, since the ptes are

[PATCH v5 01/25] mm: Clarify the spec for set_ptes()

2024-02-02 Thread Ryan Roberts
set_ptes() spec implies that it can only be used to set a present pte because it interprets the PFN field to increment it. However, set_pte_at() has been implemented on top of set_ptes() since set_ptes() was introduced, and set_pte_at() allows setting a pte to a not-present state. So clarify the

[PATCH v5 00/25] Transparent Contiguous PTEs for User Mappings

2024-02-02 Thread Ryan Roberts
Hi All, This is a series to opportunistically and transparently use contpte mappings (set the contiguous bit in ptes) for user memory when those mappings meet the requirements. The change benefits arm64, but there is some minor refactoring for x86 and powerpc to enable its integration with