All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
	 Mike Rapoport <rppt@kernel.org>, Shuah Khan <shuah@kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Usama Arif <usama.arif@linux.dev>,
	linux-kernel@vger.kernel.org,  linux-kselftest@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH v3 0/6] selftests/liveupdate: add memfd tests
Date: Fri, 1 May 2026 19:08:28 +0000	[thread overview]
Message-ID: <afT5FDAXmcIfz-wI@plex> (raw)
In-Reply-To: <2vxzecjx52eu.fsf@kernel.org>

On 04-29 15:20, Pratyush Yadav wrote:
> On Tue, Apr 28 2026, Pasha Tatashin wrote:
> 
> > On 04-04 10:24, Pratyush Yadav wrote:
> >> From: "Pratyush Yadav (Google)" <pratyush@kernel.org>
> >> 
> >> Hi,
> >> 
> >> This series adds some tests for memfd preservation across a live update.
> >> Currently memfd is only tested indirectly via luo_kexec_simple or
> >> luo_multi_session. Add a dedicated test suite for it.
> >> 
> >> Patches 1 and 2 are preparatory, adding base framework and helpers, and
> >> the other patches each add a test. Some of the code is taken from the
> >> libluo patches [0] I sent a while ago.
> >> 
> >> [0] https://lore.kernel.org/linux-mm/20250723144649.1696299-33-pasha.tatashin@soleen.com/
> >
> > Here are few observations that I noticed when I tried to run your tests:
> >
> > 1. The '-h' tells you nothing about --stage argument:
> >
> > root@liveupdate-vm:~/liveupdate# ./luo_memfd -h
> > Usage: ./luo_memfd [-h|-l|-d] [-t|-T|-v|-V|-f|-F|-r name]
> > 	-h       print help
> > 	-l       list all tests
> > 	-d       enable debug prints
> >
> > 	-t name  include test
> > 	-T name  exclude test
> > 	-v name  include variant
> > 	-V name  exclude variant
> > 	-f name  include fixture
> > 	-F name  exclude fixture
> > 	-r name  run specified test
> > 	...
> 
> Yeah, unfortunately that is a side effect of using test_harness_run(),
> which does not know anything about the options specific to our test.
> 
> >
> > 2. '-l' does not work after you run stage1, do you keep /dev/liveupdate 
> > open? That is not needed, we only need to keep session open.
> 
> Oh yeah, I keep forgetting that is no longer needed. The main process
> closes the FD but the forked daemons hold a reference. I can clean that
> up via a fixture.
> 
> >
> > root@liveupdate-vm:~/liveupdate# ./luo_memfd -l
> > 1..0 # SKIP Failed to open /dev/liveupdate (Device or resource busy) device. Is LUO enabled?
> >
> > 3. Stage 1 has proper [STAGE 1] prefix, but no [STAGE 2] prefix for 
> 
> Because stage 2 has no prints, all the prints are coming from the
> selftest harness. Those same lines are also not prefixed in stage 1. If
> you'd like, I can add a print beforehand that shows which stage is

Yes, please, add a least one [STAGE 2] print.

> running. Other than that, I don't see what else we can do. I don't want
> to modify the selftest harness.
> 
> > stage 2:
> > # Starting 4 tests from 1 test cases.
> > #  RUN           global.memfd_data ...
> > # [STAGE 1] Forking persistent child to hold sessions...
> > # [STAGE 1] Child PID: 245. Resources are pinned.
> > # [STAGE 1] You may now perform kexec reboot.
> > #            OK  global.memfd_data
> > ok 1 global.memfd_data
> > #  RUN           global.zero_memfd ...
> > # [STAGE 1] Forking persistent child to hold sessions...
> > # [STAGE 1] Child PID: 247. Resources are pinned.
> > # [STAGE 1] You may now perform kexec reboot.
> > #            OK  global.zero_memfd
> > ok 2 global.zero_memfd
> > #  RUN           global.preserved_ops ...
> > #            OK  global.preserved_ops
> > ok 3 global.preserved_ops
> > #  RUN           global.fallocate_memfd ...
> > # [STAGE 1] Forking persistent child to hold sessions...
> > # [STAGE 1] Child PID: 250. Resources are pinned.
> > # [STAGE 1] You may now perform kexec reboot.
> > #            OK  global.fallocate_memfd
> > ok 4 global.fallocate_memfd
> > # PASSED: 4 / 4 tests passed.
> > # Totals: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0
> >
> > ./do_kexec
> >
> > root@liveupdate-vm:~/liveupdate# ./luo_memfd
> > TAP version 13
> > 1..4
> > # Starting 4 tests from 1 test cases.
> > #  RUN           global.memfd_data ...
> > #            OK  global.memfd_data
> > ok 1 global.memfd_data
> > #  RUN           global.zero_memfd ...
> > #            OK  global.zero_memfd
> > ok 2 global.zero_memfd
> > #  RUN           global.preserved_ops ...
> > #      SKIP      test only expected to run on stage 1
> > #            OK  global.preserved_ops
> > ok 3 global.preserved_ops # SKIP test only expected to run on stage 1
> > #  RUN           global.fallocate_memfd ...
> > #            OK  global.fallocate_memfd
> > ok 4 global.fallocate_memfd
> > # PASSED: 4 / 4 tests passed.
> > # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage.
> > # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:1 error:0
> >
> > 4. I also do not like that we now have duplicated stage parsing code in  
> > luo_test(), perhaps we should add our own  test_harness_run() variant 
> > that depends on stage, and use it in both current tests, and the new 
> > memfd tests.
> 
> Sounds good in principle, but unfortunately ends up duplicating a lot of
> logic in test_harness_run() that is not a good idea IMO. We should work
> with the harness not fork off into our own.
> 
> I suppose we can refactor some of the logic there to split into
> functions that we can then use in our luo_test_harness_run(), but
> keeping the option parsing logic in sync is going to be difficult.
> 
> And for the duplicated logic, I agree. I thought about cleaning it up
> but was feeling lazy... Well now that you have called it out let me see
> what I can do.

The main point is that the luo_sessions and luo_memfds tests should use 
a common framework, whether that's luo_test_harness_run() or the generic 
test_harness_run(). I don't have a definitive answer for this, so I 
recommend tinkering with it to see what works best.

Pasha

> 
> [...]
> 
> -- 
> Regards,
> Pratyush Yadav

  reply	other threads:[~2026-05-01 19:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-04 10:24 [PATCH v3 0/6] selftests/liveupdate: add memfd tests Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 1/6] selftests/liveupdate: add framework for " Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 2/6] selftests/liveupdate: add helper functions " Pratyush Yadav
2026-04-04 17:53   ` Zhu Yanjun
2026-04-05  7:34     ` Pratyush Yadav
2026-04-05 16:30       ` Zhu Yanjun
2026-04-07 10:30         ` Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 3/6] selftests/liveupdate: add test for memfd content preservation Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 4/6] selftests/liveupdate: add test for zero-size memfd preservation Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 5/6] selftests/liveupdate: add test for operations on a preserved memfd Pratyush Yadav
2026-04-04 10:24 ` [PATCH v3 6/6] selftests/liveupdate: add fallocate test for memfd Pratyush Yadav
2026-04-28 19:31 ` [PATCH v3 0/6] selftests/liveupdate: add memfd tests Pasha Tatashin
2026-04-29 13:20   ` Pratyush Yadav
2026-05-01 19:08     ` Pasha Tatashin [this message]
2026-05-05 16:32       ` Pasha Tatashin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afT5FDAXmcIfz-wI@plex \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=shuah@kernel.org \
    --cc=usama.arif@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.