Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] kho: Add support for kunit mocking KHO restore API
@ 2026-05-12 19:51 Samiullah Khawaja
  2026-05-12 19:51 ` [PATCH 1/3] kho: Add kunit static stubs Samiullah Khawaja
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Samiullah Khawaja @ 2026-05-12 19:51 UTC (permalink / raw)
  To: Pasha Tatashin, Mike Rapoport, Pratyush Yadav, Alexander Graf
  Cc: Samiullah Khawaja, David Matlack, open list,
	open list:KEXEC HANDOVER (KHO), open list:KEXEC HANDOVER (KHO)

To write kunit tests for preservation and restoration of liveupdate
state in various subsystems without triggering the actual kexec, the KHO
restore API needs to be mocked by the test writer. The mocking is done
to allow testing of the individual components or functions in isolation.

The patch series adds the following to support kunit testing when using the KHO
API:

- Add static stub hooks to mock the KHO restore API so the restore path
  can be tested without triggering kexec.
- Add helper function that can be used by the test writer to check if
  memory is preserved in KHO tree.

Finally, it adds a KUnit test for the KHO API that verifies the allocation of
preserved memory, and the preservation/restoration of pages and folios.

KHO Kunit test run:

 KTAP version 1
 1..1
     KTAP version 1
     # Subtest: kho_test
     # module: kexec_handover_test
     1..3
     ok 1 kho_test_alloc_preserve
     ok 2 kho_test_preserve_pages
     ok 3 kho_test_preserve_folio
 # kho_test: pass:3 fail:0 skip:0 total:3
 # Totals: pass:3 fail:0 skip:0 total:3
 ok 1 kho_test

Samiullah Khawaja (3):
  kho: Add kunit static stubs
  kho: Add helper function to check if pages are preserved
  kho: Add kunit test to verify preserve/restore pages and folio

 include/linux/kexec_handover.h          |   5 +
 kernel/liveupdate/Kconfig               |  10 ++
 kernel/liveupdate/Makefile              |   1 +
 kernel/liveupdate/kexec_handover.c      |  61 ++++++++++-
 kernel/liveupdate/kexec_handover_test.c | 130 ++++++++++++++++++++++++
 5 files changed, 206 insertions(+), 1 deletion(-)
 create mode 100644 kernel/liveupdate/kexec_handover_test.c


base-commit: 9974969c14031a097d6b45bcb7a06bb4aa525c40
-- 
2.54.0.563.g4f69b47b94-goog



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-12 19:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 19:51 [PATCH 0/3] kho: Add support for kunit mocking KHO restore API Samiullah Khawaja
2026-05-12 19:51 ` [PATCH 1/3] kho: Add kunit static stubs Samiullah Khawaja
2026-05-12 19:51 ` [PATCH 2/3] kho: Add helper function to check if pages are preserved Samiullah Khawaja
2026-05-12 19:51 ` [PATCH 3/3] kho: Add kunit test to verify preserve/restore pages and folio Samiullah Khawaja

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox