public inbox for live-patching@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@redhat.com>
To: Song Liu <song@kernel.org>
Cc: Miroslav Benes <mbenes@suse.cz>,
	live-patching@vger.kernel.org, jpoimboe@kernel.org,
	jikos@kernel.org, pmladek@suse.com, kernel-team@meta.com
Subject: Re: [PATCH v3 8/8] livepatch: Add tests for klp-build toolchain
Date: Wed, 4 Mar 2026 20:39:16 -0500	[thread overview]
Message-ID: <aajexDFNdFz_Lsrp@redhat.com> (raw)
In-Reply-To: <CAPhsuW6Nx6meWVCkTJXmp5BzTX_2s2dt1j+C-=AtMzQ8ZV396A@mail.gmail.com>

On Wed, Mar 04, 2026 at 03:12:48PM -0800, Song Liu wrote:
> On Wed, Mar 4, 2026 at 11:33 AM Joe Lawrence <joe.lawrence@redhat.com> wrote:
> [...]
> 
> > I've been tinkering with ideas in this space, though I took it in a very
> > different direction.
> >
> > (First a disclaimer, this effort is largely the result of vibe coding
> > with Claude to prototype testing concepts, so I don't believe any of it
> > is reliable or upstream-worthy at this point.)
> >
> > From a top-down perspective, I might start with the generated test
> > reports:
> >
> > - https://file.rdu.redhat.com/~jolawren/artifacts/report.html
> > - https://file.rdu.redhat.com/~jolawren/artifacts/report.txt
> 
> I cannot access these two links.
> 

Gah, sorry about those internal links.

Try:

https://joe-lawrence.github.io/klp-build-selftest-artifacts/report.html
https://joe-lawrence.github.io/klp-build-selftest-artifacts/report.txt

> > and then in my own words:
> >
> [...]
> >
> > 5- Two patch targets:
> >
> > a) current-tree - target the user's current source tree
> > b) patched-tree - (temporarily) patch the user's tree to *exactly* what
> >                   we need to target
> >
> > Why?  In the kpatch-build project, patching the current-tree meant we
> > had to rebase patches for every release.  We also had to hunt and find
> > precise scenarios across the kernel tree to test, hoping they wouldn't
> > go away in future versions.  In other cases, the kernel or compiler
> > changed and we weren't testing the original problem any longer.
> 
> I would prefer making patched-tree as upstream + some different
> CONFIG_s. Otherwise, we will need to carry .patch files for the
> patched-tree in selftests, which seems weird.
> 

It is strange, but for my experiment, I wanted minimal disruption to the
tree.  For the "real" changeset, upstream + some testing CONFIG_ sounds
good to me.

> > That said, patching a dummy patched-tree isn't be perfect either,
> > particularly in the runtime sense.  You're not testing a release kernel,
> > but something slightly different.
> 
> This should not be a problem. The goal is to test the klp-build toolchain.
> 

Right, perhaps klp-build testing always targets a slightly modified
kernel (or at least CONFIG_) while livepatching testing operates against
the stock tree?

> > (Tangent: kpatch-build implemented a unit test scheme that cached object
> > files for even greater speed and fixed testing.  I haven't thought about
> > how a similar idea might work for klp-build.)
> 
> I think it is a good idea to have similar .o file tests for klp-diff
> in klp-build.
> 

kpatch-build uses a git submodule (a joy to work with /s), but maybe
upstream tree can fetch the binary objects from some external
(github/etc.) source?  I wonder if there is any kselftest precident for
this, we'll need to investigate that.

> >
> > 6- Two patch models:
> >
> > a) static .patch files
> > b) scripted .patch generation
> >
> > Why?  Sometimes a test like cmdline-string.patch is sufficient and
> > stable.  Other times it's not.  For example, the recount-many-file test
> > in this branch is implemented via a script.  This allows the test to be
> > dynamic and potentially avoid the rebasing problem mentioned above.
> 
> I think we can have both a) and b).
> 
> > 7- Build verification including ELF analysis.  Not very mature in this
> > branch, but it would be nice to be able to build on it:
> 
> If we test the behavior after loading the patches, ELF analysis might
> be optional. But we can also do both.
> 

