On Wed, Sep 10, 2025 at 2:10 AM Saket Kumar Bhaskar <skb99@xxxxxxxxxxxxx> wrote: > > On Tue, Jul 30, 2024 at 01:03:17PM -0700, Andrii Nakryiko wrote: > > On Sun, Jul 28, 2024 at 12:38 PM Jiri Olsa <olsajiri@xxxxxxxxx> wrote: > > > > > > On Fri, Jul 26, 2024 at 05:37:55PM -0700, Andrii Nakryiko wrote: > > > > On Fri, Jul 26, 2024 at 5:27 AM Jiri Olsa <olsajiri@xxxxxxxxx> wrote: > > > > > > > > > > On Thu, Jul 25, 2024 at 01:03:55PM -0700, Andrii Nakryiko wrote: > > > > > > On Thu, Jul 25, 2024 at 5:12 AM Jiri Olsa <olsajiri@xxxxxxxxx> wrote: > > > > > > > > > > > > > > On Wed, Jul 24, 2024 at 03:52:10PM -0700, Andrii Nakryiko wrote: > > > > > > > > Add a new set of tests validating behavior of capturing stack traces > > > > > > > > with build ID. We extend uprobe_multi target binary with ability to > > > > > > > > trigger uprobe (so that we can capture stack traces from it), but also > > > > > > > > we allow to force build ID data to be either resident or non-resident in > > > > > > > > memory (see also a comment about quirks of MADV_PAGEOUT). > > > > > > > > > > > > > > > > That way we can validate that in non-sleepable context we won't get > > > > > > > > build ID (as expected), but with sleepable uprobes we will get that > > > > > > > > build ID regardless of it being physically present in memory. > > > > > > > > > > > > > > > > Also, we add a small add-on linker script which reorders > > > > > > > > .note.gnu.build-id section and puts it after (big) .text section, > > > > > > > > putting build ID data outside of the very first page of ELF file. This > > > > > > > > will test all the relaxations we did in build ID parsing logic in kernel > > > > > > > > thanks to freader abstraction. > > > > > > > > > > > > > > > > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > > > > > > > > > > > > > > one of my bpf selftests runs showed: > > > > > > > > > > > > > > test_build_id:PASS:parse_build_id 0 nsec > > > > > > > subtest_nofault:PASS:skel_open 0 nsec > > > > > > > subtest_nofault:PASS:link 0 nsec > > > > > > > subtest_nofault:PASS:trigger_uprobe 0 nsec > > > > > > > subtest_nofault:PASS:res 0 nsec > > > > > > > subtest_nofault:FAIL:build_id_status unexpected build_id_status: actual 1 != expected 2 > > > > > > > #42/1 build_id/nofault-paged-out:FAIL > > > > > > > #42/2 build_id/nofault-paged-in:OK > > > > > > > #42/3 build_id/sleepable:OK > > > > > > > #42 build_id:FAIL > > > > > > > > > > > > > > I could never reproduce again.. but I wonder the the page could sneak > > > > > > > in before the bpf program is hit and the buildid will get parsed? > > > > > > > > > > > > > > > > > > > Yes, and I just realized that I forgot to mark this test as serial. If > > > > > > there is parallel test that also runs uprobe_multi and that causes > > > > > > build_id page to be paged in into page cache, then this might succeed. > > > > > > So I need to mark the test itself serial. > > > > > > > > > > > > Another issue which I was debugging (and fixed) yesterday was that if > > > > > > the memory passed for MADV_PAGEOUT is not yet memory mapped into the > > > > > > current process, then it won't be really removed from the page cache. > > > > > > I avoid that by first paging it in, and then MADV_PAGEOUT. > > > > > > > > > > ok, I triggered that in serial run, so I probably hit this one > > > > > > > > > > > > > you did it with v2 of the patch set? I had this bug in v1, but v2 > > > > should be fine, as far as I understand (due to unconditional > > > > madvise(addr, page_sz, MADV_POPULATE_READ); before madvise(addr, > > > > page_sz, MADV_PAGEOUT)). At least I haven't been able to reproduce > > > > that anymore and BPF CI is now happy as well. > > > > > > yes, it's with v2 and I can still see that.. but only for the first run of > > > the test after reboot.. so far I have no clue.. I can see the successful > > > page-out madvise (still not sure how much is that telling about the page > > > being paged out), and then the build id code sees the page just fine > > > > > > attaching my .config in case > > > > > > > I wasn't able to repro this, sorry. It works very reliably for me with > > your or my config. Given it also seems to work reliably in BPF CI, I'm > > still inclined to add this tests, I think it's good to have that > > coverage. > > > > I'll monitor, and if it becomes flaky, we'll need to reassess this, of course. > > > Hi Andrii and Jirka, > > I encountered this error on powerpc, which is happening quiet consistently: > > # ./test_progs -t build_id/nofault-paged-out > serial_test_build_id:PASS:parse_build_id 0 nsec > subtest_nofault:PASS:skel_open 0 nsec > subtest_nofault:PASS:link 0 nsec > subtest_nofault:PASS:trigger_uprobe 0 nsec > subtest_nofault:PASS:res 0 nsec > subtest_nofault:FAIL:build_id_status unexpected build_id_status: actual 1 != expected 2 > #46/1 build_id/nofault-paged-out:FAIL > #46 build_id:FAIL > #397 stacktrace_build_id:OK > #398 stacktrace_build_id_nmi:OK > > I dumped vma mapping using pmap in trigger_uprobe function > before/after MADV_POPULATE_READ and b/w MADV_POPULATE_READ > and MADV_PAGEOUT, page residency using mincore() (as shown > "Before uprobe: Page residency = ") and addr (as shown > "Entered trigger_uprobe addr ->"). > > Here I am putting out 3 scenarios: > > 1. #./test_progs -t build_id/nofault-paged-out > Entered trigger_uprobe addr -> 0x105a0000 > 144992: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7744 704 64 r-x-- uprobe_multi > 0000000010790000 64 64 64 r---- uprobe_multi > 00000000107a0000 64 64 64 rw--- uprobe_multi > 000001002bf90000 192 64 64 rw--- [ anon ] > 00007fffb55d0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffb56a0000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffb56b0000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffb56c0000 2304 1280 0 r-x-- libc.so.6 > 00007fffb5900000 64 64 64 r---- libc.so.6 > 00007fffb5910000 64 64 64 rw--- libc.so.6 > 00007fffb5920000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffb5950000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffb5960000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffb5970000 192 64 0 r-x-- libelf-0.192.so > 00007fffb59a0000 64 64 64 r---- libelf-0.192.so > 00007fffb59b0000 64 0 0 rw--- [ anon ] > 00007fffb59d0000 256 0 0 r---- [ anon ] > 00007fffb5a10000 64 64 0 r-x-- [ anon ] > 00007fffb5a20000 320 320 0 r-x-- ld64.so.2 > 00007fffb5a70000 64 64 64 r---- ld64.so.2 > 00007fffb5a80000 64 64 64 rw--- ld64.so.2 > 00007fffee7a0000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13056 3392 896 > 144992: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7744 704 64 r-x-- uprobe_multi > 0000000010790000 64 64 64 r---- uprobe_multi > 00000000107a0000 64 64 64 rw--- uprobe_multi > 000001002bf90000 192 64 64 rw--- [ anon ] > 00007fffb55d0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffb56a0000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffb56b0000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffb56c0000 2304 1344 0 r-x-- libc.so.6 > 00007fffb5900000 64 64 64 r---- libc.so.6 > 00007fffb5910000 64 64 64 rw--- libc.so.6 > 00007fffb5920000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffb5950000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffb5960000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffb5970000 192 64 0 r-x-- libelf-0.192.so > 00007fffb59a0000 64 64 64 r---- libelf-0.192.so > 00007fffb59b0000 64 0 0 rw--- [ anon ] > 00007fffb59d0000 256 0 0 r---- [ anon ] > 00007fffb5a10000 64 64 0 r-x-- [ anon ] > 00007fffb5a20000 320 320 0 r-x-- ld64.so.2 > 00007fffb5a70000 64 64 64 r---- ld64.so.2 > 00007fffb5a80000 64 64 64 rw--- ld64.so.2 > 00007fffee7a0000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13056 3456 896 > 144992: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7744 704 64 r-x-- uprobe_multi > 0000000010790000 64 64 64 r---- uprobe_multi > 00000000107a0000 64 64 64 rw--- uprobe_multi > 000001002bf90000 192 64 64 rw--- [ anon ] > 00007fffb55d0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffb56a0000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffb56b0000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffb56c0000 2304 1344 0 r-x-- libc.so.6 > 00007fffb5900000 64 64 64 r---- libc.so.6 > 00007fffb5910000 64 64 64 rw--- libc.so.6 > 00007fffb5920000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffb5950000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffb5960000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffb5970000 192 64 0 r-x-- libelf-0.192.so > 00007fffb59a0000 64 64 64 r---- libelf-0.192.so > 00007fffb59b0000 64 0 0 rw--- [ anon ] > 00007fffb59d0000 256 0 0 r---- [ anon ] > 00007fffb5a10000 64 64 0 r-x-- [ anon ] > 00007fffb5a20000 320 320 0 r-x-- ld64.so.2 > 00007fffb5a70000 64 64 64 r---- ld64.so.2 > 00007fffb5a80000 64 64 64 rw--- ld64.so.2 > 00007fffee7a0000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13056 3456 896 > Before uprobe: Page residency = resident > After uprobe: Page residency = resident > serial_test_build_id:PASS:parse_build_id 0 nsec > subtest_nofault:PASS:skel_open 0 nsec > subtest_nofault:PASS:link 0 nsec > subtest_nofault:PASS:trigger_uprobe 0 nsec > subtest_nofault:PASS:res 0 nsec > subtest_nofault:FAIL:build_id_status unexpected build_id_status: actual 1 != expected 2 > #46/1 build_id/nofault-paged-out:FAIL > #46 build_id:FAIL > #397 stacktrace_build_id:OK > #398 stacktrace_build_id_nmi:OK > > All error logs: > serial_test_build_id:PASS:parse_build_id 0 nsec > subtest_nofault:PASS:skel_open 0 nsec > subtest_nofault:PASS:link 0 nsec > subtest_nofault:PASS:trigger_uprobe 0 nsec > subtest_nofault:PASS:res 0 nsec > subtest_nofault:FAIL:build_id_status unexpected build_id_status: actual 1 != expected 2 > #46/1 build_id/nofault-paged-out:FAIL > #46 build_id:FAIL > Summary: 2/0 PASSED, 0 SKIPPED, 1 FAILED > > Here it can be seen that RSS for vma containing addr (0x105a0000) > is not changing (remains 704) and the selftest fails. > > 2. When alignment in linker script is changed to 65536 (default > page size in powerpc is 64k): > > git diff uprobe_multi.ld > diff --git a/tools/testing/selftests/bpf/uprobe_multi.ld b/tools/testing/selftests/bpf/uprobe_multi.ld > index a2e94828b..2063714b2 100644 > --- a/tools/testing/selftests/bpf/uprobe_multi.ld > +++ b/tools/testing/selftests/bpf/uprobe_multi.ld > @@ -1,8 +1,8 @@ > SECTIONS > { > - . = ALIGN(4096); > + . = ALIGN(65536); > .note.gnu.build-id : { *(.note.gnu.build-id) } > - . = ALIGN(4096); > + . = ALIGN(65536); > } > INSERT AFTER .text; > > #./test_progs -t build_id/nofault-paged-out -v > bpf_testmod.ko is already unloaded. > Loading bpf_testmod.ko... > Successfully loaded bpf_testmod.ko. > serial_test_build_id:PASS:parse_build_id 0 nsec > subtest_nofault:PASS:skel_open 0 nsec > subtest_nofault:PASS:link 0 nsec > Entered trigger_uprobe addr -> 0x105b0000 > 145238: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7872 768 768 r-x-- uprobe_multi > 00000000107b0000 64 64 64 r---- uprobe_multi > 00000000107c0000 64 64 64 rw--- uprobe_multi > 000001003a6b0000 192 64 64 rw--- [ anon ] > 00007fffa3eb0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffa3f80000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffa3f90000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffa3fa0000 2304 1280 0 r-x-- libc.so.6 > 00007fffa41e0000 64 64 64 r---- libc.so.6 > 00007fffa41f0000 64 64 64 rw--- libc.so.6 > 00007fffa4200000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffa4230000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffa4240000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffa4250000 192 64 0 r-x-- libelf-0.192.so > 00007fffa4280000 64 64 64 r---- libelf-0.192.so > 00007fffa4290000 64 0 0 rw--- [ anon ] > 00007fffa42b0000 256 0 0 r---- [ anon ] > 00007fffa42f0000 64 64 0 r-x-- [ anon ] > 00007fffa4300000 320 320 0 r-x-- ld64.so.2 > 00007fffa4350000 64 64 64 r---- ld64.so.2 > 00007fffa4360000 64 64 64 rw--- ld64.so.2 > 00007fffc6880000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13184 3456 1600 > 145238: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7872 832 832 r-x-- uprobe_multi > 00000000107b0000 64 64 64 r---- uprobe_multi > 00000000107c0000 64 64 64 rw--- uprobe_multi > 000001003a6b0000 192 64 64 rw--- [ anon ] > 00007fffa3eb0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffa3f80000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffa3f90000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffa3fa0000 2304 1344 0 r-x-- libc.so.6 > 00007fffa41e0000 64 64 64 r---- libc.so.6 > 00007fffa41f0000 64 64 64 rw--- libc.so.6 > 00007fffa4200000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffa4230000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffa4240000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffa4250000 192 64 0 r-x-- libelf-0.192.so > 00007fffa4280000 64 64 64 r---- libelf-0.192.so > 00007fffa4290000 64 0 0 rw--- [ anon ] > 00007fffa42b0000 256 0 0 r---- [ anon ] > 00007fffa42f0000 64 64 0 r-x-- [ anon ] > 00007fffa4300000 320 320 0 r-x-- ld64.so.2 > 00007fffa4350000 64 64 64 r---- ld64.so.2 > 00007fffa4360000 64 64 64 rw--- ld64.so.2 > 00007fffc6880000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13184 3584 1664 > 145238: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7872 768 768 r-x-- uprobe_multi > 00000000107b0000 64 64 64 r---- uprobe_multi > 00000000107c0000 64 64 64 rw--- uprobe_multi > 000001003a6b0000 192 64 64 rw--- [ anon ] > 00007fffa3eb0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffa3f80000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffa3f90000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffa3fa0000 2304 1344 0 r-x-- libc.so.6 > 00007fffa41e0000 64 64 64 r---- libc.so.6 > 00007fffa41f0000 64 64 64 rw--- libc.so.6 > 00007fffa4200000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffa4230000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffa4240000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffa4250000 192 64 0 r-x-- libelf-0.192.so > 00007fffa4280000 64 64 64 r---- libelf-0.192.so > 00007fffa4290000 64 0 0 rw--- [ anon ] > 00007fffa42b0000 256 0 0 r---- [ anon ] > 00007fffa42f0000 64 64 0 r-x-- [ anon ] > 00007fffa4300000 320 320 0 r-x-- ld64.so.2 > 00007fffa4350000 64 64 64 r---- ld64.so.2 > 00007fffa4360000 64 64 64 rw--- ld64.so.2 > 00007fffc6880000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13184 3520 1600 > Before uprobe: Page residency = resident > After uprobe: Page residency = resident > subtest_nofault:PASS:trigger_uprobe 0 nsec > subtest_nofault:PASS:res 0 nsec > FRAME #00: BUILD ID = 4f635d1d48e4f2b67b62a9a07285668cdc85fb18 OFFSET = 2c3f1c > FRAME #01: BUILD ID = 4f635d1d48e4f2b67b62a9a07285668cdc85fb18 OFFSET = 5a0824 > FRAME #02: BUILD ID = 4f635d1d48e4f2b67b62a9a07285668cdc85fb18 OFFSET = 5a0994 > FRAME #03: BUILD ID = 09139ae1e5cbaf5c598222698e5b8e2e250260b1 OFFSET = 2aba4 > FRAME #04: BUILD ID = 09139ae1e5cbaf5c598222698e5b8e2e250260b1 OFFSET = 2adec > FRAME #05: BUILD ID = 4f635d1d48e4f2b67b62a9a07285668cdc85fb18 OFFSET = fffffffff0000000 > subtest_nofault:FAIL:build_id_status unexpected build_id_status: actual 1 != expected 2 > #46/1 build_id/nofault-paged-out:FAIL > #46 build_id:FAIL > > Here RSS changes(768 -> 832 -> 768) but looks like page is still > not getting evicted (as shown "Before uprobe: Page residency = resident") > after MADV_PAGEOUT and the selftest fails. > > 3. But in the very next run page is evicted and selftest passes: > > #./test_progs -t build_id/nofault-paged-out > Entered trigger_uprobe addr -> 0x105b0000 > 145256: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7872 768 64 r-x-- uprobe_multi > 00000000107b0000 64 64 64 r---- uprobe_multi > 00000000107c0000 64 64 64 rw--- uprobe_multi > 00000100317b0000 192 64 64 rw--- [ anon ] > 00007fffa5cd0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffa5da0000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffa5db0000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffa5dc0000 2304 1280 0 r-x-- libc.so.6 > 00007fffa6000000 64 64 64 r---- libc.so.6 > 00007fffa6010000 64 64 64 rw--- libc.so.6 > 00007fffa6020000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffa6050000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffa6060000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffa6070000 192 64 0 r-x-- libelf-0.192.so > 00007fffa60a0000 64 64 64 r---- libelf-0.192.so > 00007fffa60b0000 64 0 0 rw--- [ anon ] > 00007fffa60d0000 256 0 0 r---- [ anon ] > 00007fffa6110000 64 64 0 r-x-- [ anon ] > 00007fffa6120000 320 320 0 r-x-- ld64.so.2 > 00007fffa6170000 64 64 64 r---- ld64.so.2 > 00007fffa6180000 64 64 64 rw--- ld64.so.2 > 00007ffff1890000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13184 3456 896 > 145256: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7872 832 64 r-x-- uprobe_multi > 00000000107b0000 64 64 64 r---- uprobe_multi > 00000000107c0000 64 64 64 rw--- uprobe_multi > 00000100317b0000 192 64 64 rw--- [ anon ] > 00007fffa5cd0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffa5da0000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffa5db0000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffa5dc0000 2304 1344 0 r-x-- libc.so.6 > 00007fffa6000000 64 64 64 r---- libc.so.6 > 00007fffa6010000 64 64 64 rw--- libc.so.6 > 00007fffa6020000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffa6050000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffa6060000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffa6070000 192 64 0 r-x-- libelf-0.192.so > 00007fffa60a0000 64 64 64 r---- libelf-0.192.so > 00007fffa60b0000 64 0 0 rw--- [ anon ] > 00007fffa60d0000 256 0 0 r---- [ anon ] > 00007fffa6110000 64 64 0 r-x-- [ anon ] > 00007fffa6120000 320 320 0 r-x-- ld64.so.2 > 00007fffa6170000 64 64 64 r---- ld64.so.2 > 00007fffa6180000 64 64 64 rw--- ld64.so.2 > 00007ffff1890000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13184 3584 896 > 145256: ./uprobe_multi uprobe-paged-out > Address Kbytes RSS Dirty Mode Mapping > 0000000010000000 7872 768 64 r-x-- uprobe_multi > 00000000107b0000 64 64 64 r---- uprobe_multi > 00000000107c0000 64 64 64 rw--- uprobe_multi > 00000100317b0000 192 64 64 rw--- [ anon ] > 00007fffa5cd0000 832 64 0 r-x-- libzstd.so.1.5.5 > 00007fffa5da0000 64 64 64 r---- libzstd.so.1.5.5 > 00007fffa5db0000 64 64 64 rw--- libzstd.so.1.5.5 > 00007fffa5dc0000 2304 1344 0 r-x-- libc.so.6 > 00007fffa6000000 64 64 64 r---- libc.so.6 > 00007fffa6010000 64 64 64 rw--- libc.so.6 > 00007fffa6020000 192 64 0 r-x-- libz.so.1.3.1.zlib-ng > 00007fffa6050000 64 64 64 r---- libz.so.1.3.1.zlib-ng > 00007fffa6060000 64 64 64 rw--- libz.so.1.3.1.zlib-ng > 00007fffa6070000 192 64 0 r-x-- libelf-0.192.so > 00007fffa60a0000 64 64 64 r---- libelf-0.192.so > 00007fffa60b0000 64 0 0 rw--- [ anon ] > 00007fffa60d0000 256 0 0 r---- [ anon ] > 00007fffa6110000 64 64 0 r-x-- [ anon ] > 00007fffa6120000 320 320 0 r-x-- ld64.so.2 > 00007fffa6170000 64 64 64 r---- ld64.so.2 > 00007fffa6180000 64 64 64 rw--- ld64.so.2 > 00007ffff1890000 192 64 64 rw--- [ stack ] > ---------------- ------- ------- ------- > total kB 13184 3520 896 > Before uprobe: Page residency = paged out > After uprobe: Page residency = paged out > #46/1 build_id/nofault-paged-out:OK > #46 build_id:OK > #397 stacktrace_build_id:OK > #398 stacktrace_build_id_nmi:OK > Summary: 3/1 PASSED, 0 SKIPPED, 0 FAILED > > Here it can be seen that page is evicted (as shown > "Before uprobe: Page residency = paged out"). > > Although the selftest occasionally passes, its behavior > remains flaky and unreliable across runs. But introducing > a sleep before/after both MADV_POPULATE_READ and MADV_PAGEOUT > tends to improve the consistency with which the selftest passes. > > Your valuable suggestions or thoughts on how best to address/debug > this further would be helpful. > How do you check page residency? Instead of just sleeping, I'd add the code that just waits for the page to be non-resident (with some reasonable time out in case of bugs), and wait until that condition happens. (And of course let's increase alignment to 64KB, it has to be page-aligned across supported architectures). > Regards, > Saket > > > jirka > > > > > > > > > ---- > > > # > > > # Automatically generated file; DO NOT EDIT. > > > # Linux/x86 6.10.0 Kernel Configuration > > > # > > > > [...] > >