Re: [PATCH v2 3/3] fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks

2025-08-05 Thread Suren Baghdasaryan
On Tue, Aug 5, 2025 at 7:18 AM Vlastimil Babka wrote: > > On 8/5/25 1:15 AM, Suren Baghdasaryan wrote: > > Utilize per-vma locks to stabilize vma after lookup without taking > > mmap_lock during PROCMAP_QUERY ioctl execution. If vma lock is > > contended, we fall back

[PATCH v2 3/3] fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks

2025-08-04 Thread Suren Baghdasaryan
back path will fail and ioctl is done under mmap_lock protection. This change is designed to reduce mmap_lock contention and prevent PROCMAP_QUERY ioctl calls from blocking address space updates. Signed-off-by: Suren Baghdasaryan --- fs/proc/task_mmu.c | 81

[PATCH v2 2/3] fs/proc/task_mmu: factor out proc_maps_private fields used by PROCMAP_QUERY

2025-08-04 Thread Suren Baghdasaryan
ile->private_data members by ioctl and /proc/pid/maps readers. The change is pure code refactoring and has no functional changes. Signed-off-by: Suren Baghdasaryan --- fs/proc/internal.h | 15 ++ fs/proc/task_mmu.c | 70 ++-- fs/proc/task_n

[PATCH v2 1/3] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-08-04 Thread Suren Baghdasaryan
Extend /proc/pid/maps tearing tests to verify PROCMAP_QUERY ioctl operation correctness while the vma is being concurrently modified. Signed-off-by: Suren Baghdasaryan Tested-by: SeongJae Park Acked-by: SeongJae Park --- tools/testing/selftests/proc/proc-maps-race.c | 65

[PATCH v2 0/3] execute PROCMAP_QUERY ioctl under per-vma lock

2025-08-04 Thread Suren Baghdasaryan
SeongJae Park - Fixed NOMMU case, per Vlastimil Babka - Renamed proc_maps_query_data to proc_maps_locking_ctx, per Vlastimil Babka [1] https://lore.kernel.org/all/20250704060727.724817-1-sur...@google.com/ [2] https://lore.kernel.org/all/20250731220024.702621-1-sur...@google.com/ Suren Baghdasaryan (3

Re: [PATCH] selftests/proc: Fix string literal warning in proc-maps-race.c

2025-08-04 Thread Suren Baghdasaryan
lines() and print_last_lines() thus > resolving the warnings invoked. > > The test executes fine after this change thus causing no > affect to the functional behavior of the test. Please add: Fixes: aadc099c480f ("selftests/proc: add verbose mode for /proc/pid/maps tearing tests&q

Re: [PATCH 1/3] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-08-01 Thread Suren Baghdasaryan
On Fri, Aug 1, 2025 at 6:38 PM SeongJae Park wrote: > > On Thu, 31 Jul 2025 15:00:22 -0700 Suren Baghdasaryan > wrote: > > > Extend /proc/pid/maps tearing tests to verify PROCMAP_QUERY ioctl operation > > correctness while the vma is being concurrently modified. >

Re: [PATCH 2/3] fs/proc/task_mmu: factor out proc_maps_private fields used by PROCMAP_QUERY

2025-08-01 Thread Suren Baghdasaryan
On Fri, Aug 1, 2025 at 3:55 AM Vlastimil Babka wrote: > > On 8/1/25 00:00, Suren Baghdasaryan wrote: > > Refactor struct proc_maps_private so that the fields used by PROCMAP_QUERY > > ioctl are moved into a separate structure. In the next patch this allows > > ioctl to reu

[PATCH 3/3] fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks

2025-07-31 Thread Suren Baghdasaryan
back path will fail and ioctl is done under mmap_lock protection. This change is designed to reduce mmap_lock contention and prevent PROCMAP_QUERY ioctl calls from blocking address space updates. Signed-off-by: Suren Baghdasaryan --- fs/proc/task_mmu.c | 81

[PATCH 2/3] fs/proc/task_mmu: factor out proc_maps_private fields used by PROCMAP_QUERY

2025-07-31 Thread Suren Baghdasaryan
ile->private_data members by ioctl and /proc/pid/maps readers. The change is pure code refactoring and has no functional changes. Signed-off-by: Suren Baghdasaryan --- fs/proc/internal.h | 15 ++ fs/proc/task_mmu.c | 70 +++--- 2 files chang

[PATCH 1/3] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-07-31 Thread Suren Baghdasaryan
Extend /proc/pid/maps tearing tests to verify PROCMAP_QUERY ioctl operation correctness while the vma is being concurrently modified. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 65 +++ 1 file changed, 65 insertions(+) diff --git a

[PATCH 0/3] execute PROCMAP_QUERY ioctl under per-vma lock

2025-07-31 Thread Suren Baghdasaryan
...@google.com/ Suren Baghdasaryan (3): selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified fs/proc/task_mmu: factor out proc_maps_private fields used by PROCMAP_QUERY fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks fs/proc/internal.h

[PATCH v8 6/6] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-19 Thread Suren Baghdasaryan
d-off-by: Suren Baghdasaryan Reviewed-by: Vlastimil Babka --- fs/proc/internal.h| 5 ++ fs/proc/task_mmu.c| 141 +++--- include/linux/mmap_lock.h | 11 +++ mm/madvise.c | 3 +- mm/mmap_lock.c| 93 +++

[PATCH v8 5/6] fs/proc/task_mmu: remove conversion of seq_file position to unsigned

2025-07-19 Thread Suren Baghdasaryan
loff_t into unsigned type is not needed. Similarly, sentinel values don't need to be unsigned. Remove type conversion for set_file position and change sentinel values to signed. While at it, change the hardcoded sentinel values with named definitions for better documentation. Signed-off-by: Su

[PATCH v8 4/6] selftests/proc: add verbose mode for /proc/pid/maps tearing tests

2025-07-19 Thread Suren Baghdasaryan
Add verbose mode to the /proc/pid/maps tearing tests to print debugging information. VERBOSE environment variable is used to enable it. Usage example: VERBOSE=1 ./proc-maps-race Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 153 -- 1 file

[PATCH v8 3/6] selftests/proc: extend /proc/pid/maps tearing test to include vma remapping

2025-07-19 Thread Suren Baghdasaryan
concurrently from under the reader. We should always see either original vma or the split one with no holes. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 86 +++ 1 file changed, 86 insertions(+) diff --git a/tools/testing/selftests/proc/proc-maps

[PATCH v8 2/6] selftests/proc: extend /proc/pid/maps tearing test to include vma resizing

2025-07-19 Thread Suren Baghdasaryan
the vma. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 79 +++ 1 file changed, 79 insertions(+) diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c index 5b28dda08b7d..19028bd3b85c

[PATCH v8 1/6] selftests/proc: add /proc/pid/maps tearing from vma split test

2025-07-19 Thread Suren Baghdasaryan
second page for consistency, looking for the effects of vma splits or merges. The test duration is configurable via DURATION environment variable expressed in seconds. The default test duration is 5 seconds. Example Command: DURATION=10 ./proc-maps-race Signed-off-by: Suren Baghdasaryan --- tools/testing

[PATCH v8 0/6] use per-vma locks for /proc/pid/maps reads

2025-07-19 Thread Suren Baghdasaryan
ucifer.local/ [4] https://lore.kernel.org/all/20250716030557.1547501-1-sur...@google.com/ Suren Baghdasaryan (6): selftests/proc: add /proc/pid/maps tearing from vma split test selftests/proc: extend /proc/pid/maps tearing test to include vma resizing selftests/proc: extend /proc/pid/maps tear

Re: [PATCH v7 0/7] use per-vma locks for /proc/pid/maps reads

2025-07-16 Thread Suren Baghdasaryan
On Wed, Jul 16, 2025 at 3:55 PM Andrew Morton wrote: > > On Tue, 15 Jul 2025 20:05:49 -0700 Suren Baghdasaryan > wrote: > > > This patchset switches from holding mmap_lock while reading /proc/pid/maps > > to taking per-vma locks as we walk the vma tree. > > Thanks

Re: [PATCH v7 1/7] selftests/proc: add /proc/pid/maps tearing from vma split test

2025-07-16 Thread Suren Baghdasaryan
On Wed, Jul 16, 2025 at 7:20 AM Suren Baghdasaryan wrote: > > On Wed, Jul 16, 2025 at 3:50 AM Lorenzo Stoakes > wrote: > > > > On Wed, Jul 16, 2025 at 12:44:23PM +0200, David Hildenbrand wrote: > > > On 16.07.25 05:05, Suren Baghdasaryan wrote: > > > >

Re: [PATCH v7 4/7] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-07-16 Thread Suren Baghdasaryan
On Wed, Jul 16, 2025 at 3:40 AM Lorenzo Stoakes wrote: > > On Wed, Jul 16, 2025 at 12:04:25PM +0200, David Hildenbrand wrote: > > On 16.07.25 05:05, Suren Baghdasaryan wrote: > > > Extend /proc/pid/maps tearing test to verify PROCMAP_QUERY ioctl operation > > > corr

Re: [PATCH v7 7/7] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-16 Thread Suren Baghdasaryan
On Wed, Jul 16, 2025 at 6:57 AM Vlastimil Babka wrote: > > On 7/16/25 05:05, Suren Baghdasaryan wrote: > > With maple_tree supporting vma tree traversal under RCU and per-vma > > locks, /proc/pid/maps can be read while holding individual vma locks > > instead of locking

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-16 Thread Suren Baghdasaryan
On Wed, Jul 16, 2025 at 7:07 AM Vlastimil Babka wrote: > > On 7/16/25 16:00, Lorenzo Stoakes wrote: > > On Tue, Jul 15, 2025 at 01:13:36PM -0700, Suren Baghdasaryan wrote: > >> Huh, I completely failed to consider this. In hindsight it is quite > >> obvious... Than

Re: [PATCH v7 1/7] selftests/proc: add /proc/pid/maps tearing from vma split test

2025-07-16 Thread Suren Baghdasaryan
On Wed, Jul 16, 2025 at 3:50 AM Lorenzo Stoakes wrote: > > On Wed, Jul 16, 2025 at 12:44:23PM +0200, David Hildenbrand wrote: > > On 16.07.25 05:05, Suren Baghdasaryan wrote: > > > The /proc/pid/maps file is generated page by page, with the mmap_lock > > > released

[PATCH v7 7/7] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-15 Thread Suren Baghdasaryan
d-off-by: Suren Baghdasaryan --- fs/proc/internal.h| 5 ++ fs/proc/task_mmu.c| 145 +++--- include/linux/mmap_lock.h | 11 +++ mm/madvise.c | 3 +- mm/mmap_lock.c| 93 5 files changed, 246 inser

[PATCH v7 6/7] fs/proc/task_mmu: remove conversion of seq_file position to unsigned

2025-07-15 Thread Suren Baghdasaryan
loff_t into unsigned type is not needed. Similarly, sentinel values don't need to be unsigned. Remove type conversion for set_file position and change sentinel values to signed. Signed-off-by: Suren Baghdasaryan Reviewed-by: Lorenzo Stoakes Reviewed-by: Vlastimil Babka --- fs/proc

[PATCH v7 5/7] selftests/proc: add verbose more for tests to facilitate debugging

2025-07-15 Thread Suren Baghdasaryan
Add verbose mode to the proc tests to print debugging information. Usage: proc-pid-vm -v Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 159 -- 1 file changed, 146 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/proc

[PATCH v7 4/7] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-07-15 Thread Suren Baghdasaryan
Extend /proc/pid/maps tearing test to verify PROCMAP_QUERY ioctl operation correctness while the vma is being concurrently modified. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 62 +++ 1 file changed, 62 insertions(+) diff --git a/tools

[PATCH v7 3/7] selftests/proc: extend /proc/pid/maps tearing test to include vma remapping

2025-07-15 Thread Suren Baghdasaryan
concurrently from under the reader. We should always see either original vma or the split one with no holes. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 92 +++ 1 file changed, 92 insertions(+) diff --git a/tools/testing/selftests/proc/proc-maps

[PATCH v7 2/7] selftests/proc: extend /proc/pid/maps tearing test to include vma resizing

2025-07-15 Thread Suren Baghdasaryan
the vma. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 83 +++ 1 file changed, 83 insertions(+) diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c index 523afd83d34f..10365b4e68e1

[PATCH v7 1/7] selftests/proc: add /proc/pid/maps tearing from vma split test

2025-07-15 Thread Suren Baghdasaryan
-files-001 diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c new file mode 100644 index ..523afd83d34f --- /dev/null +++ b/tools/testing/selftests/proc/proc-maps-race.c @@ -0,0 +1,459 @@ +/* + * Copyright (c) 2025 Sur

[PATCH v7 0/7] use per-vma locks for /proc/pid/maps reads

2025-07-15 Thread Suren Baghdasaryan
/all/e1863f40-39ab-4e5b-984a-c48765ffde1c@lucifer.local/ [4] https://lore.kernel.org/all/20250704060727.724817-1-sur...@google.com/ Suren Baghdasaryan (7): selftests/proc: add /proc/pid/maps tearing from vma split test selftests/proc: extend /proc/pid/maps tearing test to include vma re

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-15 Thread Suren Baghdasaryan
On Tue, Jul 15, 2025 at 1:18 PM Suren Baghdasaryan wrote: > > On Tue, Jul 15, 2025 at 10:29 AM Andrii Nakryiko > wrote: > > > > On Tue, Jul 15, 2025 at 10:21 AM Lorenzo Stoakes > > wrote: > > > > > > On Tue, Jul 15, 2025 at 06:10:16PM +0100, Loren

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-15 Thread Suren Baghdasaryan
On Tue, Jul 15, 2025 at 10:29 AM Andrii Nakryiko wrote: > > On Tue, Jul 15, 2025 at 10:21 AM Lorenzo Stoakes > wrote: > > > > On Tue, Jul 15, 2025 at 06:10:16PM +0100, Lorenzo Stoakes wrote: > > > > For PROCMAP_QUERY, we need priv->mm, but the newly added locked_vma > > > > and locked_vma don't n

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-15 Thread Suren Baghdasaryan
On Tue, Jul 15, 2025 at 1:16 AM Vlastimil Babka wrote: > > On 7/10/25 19:02, Suren Baghdasaryan wrote: > > On Thu, Jul 10, 2025 at 12:03 AM Suren Baghdasaryan > > wrote: > >> > >> On Wed, Jul 9, 2025 at 10:47 AM Suren Baghdasaryan > >> wrote: >

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-10 Thread Suren Baghdasaryan
On Thu, Jul 10, 2025 at 12:03 AM Suren Baghdasaryan wrote: > > On Wed, Jul 9, 2025 at 10:47 AM Suren Baghdasaryan wrote: > > > > On Wed, Jul 9, 2025 at 4:12 PM Liam R. Howlett > > wrote: > > > > > > * Suren Baghdasaryan [250709 11:06]: > > &g

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-10 Thread Suren Baghdasaryan
On Wed, Jul 9, 2025 at 10:47 AM Suren Baghdasaryan wrote: > > On Wed, Jul 9, 2025 at 4:12 PM Liam R. Howlett > wrote: > > > > * Suren Baghdasaryan [250709 11:06]: > > > On Wed, Jul 9, 2025 at 3:03 PM Vlastimil Babka wrote: > > > > > &g

Re: [PATCH v6 6/8] fs/proc/task_mmu: remove conversion of seq_file position to unsigned

2025-07-09 Thread Suren Baghdasaryan
On Tue, Jul 8, 2025 at 10:37 AM Vlastimil Babka wrote: > > On 7/4/25 08:07, Suren Baghdasaryan wrote: > > Back in 2.6 era, last_addr used to be stored in seq_file->version > > variable, which was unsigned long. As a result, sentinels to represent > > gate vma and en

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-09 Thread Suren Baghdasaryan
On Wed, Jul 9, 2025 at 4:12 PM Liam R. Howlett wrote: > > * Suren Baghdasaryan [250709 11:06]: > > On Wed, Jul 9, 2025 at 3:03 PM Vlastimil Babka wrote: > > > > > > On 7/9/25 16:43, Suren Baghdasaryan wrote: > > > > On Wed, Jul 9, 2025 at 1:57 AM Vlasti

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-09 Thread Suren Baghdasaryan
On Wed, Jul 9, 2025 at 3:03 PM Vlastimil Babka wrote: > > On 7/9/25 16:43, Suren Baghdasaryan wrote: > > On Wed, Jul 9, 2025 at 1:57 AM Vlastimil Babka wrote: > >> > >> On 7/8/25 01:10, Suren Baghdasaryan wrote: > >> >>> + rcu_read_unlock();

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-09 Thread Suren Baghdasaryan
On Wed, Jul 9, 2025 at 3:03 AM Vlastimil Babka wrote: > > On 7/4/25 08:07, Suren Baghdasaryan wrote: > > --- a/mm/mmap_lock.c > > +++ b/mm/mmap_lock.c > > @@ -178,6 +178,94 @@ struct vm_area_struct *lock_vma_under_rcu(struct > > mm_struct *mm, > > co

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-09 Thread Suren Baghdasaryan
On Wed, Jul 9, 2025 at 1:57 AM Vlastimil Babka wrote: > > On 7/8/25 01:10, Suren Baghdasaryan wrote: > >>> + rcu_read_unlock(); > >>> + vma = lock_vma_under_mmap_lock(mm, iter, address); > >>> + rcu_read_lock(); > >> OK I guess we hol

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-07 Thread Suren Baghdasaryan
On Mon, Jul 7, 2025 at 11:21 AM Liam R. Howlett wrote: > > * Suren Baghdasaryan [250704 02:07]: > > With maple_tree supporting vma tree traversal under RCU and per-vma > > locks, /proc/pid/maps can be read while holding individual vma locks > > instead of locking

Re: [PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-07 Thread Suren Baghdasaryan
On Mon, Jul 7, 2025 at 9:52 AM Lorenzo Stoakes wrote: > > Sorry I know it's annoying, but some petty commit msg nits: > > On Thu, Jul 03, 2025 at 11:07:25PM -0700, Suren Baghdasaryan wrote: > > With maple_tree supporting vma tree traversal under RCU and per-vma > >

[PATCH v6 8/8] fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks

2025-07-03 Thread Suren Baghdasaryan
PROCMAP_QUERY ioctl calls from blocking address space updates. Signed-off-by: Suren Baghdasaryan Acked-by: Andrii Nakryiko --- fs/proc/task_mmu.c | 60 -- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c

[PATCH v6 7/8] fs/proc/task_mmu: read proc/pid/maps under per-vma lock

2025-07-03 Thread Suren Baghdasaryan
ws for sub-page data tearing as opposed to the previous mechanism where data tearing could happen only between pages of generated output data. Since current userspace considers data tearing between pages to be acceptable, we assume is will be able to handle sub-page data tearing as well. Signed-off

[PATCH v6 6/8] fs/proc/task_mmu: remove conversion of seq_file position to unsigned

2025-07-03 Thread Suren Baghdasaryan
loff_t into unsigned type is not needed. Similarly, sentinel values don't need to be unsigned. Remove type conversion for set_file position and change sentinel values to signed. Signed-off-by: Suren Baghdasaryan --- fs/proc/task_mmu.c | 14 +++--- 1 file changed, 7 insertions(+), 7 de

[PATCH v6 5/8] selftests/proc: add verbose more for tests to facilitate debugging

2025-07-03 Thread Suren Baghdasaryan
Add verbose mode to the proc tests to print debugging information. Usage: proc-pid-vm -v Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 159 -- 1 file changed, 146 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/proc

[PATCH v6 4/8] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-07-03 Thread Suren Baghdasaryan
Extend /proc/pid/maps tearing test to verify PROCMAP_QUERY ioctl operation correctness while the vma is being concurrently modified. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 62 +++ 1 file changed, 62 insertions(+) diff --git a/tools

[PATCH v6 3/8] selftests/proc: extend /proc/pid/maps tearing test to include vma remapping

2025-07-03 Thread Suren Baghdasaryan
concurrently from under the reader. We should always see either original vma or the split one with no holes. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 92 +++ 1 file changed, 92 insertions(+) diff --git a/tools/testing/selftests/proc/proc-maps

[PATCH v6 2/8] selftests/proc: extend /proc/pid/maps tearing test to include vma resizing

2025-07-03 Thread Suren Baghdasaryan
the vma. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-maps-race.c | 83 +++ 1 file changed, 83 insertions(+) diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c index 523afd83d34f..10365b4e68e1

[PATCH v6 1/8] selftests/proc: add /proc/pid/maps tearing from vma split test

2025-07-03 Thread Suren Baghdasaryan
-files-001 diff --git a/tools/testing/selftests/proc/proc-maps-race.c b/tools/testing/selftests/proc/proc-maps-race.c new file mode 100644 index ..523afd83d34f --- /dev/null +++ b/tools/testing/selftests/proc/proc-maps-race.c @@ -0,0 +1,459 @@ +/* + * Copyright (c) 2025 Sur

[PATCH v6 0/8] use per-vma locks for /proc/pid/maps reads and PROCMAP_QUERY

2025-07-03 Thread Suren Baghdasaryan
ub.com/paulmckrcu/proc-mmap_sem-test [3] https://lore.kernel.org/all/e1863f40-39ab-4e5b-984a-c48765ffde1c@lucifer.local/ [4] https://lore.kernel.org/all/20250624193359.3865351-1-sur...@google.com/ Suren Baghdasaryan (8): selftests/proc: add /proc/pid/maps tearing from vma split test selfte

Re: [PATCH v2] codetag: Avoid unused alloc_tags sections/symbols

2025-06-25 Thread Suren Baghdasaryan
> forces the linker to create an empty .codetag.alloc_tags section. > > Update codetag.lds.h to make the data conditional on > CONFIG_MEM_ALLOC_PROFILING. > > Signed-off-by: Petr Pavlu > Reviewed-by: Kent Overstreet > Reviewed-by: Suren Baghdasaryan Thanks! Acked-by: Su

Re: [PATCH v5 6/7] mm/maps: read proc/pid/maps under per-vma lock

2025-06-25 Thread Suren Baghdasaryan
gt; anon_vma_name() is being called under VMA lock, but is assert mmap lock which > won't necessarily be held. > > This results in the kernel spamming warnings about this on startup. > > Replace this with an open-coded 'mmap or VMA lock' assert to resolve. > > Signe

[PATCH v5 7/7] mm/maps: execute PROCMAP_QUERY ioctl under per-vma locks

2025-06-24 Thread Suren Baghdasaryan
PROCMAP_QUERY ioctl calls from blocking address space updates. Signed-off-by: Suren Baghdasaryan Acked-by: Andrii Nakryiko --- fs/proc/task_mmu.c | 56 -- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c

[PATCH v5 6/7] mm/maps: read proc/pid/maps under per-vma lock

2025-06-24 Thread Suren Baghdasaryan
ws for sub-page data tearing as opposed to the previous mechanism where data tearing could happen only between pages of generated output data. Since current userspace considers data tearing between pages to be acceptable, we assume is will be able to handle sub-page data tearing as well. Signed-off

[PATCH v5 5/7] selftests/proc: add verbose more for tests to facilitate debugging

2025-06-24 Thread Suren Baghdasaryan
Add verbose mode to the proc tests to print debugging information. Usage: proc-pid-vm -v Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 154 +++-- 1 file changed, 141 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/proc

[PATCH v5 4/7] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-06-24 Thread Suren Baghdasaryan
Extend /proc/pid/maps tearing test to verify PROCMAP_QUERY ioctl operation correctness while the vma is being concurrently modified. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 60 ++ 1 file changed, 60 insertions(+) diff --git a/tools

[PATCH v5 3/7] selftests/proc: extend /proc/pid/maps tearing test to include vma remapping

2025-06-24 Thread Suren Baghdasaryan
concurrently from under the reader. We should always see either original vma or the split one with no holes. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 92 ++ 1 file changed, 92 insertions(+) diff --git a/tools/testing/selftests/proc/proc-pid

[PATCH v5 2/7] selftests/proc: extend /proc/pid/maps tearing test to include vma resizing

2025-06-24 Thread Suren Baghdasaryan
the vma. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 83 ++ 1 file changed, 83 insertions(+) diff --git a/tools/testing/selftests/proc/proc-pid-vm.c b/tools/testing/selftests/proc/proc-pid-vm.c index 6e3f06376a1f..39842e4ec45f 100644

[PATCH v5 1/7] selftests/proc: add /proc/pid/maps tearing from vma split test

2025-06-24 Thread Suren Baghdasaryan
second page for consistency, looking for the effects of vma splits or merges. The test duration is configurable via the -d command-line parameter in seconds to increase the likelihood of catching the race condition. The default test duration is 5 seconds. Example Command: proc-pid-vm -d 10 Signe

[PATCH v5 0/7] use per-vma locks for /proc/pid/maps reads and PROCMAP_QUERY

2025-06-24 Thread Suren Baghdasaryan
test [3] https://lore.kernel.org/all/e1863f40-39ab-4e5b-984a-c48765ffde1c@lucifer.local/ [4] https://lore.kernel.org/all/20250604231151.799834-1-sur...@google.com/ Suren Baghdasaryan (7): selftests/proc: add /proc/pid/maps tearing from vma split test selftests/proc: extend /proc/pid/maps tearing

Re: [PATCH] alloc_tag: remove empty module tag section

2025-06-17 Thread Suren Baghdasaryan
On Tue, Jun 17, 2025 at 2:27 AM Petr Pavlu wrote: > > On 6/10/25 6:22 PM, Casey Chen wrote: > > The empty MOD_CODETAG_SECTIONS() macro added an incomplete .data > > section in module linker script, which caused symbol lookup tools > > like gdb to misinterpret symbol addresses e.g., __ib_process_cq

Re: [PATCH v4 0/7] use per-vma locks for /proc/pid/maps reads and PROCMAP_QUERY

2025-06-13 Thread Suren Baghdasaryan
On Fri, Jun 13, 2025 at 8:01 AM Lorenzo Stoakes wrote: > > Hi Suren, > > I promised I'd share VMA merging scenarios so we can be absolutely sure we > have > all cases covered, I share that below. I also included information on split. Thanks Lorenzo! This is great and very helpful. > > Hopefully

Re: [PATCH v4 6/7] mm/maps: read proc/pid/maps under per-vma lock

2025-06-11 Thread Suren Baghdasaryan
st of merge scenarios and ideally have a look at > the test code too if I have time this week. > > But otherwise hopefully we are good for a respin here? Ack. Working on it. > > Cheers, Lorenzo > > On Tue, Jun 10, 2025 at 05:16:36PM -0700, Suren Baghdasaryan wrote: > >

Re: [PATCH v4 6/7] mm/maps: read proc/pid/maps under per-vma lock

2025-06-10 Thread Suren Baghdasaryan
On Tue, Jun 10, 2025 at 10:43 AM Lorenzo Stoakes wrote: > > On Sat, Jun 07, 2025 at 06:41:35PM -0700, Suren Baghdasaryan wrote: > > On Sat, Jun 7, 2025 at 10:43 AM Lorenzo Stoakes > > wrote: > > > > > > Hi Suren, > > > > > > Forgive me but

Re: [PATCH v4 6/7] mm/maps: read proc/pid/maps under per-vma lock

2025-06-10 Thread Suren Baghdasaryan
pid/maps under per-vma lock") > url: > https://github.com/intel-lab-lkp/linux/commits/Suren-Baghdasaryan/selftests-proc-add-proc-pid-maps-tearing-from-vma-split-test/20250605-071433 > patch link: > https://lore.kernel.org/all/20250604231151.799834-7-sur...@google.com/ > patch

Re: [PATCH v4 6/7] mm/maps: read proc/pid/maps under per-vma lock

2025-06-07 Thread Suren Baghdasaryan
On Sat, Jun 7, 2025 at 10:43 AM Lorenzo Stoakes wrote: > > Hi Suren, > > Forgive me but I am going to ask a lot of questions here :p just want to > make sure I'm getting everything right here. No worries and thank you for reviewing! > > On Wed, Jun 04, 2025

[PATCH v4 7/7] mm/maps: execute PROCMAP_QUERY ioctl under per-vma locks

2025-06-04 Thread Suren Baghdasaryan
PROCMAP_QUERY ioctl calls from blocking address space updates. Signed-off-by: Suren Baghdasaryan --- fs/proc/task_mmu.c | 56 -- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 36d883c4f394

[PATCH v4 6/7] mm/maps: read proc/pid/maps under per-vma lock

2025-06-04 Thread Suren Baghdasaryan
vious mechanism where data tearing could happen only between pages of generated output data. Since current userspace considers data tearing between pages to be acceptable, we assume is will be able to handle sub-page data tearing as well. Signed-off-by: Suren Baghdasaryan --- fs/proc/internal.h

[PATCH v4 5/7] selftests/proc: add verbose more for tests to facilitate debugging

2025-06-04 Thread Suren Baghdasaryan
Add verbose mode to the proc tests to print debugging information. Usage: proc-pid-vm -v Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 154 +++-- 1 file changed, 141 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/proc

[PATCH v4 4/7] selftests/proc: test PROCMAP_QUERY ioctl while vma is concurrently modified

2025-06-04 Thread Suren Baghdasaryan
Extend /proc/pid/maps tearing test to verify PROCMAP_QUERY ioctl operation correctness while the vma is being concurrently modified. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 60 ++ 1 file changed, 60 insertions(+) diff --git a/tools

[PATCH v4 3/7] selftests/proc: extend /proc/pid/maps tearing test to include vma remapping

2025-06-04 Thread Suren Baghdasaryan
concurrently from under the reader. We should always see either original vma or the split one with no holes. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 92 ++ 1 file changed, 92 insertions(+) diff --git a/tools/testing/selftests/proc/proc-pid

[PATCH v4 2/7] selftests/proc: extend /proc/pid/maps tearing test to include vma resizing

2025-06-04 Thread Suren Baghdasaryan
the vma. Signed-off-by: Suren Baghdasaryan --- tools/testing/selftests/proc/proc-pid-vm.c | 83 ++ 1 file changed, 83 insertions(+) diff --git a/tools/testing/selftests/proc/proc-pid-vm.c b/tools/testing/selftests/proc/proc-pid-vm.c index 6e3f06376a1f..39842e4ec45f 100644

[PATCH v4 1/7] selftests/proc: add /proc/pid/maps tearing from vma split test

2025-06-04 Thread Suren Baghdasaryan
second page for consistency, looking for the effects of vma splits or merges. The test duration is configurable via the -d command-line parameter in seconds to increase the likelihood of catching the race condition. The default test duration is 5 seconds. Example Command: proc-pid-vm -d 10 Signe

[PATCH v4 0/7] use per-vma locks for /proc/pid/maps reads and PROCMAP_QUERY

2025-06-04 Thread Suren Baghdasaryan
ies. [1] https://lore.kernel.org/all/20250418174959.1431962-1-sur...@google.com/ [2] https://github.com/paulmckrcu/proc-mmap_sem-test Suren Baghdasaryan (7): selftests/proc: add /proc/pid/maps tearing from vma split test selftests/proc: extend /proc/pid/maps tearing test to include vma resiz

Re: [PATCH v2] mm/pagewalk: split walk_page_range_novma() into kernel/user parts

2025-06-04 Thread Suren Baghdasaryan
g() internal to mm. > > Note that ptdump uses the precise same function for kernel walking as a > convenience, so we permit this but make it very explicit by having > walk_page_range_novma() invoke walk_kernel_page_table_range() in this case. > > Signed-off-by: Lorenz

Re: [PATCH 1/1] alloc_tag: handle module codetag load errors as module load failures

2025-05-21 Thread Suren Baghdasaryan
On Wed, May 21, 2025 at 2:04 PM Casey Chen wrote: > > On Wed, May 21, 2025 at 9:06 AM Suren Baghdasaryan wrote: > > > > Failures inside codetag_load_module() are currently ignored. As a > > result an error there would not cause a module load failure and freeing > &g

[PATCH 1/1] alloc_tag: handle module codetag load errors as module load failures

2025-05-21 Thread Suren Baghdasaryan
c_tag: allocate percpu counters for module tags dynamically") Reported-by: Casey Chen Closes: https://lore.kernel.org/all/20250520231620.15259-1-cac...@purestorage.com/ Signed-off-by: Suren Baghdasaryan Cc: sta...@vger.kernel.org --- include/linux/codetag.h | 8 kernel/module/main

Re: [PATCH v2] module: release codetag section when module load fails

2025-05-19 Thread Suren Baghdasaryan
On Mon, May 19, 2025 at 9:46 AM Suren Baghdasaryan wrote: > > On Mon, May 19, 2025 at 9:38 AM David Wang <00107...@163.com> wrote: > > > > When module load fails after memory for codetag section is ready, > > codetag section memory will not be properly released. Th

Re: [PATCH v2] module: release codetag section when module load fails

2025-05-19 Thread Suren Baghdasaryan
dule address, codetag may pick the uninitialized section > when manipulating tags during module unload, and leads to > "unable to handle page fault" BUG. > > Closes: https://lore.kernel.org/all/20250516131246.6244-1-00107...@163.com/ > Signed-off-by: David Wang <00107...@163

Re: [PATCH] module: release codetag section when module load fails

2025-05-19 Thread Suren Baghdasaryan
107...@163.com/ > Signed-off-by: David Wang <00107...@163.com> Acked-by: Suren Baghdasaryan > --- > kernel/module/main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/module/main.c b/kernel/module/main.c > index a2859dc3eea6..5c6ab20240a6 100644 > ---

Re: [PATCH v4 2/9] slab: add sheaf support for batching kfree_rcu() operations

2025-05-15 Thread Suren Baghdasaryan
On Thu, May 15, 2025 at 1:45 AM Vlastimil Babka wrote: > > On 5/14/25 16:01, Vlastimil Babka wrote: > > On 5/6/25 23:34, Suren Baghdasaryan wrote: > >> On Fri, Apr 25, 2025 at 1:27 AM Vlastimil Babka wrote: > >>> @@ -2631,6 +2637,24 @@ static void sheaf_flush_u

Re: [PATCH v4 0/9] SLUB percpu sheaves

2025-05-15 Thread Suren Baghdasaryan
On Thu, May 15, 2025 at 5:46 AM Vlastimil Babka wrote: > > On 4/25/25 10:27, Vlastimil Babka wrote: > > Hi, > > > > This is the v4 and first non-RFC series to add an opt-in percpu > > array-based caching layer to SLUB, following the LSF/MM discussions. > > Since v3 I've also made changes to achiev

Re: [PATCH v4 1/9] slab: add opt-in caching layer of percpu sheaves

2025-05-06 Thread Suren Baghdasaryan
> barn has a spin_lock. > > When slub_debug is enabled for a cache with sheaf_capacity also > specified, the latter is ignored so that allocations and frees reach the > slow path where debugging hooks are processed. > > Signed-off-by: Vlastimil Babka Reviewed-by: Suren Ba

Re: [PATCH v4 1/9] slab: add opt-in caching layer of percpu sheaves

2025-05-06 Thread Suren Baghdasaryan
On Tue, May 6, 2025 at 10:32 AM Suren Baghdasaryan wrote: > > On Mon, Apr 28, 2025 at 12:01 AM Vlastimil Babka wrote: > > > > On 4/25/25 19:31, Christoph Lameter (Ampere) wrote: > > > On Fri, 25 Apr 2025, Vlastimil Babka wrote: > > > > > >> @@ -

Re: [PATCH v4 8/9] mm, vma: use percpu sheaves for vm_area_struct cache

2025-05-06 Thread Suren Baghdasaryan
justed. Reviewed-by: Suren Baghdasaryan > --- > kernel/fork.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/fork.c b/kernel/fork.c > index > c4b26cd8998b8e7b2b516e0bb0b1d4676ff644dc..3bd711f0798c88aee04bc30ff21fc4ca2b66201a > 100644 > --- a/kernel/fo

Re: [PATCH v4 3/9] slab: sheaf prefilling for guaranteed allocations

2025-05-06 Thread Suren Baghdasaryan
ercpu sheaves > exist for it, but the prefill functionality is still provided simply by > all prefilled sheaves becoming oversize. If percpu sheaves are not > created for a cache due to not passing the sheaf_capacity argument on > cache creation, the prefills also work through ove

Re: [PATCH v4 2/9] slab: add sheaf support for batching kfree_rcu() operations

2025-05-06 Thread Suren Baghdasaryan
On Fri, Apr 25, 2025 at 1:27 AM Vlastimil Babka wrote: > > Extend the sheaf infrastructure for more efficient kfree_rcu() handling. > For caches with sheaves, on each cpu maintain a rcu_free sheaf in > addition to main and spare sheaves. > > kfree_rcu() operations will try to put objects on this s

Re: [PATCH v4 1/9] slab: add opt-in caching layer of percpu sheaves

2025-05-06 Thread Suren Baghdasaryan
On Mon, Apr 28, 2025 at 12:01 AM Vlastimil Babka wrote: > > On 4/25/25 19:31, Christoph Lameter (Ampere) wrote: > > On Fri, 25 Apr 2025, Vlastimil Babka wrote: > > > >> @@ -4195,7 +4793,11 @@ static __fastpath_inline void > >> *slab_alloc_node(struct kmem_cache *s, struct list > >> if (unlik

Re: [PATCH v3 7/8] mm/maps: read proc/pid/maps under RCU

2025-05-05 Thread Suren Baghdasaryan
On Mon, May 5, 2025 at 6:50 AM Christian Brauner wrote: > > On Tue, Apr 29, 2025 at 08:54:58PM +0200, Jann Horn wrote: > > On Tue, Apr 29, 2025 at 8:04 PM Suren Baghdasaryan > > wrote: > > > On Tue, Apr 29, 2025 at 10:21 AM Jann Horn wrote: > > > > >

Re: [PATCH v3 8/8] mm/maps: execute PROCMAP_QUERY ioctl under RCU

2025-05-02 Thread Suren Baghdasaryan
On Fri, May 2, 2025 at 3:11 PM Jann Horn wrote: > > On Fri, May 2, 2025 at 12:10 AM Andrii Nakryiko > wrote: > > On Tue, Apr 29, 2025 at 10:25 AM Jann Horn wrote: > > > On Tue, Apr 29, 2025 at 7:15 PM Suren Baghdasaryan > > > wrote: > > > > On

Re: [PATCH v3 7/8] mm/maps: read proc/pid/maps under RCU

2025-04-29 Thread Suren Baghdasaryan
On Tue, Apr 29, 2025 at 11:55 AM Jann Horn wrote: > > On Tue, Apr 29, 2025 at 8:04 PM Suren Baghdasaryan wrote: > > On Tue, Apr 29, 2025 at 10:21 AM Jann Horn wrote: > > > > > > Hi! > > > > > > (I just noticed that I incorrectly assumed that VM

Re: [PATCH v3 7/8] mm/maps: read proc/pid/maps under RCU

2025-04-29 Thread Suren Baghdasaryan
want to make sure I'm not missing something... > > On Tue, Apr 29, 2025 at 7:09 PM Suren Baghdasaryan wrote: > > On Tue, Apr 29, 2025 at 8:40 AM Jann Horn wrote: > > > On Fri, Apr 18, 2025 at 7:50 PM Suren Baghdasaryan > > > wrote: > > > > Wi

Re: [PATCH v3 8/8] mm/maps: execute PROCMAP_QUERY ioctl under RCU

2025-04-29 Thread Suren Baghdasaryan
On Tue, Apr 29, 2025 at 8:56 AM Jann Horn wrote: > > On Wed, Apr 23, 2025 at 12:54 AM Andrii Nakryiko > wrote: > > On Fri, Apr 18, 2025 at 10:50 AM Suren Baghdasaryan > > wrote: > > > Utilize speculative vma lookup to find and snapshot a vma without > > >

Re: [PATCH v3 7/8] mm/maps: read proc/pid/maps under RCU

2025-04-29 Thread Suren Baghdasaryan
On Tue, Apr 29, 2025 at 8:40 AM Jann Horn wrote: > > On Fri, Apr 18, 2025 at 7:50 PM Suren Baghdasaryan wrote: > > With maple_tree supporting vma tree traversal under RCU and vma and > > its important members being RCU-safe, /proc/pid/maps can be read under > > RCU and

Re: [PATCH v3 7/8] mm/maps: read proc/pid/maps under RCU

2025-04-24 Thread Suren Baghdasaryan
On Thu, Apr 24, 2025 at 9:42 AM Liam R. Howlett wrote: > > * Andrii Nakryiko [250424 12:04]: > > On Thu, Apr 24, 2025 at 8:20 AM Suren Baghdasaryan > > wrote: > > > > > > On Wed, Apr 23, 2025 at 5:24 PM Liam R. Howlett > > > wrote: >

Re: [PATCH v3 7/8] mm/maps: read proc/pid/maps under RCU

2025-04-24 Thread Suren Baghdasaryan
On Wed, Apr 23, 2025 at 5:24 PM Liam R. Howlett wrote: > > * Andrii Nakryiko [250423 18:06]: > > On Wed, Apr 23, 2025 at 2:49 PM Suren Baghdasaryan > > wrote: > > > > > > On Tue, Apr 22, 2025 at 3:49 PM Andrii Nakryiko > > > wrote: > >

  1   2   3   4   5   >