[PATCH v2 24/25] mm: make range-to-target_node lookup facility a part of numa_memblks

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" The x86 implementation of range-to-target_node lookup (i.e. phys_to_target_node() and memory_add_physaddr_to_nid()) relies on numa_memblks. Since numa_memblks are now part of the generic code, move these functions from x86 to mm/numa_memblks.c and select CONFIG_

[PATCH v2 23/25] arch_numa: switch over to numa_memblks

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Until now arch_numa was directly translating firmware NUMA information to memblock. Using numa_memblks as an intermediate step has a few advantages: * alignment with more battle tested x86 implementation * availability of NUMA emulation * maintaining node inform

[PATCH v2 22/25] mm: numa_memblks: use memblock_{start,end}_of_DRAM() when sanitizing meminfo

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" numa_cleanup_meminfo() moves blocks outside system RAM to numa_reserved_meminfo and it uses 0 and PFN_PHYS(max_pfn) to determine the memory boundaries. Replace the memory range boundaries with more portable memblock_start_of_DRAM() and memblock_end_of_DRAM(). S

[PATCH v2 21/25] mm: numa_memblks: make several functions and variables static

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Make functions and variables that are exclusively used by numa_memblks static. Move numa_nodemask_from_meminfo() before its callers to avoid forward declaration. Signed-off-by: Mike Rapoport (Microsoft) --- include/linux/numa_memblks.h | 8 mm/numa_

[PATCH v2 20/25] mm: numa_memblks: introduce numa_memblks_init

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Move most of x86::numa_init() to numa_memblks so that the latter will be more self-contained. With this numa_memblk data structures should not be exposed to the architecture specific code. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/mm/numa.c

[PATCH v2 19/25] mm: introduce numa_emulation

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Move numa_emulation codfrom arch/x86 to mm/numa_emulation.c This code will be later reused by arch_numa. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/Kconfig | 8 arch/x86/include/asm/numa.h

[PATCH v2 18/25] mm: move numa_distance and related code from x86 to numa_memblks

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Move code dealing with numa_distance array from arch/x86 to mm/numa_memblks.c This code will be later reused by arch_numa. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/include/asm/numa.h | 2 - arch/x86/mm/numa.c

[PATCH v2 17/25] mm: introduce numa_memblks

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Move code dealing with numa_memblks from arch/x86 to mm/ and add Kconfig options to let x86 select it in its Kconfig. This code will be later reused by arch_numa. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/Kconfig

[PATCH v2 16/25] x86/numa: numa_{add,remove}_cpu: make cpu parameter unsigned

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" CPU id cannot be negative. Making it unsigned also aligns with declarations in include/asm-generic/numa.h used by arm64 and riscv and allows sharing numa emulation code with these architectures. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Ca

[PATCH v2 15/25] x86/numa_emu: use a helper function to get MAX_DMA32_PFN

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" This is required to make numa emulation code architecture independent so that it can be moved to generic code in following commits. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 1 + arch/x86/mm/numa

[PATCH v2 14/25] x86/numa_emu: split __apicid_to_node update to a helper function

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" This is required to make numa emulation code architecture independent so that it can be moved to generic code in following commits. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 2 ++ arch/x86/mm/nu

[PATCH v2 13/25] x86/numa_emu: simplify allocation of phys_dist

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" By the time numa_emulation() is called, all physical memory is already mapped in the direct map and there is no need to define limits for memblock allocation. Replace memblock_phys_alloc_range() with memblock_alloc(). Signed-off-by: Mike Rapoport (Microsoft) R

[PATCH v2 12/25] x86/numa: move FAKE_NODE_* defines to numa_emu

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" The definitions of FAKE_NODE_MIN_SIZE and FAKE_NODE_MIN_HASH_MASK are only used by numa emulation code, make them local to arch/x86/mm/numa_emulation.c Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jonathan Cameron --- arch/x86/include/asm/numa.h | 2

[PATCH v2 11/25] x86/numa: use get_pfn_range_for_nid to verify that node spans memory

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Instead of looping over numa_meminfo array to detect node's start and end addresses use get_pfn_range_for_init(). This is shorter and make it easier to lift numa_memblks to generic code. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/mm/numa.c | 13 +++

[PATCH v2 10/25] x86/numa: simplify numa_distance allocation

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Allocation of numa_distance uses memblock_phys_alloc_range() to limit allocation to be below the last mapped page. But NUMA initializaition runs after the direct map is populated and there is also code in setup_arch() that adjusts memblock limit to reflect how m

[PATCH v2 09/25] arch, mm: pull out allocation of NODE_DATA to generic code

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Architectures that support NUMA duplicate the code that allocates NODE_DATA on the node-local memory with slight variations in reporting of the addresses where the memory was allocated. Use x86 version as the basis for the generic alloc_node_data() function and

[PATCH v2 08/25] arch, mm: move definition of node_data to generic code

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Every architecture that supports NUMA defines node_data in the same way: struct pglist_data *node_data[MAX_NUMNODES]; No reason to keep multiple copies of this definition and its forward declarations, especially when such forward declaration is the only

[PATCH v2 07/25] mm: drop CONFIG_HAVE_ARCH_NODEDATA_EXTENSION

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" There are no users of HAVE_ARCH_NODEDATA_EXTENSION left, so arch_alloc_nodedata() and arch_refresh_nodedata() are not needed anymore. Replace the call to arch_alloc_nodedata() in free_area_init() with memblock_alloc(), remove arch_refresh_nodedata() and cleanup

[PATCH v2 06/25] MIPS: loongson64: drop HAVE_ARCH_NODEDATA_EXTENSION

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Commit f8f9f21c7848 ("MIPS: Fix build error for loongson64 and sgi-ip27") added HAVE_ARCH_NODEDATA_EXTENSION to loongson64 to silence a compilation error that happened because loongson64 didn't define array of pg_data_t as node_data like most other architectures

[PATCH v2 05/25] MIPS: loongson64: rename __node_data to node_data

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Make definition of node_data match other architectures. This will allow pulling declaration of node_data to the generic mm code in the following commit. Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Jiaxun Yang Reviewed-by: David Hildenbrand Reviewed-

[PATCH v2 04/25] MIPS: sgi-ip27: drop HAVE_ARCH_NODEDATA_EXTENSION

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Commit f8f9f21c7848 ("MIPS: Fix build error for loongson64 and sgi-ip27") added HAVE_ARCH_NODEDATA_EXTENSION to sgi-ip27 to silence a compilation error that happened because sgi-ip27 didn't define array of pg_data_t as node_data like most other architectures did.

[PATCH v2 03/25] MIPS: sgi-ip27: ensure node_possible_map only contains valid nodes

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" For SGI IP27 machines node_possible_map is statically set to NODE_MASK_ALL and it is not updated during NUMA initialization. Ensure that it only contains nodes present in the system. Signed-off-by: Mike Rapoport (Microsoft) --- arch/mips/sgi-ip27/ip27-smp.c |

[PATCH v2 02/25] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" sgi-ip27 is the only system that defines NODE_DATA() differently than the rest of NUMA machines. Add node_data array of struct pglist pointers that will point to __node_data[node]->pglist and redefine NODE_DATA() to use node_data array. This will allow pulling

[PATCH v2 01/25] mm: move kernel/numa.c to mm/

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" The stub functions in kernel/numa.c belong to mm/ rather than to kernel/ Signed-off-by: Mike Rapoport (Microsoft) Acked-by: David Hildenbrand Reviewed-by: Jonathan Cameron --- kernel/Makefile | 1 - mm/Makefile | 1 + {kernel => mm}/numa.c |

[PATCH v2 00/25] mm: introduce numa_memblks

2024-07-22 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Hi, Following the discussion about handling of CXL fixed memory windows on arm64 [1] I decided to bite the bullet and move numa_memblks from x86 to the generic code so they will be available on arm64/riscv and maybe on loongarch sometime later. While it could b

[PATCH] perf vendor events power10: Update JSON/events

2024-07-22 Thread Kajol Jain
Update JSON/events for power10 platform with additional events. Also move PM_VECTOR_LD_CMPL event from others.json to frontend.json file. Signed-off-by: Kajol Jain --- .../arch/powerpc/power10/frontend.json| 5 + .../arch/powerpc/power10/others.json | 100 +- 2

Re: [PATCH v4 17/29] arm64: implement PKEYS support

2024-07-22 Thread Anshuman Khandual
On 5/3/24 18:31, Joey Gouly wrote: > Implement the PKEYS interface, using the Permission Overlay Extension. This commit message should contain some more details here considering the amount of code change proposed in this patch. > > Signed-off-by: Joey Gouly > Cc: Catalin Marinas > Cc: Will Dea

Re: [PATCH 04/17] arch, mm: move definition of node_data to generic code

2024-07-22 Thread Davidlohr Bueso
On Tue, 16 Jul 2024, Mike Rapoport wrote:\n From: "Mike Rapoport (Microsoft)" Every architecture that supports NUMA defines node_data in the same way: struct pglist_data *node_data[MAX_NUMNODES]; No reason to keep multiple copies of this definition and its forward declarations, especi

Re: [PATCH v2] cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros

2024-07-22 Thread Michael Ellerman
Jeff Johnson writes: > With ARCH=powerpc, make allmodconfig && make W=1 C=1 reports: > WARNING: modpost: missing MODULE_DESCRIPTION() in > drivers/cpufreq/ppc-cbe-cpufreq.o > WARNING: modpost: missing MODULE_DESCRIPTION() in > drivers/cpufreq/powernv-cpufreq.o > > Add the missing invocation of t

PCI: Work around PCIe link training failures

2024-07-22 Thread Matthew W Carlis
Sorry to resurrect this one, but I was wondering why the PCI device ID in drivers/pci/quirks.c for the ASMedia ASM2824 isn't checked before forcing the link down to Gen1... We have had to revert this patch during our kernel migration due to it interacting poorly with at least one older Gen3 PLX PCI

Re: PCI: Work around PCIe link training failures

2024-07-22 Thread Maciej W. Rozycki
[+cc Ilpo for his previous involvement here] On Mon, 22 Jul 2024, Matthew W Carlis wrote: > Sorry to resurrect this one, but I was wondering why the > PCI device ID in drivers/pci/quirks.c for the ASMedia ASM2824 > isn't checked before forcing the link down to Gen1... We have > had to revert this

[PATCH v2] cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros

2024-07-22 Thread Jeff Johnson
With ARCH=powerpc, make allmodconfig && make W=1 C=1 reports: WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/cpufreq/ppc-cbe-cpufreq.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/cpufreq/powernv-cpufreq.o Add the missing invocation of the MODULE_DESCRIPTION() macro to al

Re: [PATCH] soc/fsl/qbman: remove unused struct 'cgr_comp'

