Re: [PATCH v6 5/5] selftests/mm: add UFFDIO_MOVE ioctl test

From: David Hildenbrand
Date: Tue Dec 12 2023 - 10:27:28 EST


On 11.12.23 21:11, John Hubbard wrote:
On 12/11/23 12:01, Mark Brown wrote:
On Mon, Dec 11, 2023 at 07:00:32PM +0100, David Hildenbrand wrote:
On 11.12.23 18:32, Mark Brown wrote:
On Mon, Dec 11, 2023 at 05:53:59PM +0100, David Hildenbrand wrote:

https://lkml.kernel.org/r/20231209020144.244759-1-jhubbard@xxxxxxxxxx

I mean, I guess people who don't want to install the headers are just
not going to be able to build a bunch of tests? There definitely are a
bunch of tests where it's not needed so I can see why people would not
like being forced to do the headers step if they're only interested in
those tests.

Yes. And before that, people mostly had no clue that headers had to be
installed in order to compile successfully.

So maybe a warning to give at least some hint might be reasonable.

That sounds sensible, especially if we could arrange to flag when the
specific tests being built need it.


But the end result is messy: not everything builds in some cases. If
instead we went back to the little ifdef snippets, such as this (from
v5.1):

hugepage-shm.c:

#ifndef SHM_HUGETLB
#define SHM_HUGETLB 04000
#endif

...then with a bit of one-time, manual effort, we could get everything
to work at all times. And that seems better, doesn't it?

I'm not a fan of fixing up host headers on a case-per-case basis using ifdefs. It makes the tests harder to read, write and maintain.

We do have the proper headers in the tree, just not in an consumable way for the tests.

Ideally, we'd either carry our own "consumable" version in the tree, or are able to convert the headers under the hood and place them in a directory where we won't have to dirty the tree -- and only tests that need these headers (e.g., mm selftests) will perform that conversion and include them.

I usually build my stuff in-tree, so I don't really have a lot of experience with out-of-tree selftest builds and the whole kernel header inclusion (and how we could avoid the "make headers" and place the headers somewhere else).

--
Cheers,

David / dhildenb