Re: [PATCH v3 13/16] KVM: selftests: Verify vCPU migration during IRQ delivery
From: Sean Christopherson
Date: Thu May 28 2026 - 19:31:00 EST
On Thu, May 28, 2026, Josh Hilke wrote:
> On Tue, May 26, 2026 at 7:23 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> >
> > On Tue, Apr 21, 2026, Josh Hilke wrote:
> > > +static inline int gettid(void)
> >
> > gettid() already exists in at least some of my environments:
>
> Should we just use syscall(__NR_gettid) to avoid any compatibility
> issues? It's only used once in the test.
Hmm, maybe open code it in kvm_gettid()? And use it straightaway in
tools/testing/selftests/kvm/demand_paging_test.c.
I'm a-ok open coding the syscall() somewhere, but I don't want to end up in a
state where we're open coding it "everywhere".
Oh, nice, "This call is always successful.". All the more reason to open code
it as kvm_gettid(), as the kvm_ prefix communicates that the function guarantees
success (or fails the test), it just so happens that we don't need to do anything
to guarantee success. E.g.
static inline pid_t kvm_gettid(void)
{
/* Per kernel documentation, gettid "is always successful". */
return syscall(__NR_gettid);
}