Maybe, though doing so during the build test would give us that analysis
for future cross-compiled test cases without having to actually boot and
load them somewhere.

> [...]
> 
> >
> > 8- Probably more I've already forgotten about :) Cross-compilation may
> > be interesting for build testing in the future.  For the full AI created
> > commentary, there's https://github.com/joe-lawrence/linux/blob/klp-build-selftests/README.md
> 
> Yes, cross-compilation can be really useful.
> 

Agreed (I think Josh may be working on arm64 klp-build?) how many
dimensions of testing are we up to now :)

> > > > I was using kpatch for testing. I can replace it with insmod.
> > >
> >
> > Do the helpers in functions.sh for safely loading and unloading
> > livepatches (that wait for the transition, etc.) aid here?
> 
> Yes, we can reuse those.
> [...]
> 
> > To continue the bike shedding, in my branch, I had dumped this all under
> > a new tools/testing/klp-build subdirectory as my focus was to put
> > klp-build through the paces.  It does load the generated livepatches in
> > the runtime testing, but as only as a sanity check.  With that, it
> > didn't touch CONFIG or intermix testing with the livepatch/ set.
> >
> > If we do end up supplementing the livepatch/ with klp-build tests, then
> > I agree that naming them (either filename prefix or subdirectory) would
> > be nice.
> >
> > But first, is it goal for klp-build to be the build tool (rather than
> > simple module kbuild) for the livepatching .ko selftests?
> 
> I think we don't have to use klp-build for livepatch selftests. Existing
> tests work well as-is.
> 

--
Joe


  reply	other threads:[~2026-03-05  1:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26  0:54 [PATCH v3 0/8] objtool/klp: klp-build LTO support and tests Song Liu
2026-02-26  0:54 ` [PATCH v3 1/8] objtool/klp: Remove redundent strcmp in correlate_symbols Song Liu
2026-03-05 19:38   ` Josh Poimboeuf
2026-02-26  0:54 ` [PATCH v3 2/8] objtool/klp: Remove trailing '_' in demangle_name() Song Liu
2026-02-26  0:54 ` [PATCH v3 3/8] objtool/klp: Use sym->demangled_name for symbol_name hash Song Liu
2026-03-05 19:43   ` Josh Poimboeuf
2026-02-26  0:54 ` [PATCH v3 4/8] objtool/klp: Also demangle global objects Song Liu
2026-02-26  0:54 ` [PATCH v3 5/8] objtool/klp: Remove .llvm suffix in demangle_name() Song Liu
2026-02-26  0:54 ` [PATCH v3 6/8] objtool/klp: Match symbols based on demangled_name for global variables Song Liu
2026-02-26  0:54 ` [PATCH v3 7/8] objtool/klp: Correlate locals to globals Song Liu
2026-03-05 19:51   ` Josh Poimboeuf
2026-03-05 23:10     ` Song Liu
2026-02-26  0:54 ` [PATCH v3 8/8] livepatch: Add tests for klp-build toolchain Song Liu
2026-02-27 10:04   ` Miroslav Benes
2026-02-27 17:26     ` Song Liu
2026-03-02  8:38       ` Miroslav Benes
2026-03-04 19:33         ` Joe Lawrence
2026-03-04 23:12           ` Song Liu
2026-03-05  1:39             ` Joe Lawrence [this message]
2026-03-05  5:03               ` Song Liu
2026-03-05 14:08                 ` Petr Mladek
2026-03-05 15:18                   ` Joe Lawrence
2026-03-05 15:20           ` Petr Mladek
2026-03-05 18:50           ` Josh Poimboeuf
2026-03-06  9:13             ` Petr Mladek
2026-03-05 19:33   ` Josh Poimboeuf

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=aajexDFNdFz_Lsrp@redhat.com \
    --to=joe.lawrence@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --cc=song@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox