Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

Christian Brauner
2025-05-05T13:35:18Z

On Thu, May 01, 2025 at 02:46:46PM +0200, Peter Zijlstra wrote:
> On Thu, May 01, 2025 at 01:42:35PM +0200, Peter Zijlstra wrote:
> > On Wed, Oct 16, 2024 at 07:14:34PM -0700, John Hubbard wrote:
> > > On 10/16/24 3:06 PM, Lorenzo Stoakes wrote:
> > > > On Wed, Oct 16, 2024 at 02:00:27PM -0600, Shuah Khan wrote:
> > > > > On 10/16/24 04:20, Lorenzo Stoakes wrote:
> > > ...
> > > > > > diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h
> > > > > > index 88d6830ee004..1640b711889b 100644
> > > > > > --- a/tools/testing/selftests/pidfd/pidfd.h
> > > > > > +++ b/tools/testing/selftests/pidfd/pidfd.h
> > > > > > @@ -50,6 +50,14 @@
> > > > > > #define PIDFD_NONBLOCK O_NONBLOCK
> > > > > > #endif
> > > > > > +/* System header file may not have this available. */
> > > > > > +#ifndef PIDFD_SELF_THREAD
> > > > > > +#define PIDFD_SELF_THREAD -100
> > > > > > +#endif
> > > > > > +#ifndef PIDFD_SELF_THREAD_GROUP
> > > > > > +#define PIDFD_SELF_THREAD_GROUP -200
> > > > > > +#endif
> > > > > > +
> > > > >
> > > > > As mentioned in my response to v1 patch:
> > > > >
> > > > > kselftest has dependency on "make headers" and tests include
> > > > > headers from linux/ directory
> > > >
> > > > Right but that assumes you install the kernel headers on the build system,
> > > > which is quite a painful thing to have to do when you are quickly iterating
> > > > on a qemu setup.
> > > >
> > > > This is a use case I use all the time so not at all theoretical.
> > > >
> > >
> > > This is turning out to be a fairly typical reaction from kernel
> > > developers, when presented with the "you must first run make headers"
> > > requirement for kselftests.
> > >
> > > Peter Zijlstra's "NAK NAK NAK" response [1] last year was the most
> > > colorful, so I'll helpfully cite it here. :)
> >
> > Let me re-try this.
> >
> > This is driving me insane. I've spend the past _TWO_ days trying to
> > build KVM selftests and I'm still failing.
> >
> > This is absolute atrocious crap and is costing me valuable time.
> >
> > Please fix this fucking selftests shit to just build. This is unusable
> > garbage.
>
> So after spending more time trying to remember how to debug Makefiles (I
> hate my life), I found that not only do I need this headers shit, the
> kvm selftests Makefile is actively broken if you use: make O=foo
>
> -INSTALL_HDR_PATH = $(top_srcdir)/usr
> +INSTALL_HDR_PATH = $(top_srcdir)/$(O)/usr
>
>
> And then finally, I can do:
>
> make O=foo headers_install
> make O=foo -C tools/testing/selftests/kvm/
>
> So yeah, thank you very much for wasting my time *AGAIN*.
>
>
> Seriously, I want to be able to do:
>
> cd tools/testing/selftests/foo; make
>
> and have it just work. I would strongly suggest every subsystem to
> reclaim their selftests and make it so again.
>
> And on that, let me go merge the fixes I need to have x86 and futex
> build without this headers shit.

I'm completely lost as to what's happening here or whether the test here
is somehow at fault for something.

The pidfd.h head explicitly has no dependency on the pidfd uapi header
itself and I will NAK anything that makes it so. It's just a giant pain.