Re: [PATCH v5 7/8] execmem: add support for cache of large ROX pages

2024-10-09 Thread Christoph Hellwig
On Wed, Oct 09, 2024 at 09:08:15PM +0300, Mike Rapoport wrote: > /** > * struct execmem_info - architecture parameters for code allocations > + * @fill_trapping_insns: set memory to contain instructions that will trap > * @ranges: array of parameter sets defining architecture specific > * pa

Re: [PATCH v5 5/8] arch: introduce set_direct_map_valid_noflush()

2024-10-09 Thread Christoph Hellwig
Looks good: Reviewed-by: Christoph Hellwig ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: [PATCH v5 3/8] asm-generic: introduce text-patching.h

2024-10-09 Thread Christoph Hellwig
On Wed, Oct 09, 2024 at 09:08:11PM +0300, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > Several architectures support text patching, but they name the header > files that declare patching functions differently. > > Make all such headers consistently named text-patching.h and add a

Re: [PATCH v5 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together

2024-10-09 Thread Christoph Hellwig
On Wed, Oct 09, 2024 at 09:08:09PM +0300, Mike Rapoport wrote: > +/* for /proc/kcore */ > +extern long vread_iter(struct iov_iter *iter, const char *addr, size_t > count); > + > +/* > + * Internals. Don't use.. > + */ > +extern __init void vm_area_add_early(struct vm_struct *vm); > +extern __in

Re: [PATCH v5 4/8] module: prepare to handle ROX allocations for text

2024-10-09 Thread Mike Rapoport
On Wed, Oct 09, 2024 at 03:23:40PM -0700, Song Liu wrote: > On Wed, Oct 9, 2024 at 11:10 AM Mike Rapoport wrote: > [...] > > diff --git a/include/linux/module.h b/include/linux/module.h > > index 88ecc5e9f523..7039f609c6ef 100644 > > --- a/include/linux/module.h > > +++ b/include/linux/module.h >

Re: [PATCH v5 4/8] module: prepare to handle ROX allocations for text

2024-10-09 Thread Song Liu
On Wed, Oct 9, 2024 at 11:10 AM Mike Rapoport wrote: [...] > diff --git a/include/linux/module.h b/include/linux/module.h > index 88ecc5e9f523..7039f609c6ef 100644 > --- a/include/linux/module.h > +++ b/include/linux/module.h > @@ -367,6 +367,8 @@ enum mod_mem_type { > > struct module_memory { >

Re: [PATCH v5 7/8] execmem: add support for cache of large ROX pages

2024-10-09 Thread Andrew Morton
On Wed, 9 Oct 2024 21:08:15 +0300 Mike Rapoport wrote: > Using large pages to map text areas reduces iTLB pressure and improves > performance. Are there any measurable performance improvements? What are the effects of this series upon overall memory consumption? The lack of acks is a bit surp

[PATCH v5 8/8] x86/module: enable ROX caches for module text

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Enable execmem's cache of PMD_SIZE'ed pages mapped as ROX for module text allocations. Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/mm/init.c | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/in

[PATCH v5 7/8] execmem: add support for cache of large ROX pages

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Using large pages to map text areas reduces iTLB pressure and improves performance. Extend execmem_alloc() with an ability to use huge pages with ROX permissions as a cache for smaller allocations. To populate the cache, a writable large page is allocated from

[PATCH v5 6/8] x86/module: perpare module loading for ROX allocations of text

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" When module text memory will be allocated with ROX permissions, the memory at the actual address where the module will live will contain invalid instructions and there will be a writable copy that contains the actual module code. Update relocations and alternati

[PATCH v5 5/8] arch: introduce set_direct_map_valid_noflush()

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Add an API that will allow updates of the direct/linear map for a set of physically contiguous pages. It will be used in the following patches. Signed-off-by: Mike Rapoport (Microsoft) --- arch/arm64/include/asm/set_memory.h | 1 + arch/arm64/mm/pageattr

[PATCH v5 4/8] module: prepare to handle ROX allocations for text

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" In order to support ROX allocations for module text, it is necessary to handle modifications to the code, such as relocations and alternatives patching, without write access to that memory. One option is to use text patching, but this would make module loading e

[PATCH v5 2/8] mm: vmalloc: don't account for number of nodes for HUGE_VMAP allocations

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" vmalloc allocations with VM_ALLOW_HUGE_VMAP that do not explicitly specify node ID will use huge pages only if size_per_node is larger than a huge page. Still the actual allocated memory is not distributed between nodes and there is no advantage in such approach.

[PATCH v5 1/8] mm: vmalloc: group declarations depending on CONFIG_MMU together

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" There are a couple of declarations that depend on CONFIG_MMU in include/linux/vmalloc.h spread all over the file. Group them all together to improve code readability. No functional changes. Signed-off-by: Mike Rapoport (Microsoft) --- include/linux/vmalloc.h

[PATCH v5 0/8] x86/module: use large ROX pages for text allocations

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Hi, These patches add support for using large ROX pages for allocations of executable memory on x86. They address Andy's comments [1] about having executable mappings for code that was not completely formed. The approach taken is to allocate ROX memory along w

[PATCH v5 3/8] asm-generic: introduce text-patching.h

2024-10-09 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Several architectures support text patching, but they name the header files that declare patching functions differently. Make all such headers consistently named text-patching.h and add an empty header in asm-generic for architectures that do not support text pa

ARC: Use __force to suppress per-CPU cmpxchg complaints

2024-10-09 Thread Paul E. McKenney
Currently, the cast of the first argument to cmpxchg_emu_u8() drops the __percpu address-space designator, which results in sparse complaints when applying cmpxchg() to per-CPU variables in ARC. Therefore, use __force to suppress these complaints, given that this does not pertain to cmpxchg() sema

Re: [PATCH] asm-generic: provide generic page_to_phys and phys_to_page implementations

2024-10-09 Thread Christophe Leroy
Le 09/10/2024 à 13:43, Christoph Hellwig a écrit : page_to_phys is duplicated by all architectures, and from some strange reason placed in where it doesn't fit at all. phys_to_page is only provided by a few architectures despite having a lot of open coded users. Provide generic versions in

Re: [PATCH] asm-generic: provide generic page_to_phys and phys_to_page implementations

2024-10-09 Thread Arnd Bergmann
On Wed, Oct 9, 2024, at 11:43, Christoph Hellwig wrote: > page_to_phys is duplicated by all architectures, and from some strange > reason placed in where it doesn't fit at all. > > phys_to_page is only provided by a few architectures despite having a lot > of open coded users. > > Provide generic

[PATCH] asm-generic: provide generic page_to_phys and phys_to_page implementations

2024-10-09 Thread Christoph Hellwig
page_to_phys is duplicated by all architectures, and from some strange reason placed in where it doesn't fit at all. phys_to_page is only provided by a few architectures despite having a lot of open coded users. Provide generic versions in to make these helpers more easily usable. Signed-off-b

provide generic page_to_phys and phys_to_page implementations

2024-10-09 Thread Christoph Hellwig
page_to_phys is duplicated by all architectures, and from some strange reason placed in where it doesn't fit at all. phys_to_page is only provided by a few architectures despite having a lot of open coded users. Provide generic versions in to make these helpers more easily usable. Diffstat: