[PATCH 15/16] fs/proc: update vmcore to use .proc_mmap_[prepare, complete]

2025-09-11 Thread Lorenzo Stoakes
Now are able to use mmap_prepare, complete callbacks for procfs implementations, update the vmcore implementation accordingly. As part of this change, we must also update remap_vmalloc_range_partial() to optionally not update VMA flags. Other than then remap_vmalloc_range() wrapper, vmcore is the

[PATCH 04/16] relay: update relay to use mmap_prepare

2025-09-11 Thread Lorenzo Stoakes
It is relatively trivial to update this code to use the f_op->mmap_prepare hook in favour of the deprecated f_op->mmap hook, so do so. Signed-off-by: Lorenzo Stoakes --- kernel/relay.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/kernel/r

Re: [PATCH v3 1/2] kho: add support for preserving vmalloc allocations

2025-09-11 Thread Pratyush Yadav
On Mon, Sep 08 2025, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > A vmalloc allocation is preserved using binary structure similar to > global KHO memory tracker. It's a linked list of pages where each page > is an array of physical address of pages in vmalloc area. > > kho_preser

[PATCH 10/16] mm/hugetlb: update hugetlbfs to use mmap_prepare, mmap_complete

2025-09-11 Thread Lorenzo Stoakes
We can now update hugetlb to make sure of the new .mmap_prepare() hook, by deferring the reservation of pages until the VMA is fully established and handle this in the f_op->mmap_complete() hook. We hold the VMA write lock throughout so we can't race with faults. rmap can discover the VMA, but thi

Re: [PATCH 06/16] mm: introduce the f_op->mmap_complete, mmap_abort hooks

2025-09-11 Thread David Hildenbrand
On 09.09.25 11:13, Lorenzo Stoakes wrote: On Mon, Sep 08, 2025 at 05:27:37PM +0200, David Hildenbrand wrote: On 08.09.25 13:10, Lorenzo Stoakes wrote: We have introduced the f_op->mmap_prepare hook to allow for setting up a VMA far earlier in the process of mapping memory, reducing problematic

Re: [PATCH 03/16] mm: add vma_desc_size(), vma_desc_pages() helpers

2025-09-11 Thread Jason Gunthorpe
On Mon, Sep 08, 2025 at 12:10:34PM +0100, Lorenzo Stoakes wrote: > static int secretmem_mmap_prepare(struct vm_area_desc *desc) > { > - const unsigned long len = desc->end - desc->start; > + const unsigned long len = vma_desc_size(desc); > > if ((desc->vm_flags & (VM_SHARED | VM_M

Re: [PATCH 00/16] expand mmap_prepare functionality, port more users

2025-09-11 Thread Jason Gunthorpe
On Mon, Sep 08, 2025 at 03:48:36PM +0100, Lorenzo Stoakes wrote: > But sadly some _do need_ to do extra work afterwards, most notably, > prepopulation. I think Jan is suggesting something more like mmap_op() { struct vma_desc desc = {}; desc.[..] = x desc.[..] = y desc.[..] = z vm

Re: [PATCH 03/16] mm: add vma_desc_size(), vma_desc_pages() helpers

2025-09-11 Thread Lorenzo Stoakes
On Mon, Sep 08, 2025 at 11:20:11AM -0300, Jason Gunthorpe wrote: > On Mon, Sep 08, 2025 at 03:09:43PM +0100, Lorenzo Stoakes wrote: > > > Perhaps > > > > > > !vma_desc_cowable() > > > > > > Is what many drivers are really trying to assert. > > > > Well no, because: > > > > static inline bool is_cow

Re: [PATCH v2 1/2] kexec: Add KEXEC_FILE_NO_CMA as a legal flag

2025-09-11 Thread Baoquan He
On 09/04/25 at 07:58pm, Brian Mak wrote: > On Aug 25, 2025, at 11:49 AM, Brian Mak wrote: > > > On Aug 21, 2025, at 8:33 PM, Baoquan He wrote: > > > >> Yeah, this is a good catch and great fix. Without this fix, > >> kexec_file_load syscall will failed and return '-EINVAL' when > >> KEXEC_FILE_

Re: [PATCH 05/16] mm/vma: rename mmap internal functions to avoid confusion

2025-09-11 Thread Lorenzo Stoakes
On Mon, Sep 08, 2025 at 05:19:18PM +0200, David Hildenbrand wrote: > On 08.09.25 13:10, Lorenzo Stoakes wrote: > > Now we have the f_op->mmap_prepare() hook, having a static function called > > __mmap_prepare() that has nothing to do with it is confusing, so rename the > > function. > > > > Additio

Re: [PATCH 02/16] device/dax: update devdax to use mmap_prepare

2025-09-11 Thread David Hildenbrand
On 08.09.25 17:28, Lorenzo Stoakes wrote: On Mon, Sep 08, 2025 at 05:03:54PM +0200, David Hildenbrand wrote: On 08.09.25 13:10, Lorenzo Stoakes wrote: The devdax driver does nothing special in its f_op->mmap hook, so straightforwardly update it to use the mmap_prepare hook instead. Signed-off-

Re: [PATCH 03/16] mm: add vma_desc_size(), vma_desc_pages() helpers

2025-09-11 Thread Jason Gunthorpe
On Mon, Sep 08, 2025 at 03:47:34PM +0100, Lorenzo Stoakes wrote: > On Mon, Sep 08, 2025 at 11:20:11AM -0300, Jason Gunthorpe wrote: > > On Mon, Sep 08, 2025 at 03:09:43PM +0100, Lorenzo Stoakes wrote: > > > > Perhaps > > > > > > > > !vma_desc_cowable() > > > > > > > > Is what many drivers are reall

Re: [PATCH] kexec_core: Remove superfluous page offset handling in segment loading

2025-09-11 Thread Baoquan He
On 09/11/25 at 03:30pm, Bouron, Justinien wrote: > On 9/11/25, 02:42, "Baoquan He" mailto:b...@redhat.com>> > wrote: > > Do you mean we will adjust the memsz and buf_align to PAGE_SIZE aligned > > in kexec_add_buffer()? > That and mostly the fact that `sanity_check_segment_list()` explicitely > r

Re: [PATCH 03/16] mm: add vma_desc_size(), vma_desc_pages() helpers

2025-09-11 Thread David Hildenbrand
On 08.09.25 17:35, Lorenzo Stoakes wrote: On Mon, Sep 08, 2025 at 05:07:57PM +0200, David Hildenbrand wrote: On 08.09.25 16:47, Lorenzo Stoakes wrote: On Mon, Sep 08, 2025 at 11:20:11AM -0300, Jason Gunthorpe wrote: On Mon, Sep 08, 2025 at 03:09:43PM +0100, Lorenzo Stoakes wrote: Perhaps !vm

[PATCH 00/16] expand mmap_prepare functionality, port more users

2025-09-11 Thread Lorenzo Stoakes
Since commit c84bf6dd2b83 ("mm: introduce new .mmap_prepare() file callback"), The f_op->mmap hook has been deprecated in favour of f_op->mmap_prepare. This was introduced in order to make it possible for us to eventually eliminate the f_op->mmap hook which is highly problematic as it allows drive

Re: [PATCH 12/16] mm: update resctl to use mmap_prepare, mmap_complete, mmap_abort

2025-09-11 Thread Lorenzo Stoakes
On Mon, Sep 08, 2025 at 10:24:47AM -0300, Jason Gunthorpe wrote: > On Mon, Sep 08, 2025 at 12:10:43PM +0100, Lorenzo Stoakes wrote: > > resctl uses remap_pfn_range(), but holds a mutex over the > > operation. Therefore, establish the mutex in mmap_prepare(), release it in > > mmap_complete() and re

Re: [PATCH] kexec_core: Remove superfluous page offset handling in segment loading

2025-09-11 Thread Baoquan He
On 09/10/25 at 09:31am, Justinien Bouron wrote: > Kexec does not accept segments for which the destination address is not > page aligned. Therefore there is no need for page offset handling when > loading segments. Do you mean we will adjust the memsz and buf_align to PAGE_SIZE aligned in kexec_ad

Re: [PATCH v3 5/7] kstate, test: add test module for testing kstate subsystem.

2025-09-11 Thread Andrey Ryabinin
On 9/10/25 2:33 AM, Randy Dunlap wrote: > > > On 9/9/25 1:14 PM, Andrey Ryabinin wrote: >> diff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig >> index b6ea861006bf..af9a25bdcd6e 100644 >> --- a/kernel/liveupdate/Kconfig >> +++ b/kernel/liveupdate/Kconfig >> @@ -69,6 +69,14 @@ c

Re: [PATCH v3 4/7] kho: replace KHO FDT with kstate metadata

2025-09-11 Thread Andrey Ryabinin
On 9/10/25 6:50 PM, Rob Herring wrote: > On Tue, Sep 09, 2025 at 10:14:39PM +0200, Andrey Ryabinin wrote: >> Store KSTATE physical address & size instead of FDT in kho_data. >> and initialize KSTATE from kho_populate(). >> To be able to use FDT in parallel with KSTATE place FDT >> address&size i

Re: [PATCH] kexec_core: Remove superfluous page offset handling in segment loading

2025-09-11 Thread Bouron, Justinien
On 9/11/25, 02:42, "Baoquan He" mailto:b...@redhat.com>> wrote: > Do you mean we will adjust the memsz and buf_align to PAGE_SIZE aligned > in kexec_add_buffer()? That and mostly the fact that `sanity_check_segment_list()` explicitely rejects any segment that either does not start or end on a page

Re: [PATCH] kexec_core: Remove superfluous page offset handling in segment loading

2025-09-11 Thread kernel test robot
Hi Justinien, kernel test robot noticed the following build warnings: [auto build test WARNING on akpm-mm/mm-everything] [also build test WARNING on linus/master v6.17-rc5 next-20250911] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest