From: Sean Christopherson <seanjc@google.com>
To: Ackerley Tng <ackerleytng@google.com>
Cc: Kees Cook <kees@kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Will Drewry <wad@chromium.org>, Shuah Khan <shuah@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
thomas.weissschuh@linutronix.de, linux@weissschuh.net,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kvm@vger.kernel.org
Subject: Re: [PATCH RFC 0/4] selftests: harness: Provide global metadata pointer to allow clean teardown from selftest libraries
Date: Wed, 20 May 2026 07:55:31 -0700 [thread overview]
Message-ID: <ag3LYxmbqD3EWfrJ@google.com> (raw)
In-Reply-To: <CAEvNRgEpy+d=KTSVcO9svAS9asHCDcwctGo=9PAaFVMUCd-Wrw@mail.gmail.com>
On Tue, May 19, 2026, Ackerley Tng wrote:
> Sean Christopherson <seanjc@google.com> writes:
>
> > On Tue, Apr 14, 2026, Ackerley Tng wrote:
> >> Sean suggested using setjmp and longjmp [1] to back to the top level
> >> TEST_F(). I looked at [1] and found myself wishing to use TEST_F() the from
> >> kselftest harness directly.
> >
> > Can you elaborate? If you have a need for direct TEST_F() in KVM selftests, odds
> > are good someone/something else will have a similar need, sooner or later.
> >
>
> I guess I like the consistency of working with TEST_F(), there's also
> TEST_F_TIMEOUT() and friends and all the usefulness of the rest of the
> kselftest_harness as you described, all of which will probably need
> re-wrapping if we proceed with the approach of wrapping.
FWIW, utilizing the TIMEOUT functionality could get tricky. KVM tests often have
highly variable runtimes based on the underlying environment. E.g. as an extreme
case, see the never ending game of whack-a-mole we've been playing with flavors
of KVM-Unit-Tests' access test[*].
I can definitely see it being useful, e.g. for tests where we *know* the runtime
is O(ms), just want to call out that this is yet another case where KVM tests tend
to have more annoying requirements than other selftests.
[*] https://lore.kernel.org/all/20260317225327.4068448-1-yosry@kernel.org
> >> Another option would be to expose the current teardown function pointer
> >> globally instead of the pointer to the entire metadata struct.
> >
> > I'm strongly opposed to any idea effectively requires special casing KVM selftests
> > in the common harness. In my experience, the common harness is already quite
> > brittle, in large part because there is no singular maintainer(s) that is responsible
> > for ensuring changes work for all downstream users. Adding odd bits of code that
> > is only ever used by a handful of KVM selftests is only going to increase the
> > probability that that code is broken.
>
> If Kees likes the idea of exposing a pointer to the metadata globally,
> does that make KVM selftests less "special"?
Yes. I don't particuarly care about the code, I just don't want to be in a
situation where KVM is doing something "weird" relative to the rest of the world.
> If the community likes the global metadata pointer, I could update the
> harness to adopt the global metadata pointer and then KVM wouldn't be
> special at all.
next prev parent reply other threads:[~2026-05-20 14:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 18:07 [PATCH RFC 0/4] selftests: harness: Provide global metadata pointer to allow clean teardown from selftest libraries Ackerley Tng
2026-04-14 18:07 ` [PATCH RFC 1/4] selftests: harness: Move metadata structs to separate header file Ackerley Tng
2026-04-14 18:07 ` [PATCH RFC 2/4] selftests: harness: Set global current_test_metadata for each test run Ackerley Tng
2026-04-14 18:07 ` [PATCH RFC 3/4] KVM: selftests: Do teardown from kselftest harness if kselftest_harness is used Ackerley Tng
2026-04-14 18:07 ` [PATCH RFC 4/4] HACK: Show that the teardown function is called from KVM selftests Ackerley Tng
2026-05-12 20:24 ` [PATCH RFC 0/4] selftests: harness: Provide global metadata pointer to allow clean teardown from selftest libraries Sean Christopherson
2026-05-19 20:18 ` Ackerley Tng
2026-05-20 14:55 ` Sean Christopherson [this message]
2026-05-20 19:05 ` Ackerley Tng
2026-05-13 1:01 ` Kees Cook
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=ag3LYxmbqD3EWfrJ@google.com \
--to=seanjc@google.com \
--cc=ackerleytng@google.com \
--cc=kees@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=luto@amacapital.net \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
--cc=thomas.weissschuh@linutronix.de \
--cc=wad@chromium.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