2024-07-22 Thread Christophe Leroy
Le 22/07/2024 à 09:24, Michael Ellerman a écrit : "Dr. David Alan Gilbert" writes: * Sean Anderson (sean.ander...@linux.dev) wrote: On 5/28/24 19:11, li...@treblig.org wrote: From: "Dr. David Alan Gilbert" 'cgr_comp' has been unused since commit 96f413f47677 ("soc/fsl/qbman: fix issue in

Re: [PATCH RFC 0/6] mm: THP-agnostic refactor on huge mappings

2024-07-22 Thread Peter Xu
On Mon, Jul 22, 2024 at 03:29:43PM +0200, David Hildenbrand wrote: > On 18.07.24 00:02, Peter Xu wrote: > > This is an RFC series, so not yet for merging. Please don't be scared by > > the code changes: most of them are code movements only. > > > > This series is based on the dax mprotect fix ser

Re: [PATCH] cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros

2024-07-22 Thread Jeff Johnson
On 7/22/2024 12:13 AM, Michael Ellerman wrote: > Jeff Johnson writes: >> With ARCH=powerpc, make allmodconfig && make W=1 C=1 reports: >> WARNING: modpost: missing MODULE_DESCRIPTION() in >> drivers/cpufreq/ppc-cbe-cpufreq.o >> WARNING: modpost: missing MODULE_DESCRIPTION() in >> drivers/cpufreq

Re: [PATCH v5 17/21] mm/mmap: Relocate arch_unmap() to vms_complete_munmap_vmas()

2024-07-22 Thread Lorenzo Stoakes
On Wed, Jul 17, 2024 at 04:07:05PM GMT, Liam R. Howlett wrote: > From: "Liam R. Howlett" > > The arch_unmap call was previously moved above the rbtree modifications > in commit 5a28fc94c914 ("x86/mpx, mm/core: Fix recursive munmap() > corruption"). The move was motivated by an issue with calling

Re: [PATCH v4 06/29] arm64: context switch POR_EL0 register

2024-07-22 Thread Kevin Brodsky
On 03/05/2024 15:01, Joey Gouly wrote: > @@ -371,6 +382,9 @@ int copy_thread(struct task_struct *p, const struct > kernel_clone_args *args) > if (system_supports_tpidr2()) > p->thread.tpidr2_el0 = read_sysreg_s(SYS_TPIDR2_EL0); > > + if (system_sup

Re: [PATCH v4 17/29] arm64: implement PKEYS support

2024-07-22 Thread Kevin Brodsky
On 05/07/2024 18:59, Catalin Marinas wrote: > On Fri, May 03, 2024 at 02:01:35PM +0100, Joey Gouly wrote: >> @@ -163,7 +182,8 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t >> phys) >> #define pte_access_permitted_no_overlay(pte, write) \ >> (((pte_val(pte) & (PTE_VALID | PTE_USER))

Re: [PATCH RFC 0/6] mm: THP-agnostic refactor on huge mappings

2024-07-22 Thread David Hildenbrand
On 18.07.24 00:02, Peter Xu wrote: This is an RFC series, so not yet for merging. Please don't be scared by the code changes: most of them are code movements only. This series is based on the dax mprotect fix series here (while that one is based on mm-unstable): [PATCH v3 0/8] mm/mprotect:

Re: [PATCH v4 18/29] arm64: add POE signal support

2024-07-22 Thread Anshuman Khandual
On 5/3/24 18:31, Joey Gouly wrote: > Add PKEY support to signals, by saving and restoring POR_EL0 from the > stackframe. > > Signed-off-by: Joey Gouly > Cc: Catalin Marinas > Cc: Will Deacon > Reviewed-by: Mark Brown > Acked-by: Szabolcs Nagy Reviewed-by: Anshuman Khandual > --- > arc

Re: [PATCH 00/17] mm: introduce numa_memblks

2024-07-22 Thread Mike Rapoport
On Fri, Jul 19, 2024 at 02:33:47PM +0100, Jonathan Cameron wrote: > On Tue, 16 Jul 2024 14:13:29 +0300 > Mike Rapoport wrote: > > > From: "Mike Rapoport (Microsoft)" > > > > Hi, > > > > Following the discussion about handling of CXL fixed memory windows on > > arm64 [1] I decided to bite the b

Re: [PATCH 15/17] mm: make numa_memblks more self-contained

2024-07-22 Thread Mike Rapoport
On Fri, Jul 19, 2024 at 07:07:12PM +0100, Jonathan Cameron wrote: > On Tue, 16 Jul 2024 14:13:44 +0300 > Mike Rapoport wrote: > > > From: "Mike Rapoport (Microsoft)" > > > > Introduce numa_memblks_init() and move some code around to avoid several > > global variables in numa_memblks. > > Hi Mi

Re: [PATCH 12/17] mm: introduce numa_memblks

2024-07-22 Thread Mike Rapoport
On Fri, Jul 19, 2024 at 07:16:47PM +0100, Jonathan Cameron wrote: > On Tue, 16 Jul 2024 14:13:41 +0300 > Mike Rapoport wrote: > > > From: "Mike Rapoport (Microsoft)" > > > > Move code dealing with numa_memblks from arch/x86 to mm/ and add Kconfig > > options to let x86 select it in its Kconfig.

Re: [PATCH 06/17] x86/numa: simplify numa_distance allocation

2024-07-22 Thread Mike Rapoport
On Fri, Jul 19, 2024 at 05:28:49PM +0100, Jonathan Cameron wrote: > On Tue, 16 Jul 2024 14:13:35 +0300 > Mike Rapoport wrote: > > > From: "Mike Rapoport (Microsoft)" > > > > Allocation of numa_distance uses memblock_phys_alloc_range() to limit > > allocation to be below the last mapped page. >

Re: [PATCH 02/17] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures

2024-07-22 Thread Mike Rapoport
On Fri, Jul 19, 2024 at 03:38:52PM +0100, Jonathan Cameron wrote: > On Wed, 17 Jul 2024 16:32:59 +0200 > David Hildenbrand wrote: > > > On 16.07.24 13:13, Mike Rapoport wrote: > > > From: "Mike Rapoport (Microsoft)" > > > > > > sgi-ip27 is the only system that defines NODE_DATA() differently th

Re: [PATCH] soc/fsl/qbman: remove unused struct 'cgr_comp'

2024-07-22 Thread Michael Ellerman
"Dr. David Alan Gilbert" writes: > * Sean Anderson (sean.ander...@linux.dev) wrote: >> On 5/28/24 19:11, li...@treblig.org wrote: >> > From: "Dr. David Alan Gilbert" >> > >> > 'cgr_comp' has been unused since >> > commit 96f413f47677 ("soc/fsl/qbman: fix issue in >> > qman_delete_cgr_safe()"). >

Re: [PATCH] cpufreq: powerpc: add missing MODULE_DESCRIPTION() macros

2024-07-22 Thread Michael Ellerman
Jeff Johnson writes: > With ARCH=powerpc, make allmodconfig && make W=1 C=1 reports: > WARNING: modpost: missing MODULE_DESCRIPTION() in > drivers/cpufreq/ppc-cbe-cpufreq.o > WARNING: modpost: missing MODULE_DESCRIPTION() in > drivers/cpufreq/powernv-cpufreq.o > > Add the missing invocation of t