mbox series

[0/2] Fix selftests/mm build without requiring "make headers"

Message ID 20240328033418.203790-1-jhubbard@nvidia.com (mailing list archive)
Headers show
Series Fix selftests/mm build without requiring "make headers" | expand

Message

John Hubbard March 28, 2024, 3:34 a.m. UTC
Hi,

As mentioned in each patch, this implements the solution that we discussed in
December 2023, in [1]. This turned out to be very clean and easy. It should also
be quite easy to maintain.

This should also make Peter Zijlstra happy, because it directly addresses the
root cause of his "NAK NAK NAK" reply [2]. :)

I haven't done much build testing, because selftests are not so easy to build
with a cross-compiler. So it's just tested on x86 64-bit so far.

[1] https://lore.kernel.org/all/783a4178-1dec-4e30-989a-5174b8176b09@redhat.com/
[2] https://lore.kernel.org/lkml/20231103121652.GA6217@noisy.programming.kicks-ass.net/

Cc: David Hildenbrand <david@redhat.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>

John Hubbard (2):
  selftests: break the dependency upon local header files
  selftests/mm: fix additional build errors for selftests

 tools/include/uapi/linux/memfd.h       |  39 +++
 tools/include/uapi/linux/userfaultfd.h | 386 +++++++++++++++++++++++++
 tools/testing/selftests/lib.mk         |   9 +
 tools/testing/selftests/mm/Makefile    |   2 +-
 4 files changed, 435 insertions(+), 1 deletion(-)
 create mode 100644 tools/include/uapi/linux/memfd.h
 create mode 100644 tools/include/uapi/linux/userfaultfd.h


base-commit: 98560e9019851bf55b8a4073978a623a3bcf98c0

Comments

Muhammad Usama Anjum March 28, 2024, 9:02 a.m. UTC | #1
On 3/28/24 8:34 AM, John Hubbard wrote:
> Hi,
> 
> As mentioned in each patch, this implements the solution that we discussed in
> December 2023, in [1]. This turned out to be very clean and easy. It should also
> be quite easy to maintain.
There is another way. The headers should be built automatically by make
dependency. The topmost make file always builds headers before building
kselftest i.e., make kselftest

The tools/testing/selftests/Makefile and others Makefiles in test suites
should be updated to build the headers as well. This used to be the
behavior until there were un-resolvable bugs in the Makefiles and it was
reverted:
https://lore.kernel.org/all/cover.1657614127.git.guillaume.tucker@collabora.com/

We should come up with the revert of this series such that all the
different scenarios are covered instead of yet again a new solution;
resorting to the duplication of header files or any sort of duplication.

> 
> This should also make Peter Zijlstra happy, because it directly addresses the
> root cause of his "NAK NAK NAK" reply [2]. :)
> 
> I haven't done much build testing, because selftests are not so easy to build
> with a cross-compiler. So it's just tested on x86 64-bit so far.
> 
> [1] https://lore.kernel.org/all/783a4178-1dec-4e30-989a-5174b8176b09@redhat.com/
> [2] https://lore.kernel.org/lkml/20231103121652.GA6217@noisy.programming.kicks-ass.net/
> 
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>
> Cc: Suren Baghdasaryan <surenb@google.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> 
> John Hubbard (2):
>   selftests: break the dependency upon local header files
>   selftests/mm: fix additional build errors for selftests
> 
>  tools/include/uapi/linux/memfd.h       |  39 +++
>  tools/include/uapi/linux/userfaultfd.h | 386 +++++++++++++++++++++++++
>  tools/testing/selftests/lib.mk         |   9 +
>  tools/testing/selftests/mm/Makefile    |   2 +-
>  4 files changed, 435 insertions(+), 1 deletion(-)
>  create mode 100644 tools/include/uapi/linux/memfd.h
>  create mode 100644 tools/include/uapi/linux/userfaultfd.h
> 
> 
> base-commit: 98560e9019851bf55b8a4073978a623a3bcf98c0
John Hubbard March 28, 2024, 5:28 p.m. UTC | #2
On 3/28/24 2:02 AM, Muhammad Usama Anjum wrote:
> On 3/28/24 8:34 AM, John Hubbard wrote:
>> Hi,
>>
>> As mentioned in each patch, this implements the solution that we discussed in
>> December 2023, in [1]. This turned out to be very clean and easy. It should also
>> be quite easy to maintain.
> There is another way. The headers should be built automatically by make
> dependency. The topmost make file always builds headers before building
> kselftest i.e., make kselftest
> 

I think we talked through this already: Peter Z. pointed out the problems
with requiring this kind of prerequisite. And it really it overkill. The
approach here is simple, easy to maintain, and avoids breaking the various
unusual build setups that people have.

I'll shut up now and let others weigh in, though. :)


thanks,