On 16.05.25 15:09, Mark Brown wrote:
On Fri, May 16, 2025 at 02:55:24PM +0200, David Hildenbrand wrote:
On 16.05.25 14:29, Mark Brown wrote:
On Fri, May 16, 2025 at 10:02:16AM +0200, David Hildenbrand wrote:
reason), what exactly is the problem with that?
We run tests. If all pass, we're happy, if one fails, we investigate.
None of the tooling is able to either distinguish between the multiple tests that are being run in gup_longterm, nor compare the results of multiple runs effectively. If all the tests run they report themselves
Okay, so this is purely to make tooling happy. Humans are smart enough to figure it out.
Not just the tools, humans interact with the selftests and their results via tools (unless I'm actively working on something and running the specific test for that thing I'm unlikely to ever directly look at results...).
Yes, that makes sense.
What mechanism do we have in place to reliably prevent that from happening? And is this at least documented somewhere ("unique identifier for a test")>
It comes from TAP, I can't see a direct reference to anything in the kernel documentation. The main thing enforcing this is people running tooling noticing bad output, unfortunately.
:(
I guess when using kselftest_harness, we get a single identifier per tests (and much less output) just automatically.
Nothing stops something using the harness from logging during the test, the harness tests actually tend to be a little chattier than a lot of the things written directly to kselftest.h as they log the start and end of tests as well as the actual TAP result line as standard.
If a selftest is reporting multiple tests it should report them with names that are stable and unique.
I'm afraid we have other such tests that report duplicate conditions. cow.c is likely another candidate (written by me ;) ).
That one's not come up for me (this was one of four different patches for mm selftests I sent the other day cleaning up duplicate test names).
$ sudo ./cow TAP version 13 # [INFO] detected PMD size: 2048 KiB # [INFO] detected THP size: 16 KiB # [INFO] detected THP size: 32 KiB # [INFO] detected THP size: 64 KiB # [INFO] detected THP size: 128 KiB # [INFO] detected THP size: 256 KiB # [INFO] detected THP size: 512 KiB # [INFO] detected THP size: 1024 KiB # [INFO] detected THP size: 2048 KiB # [INFO] detected hugetlb page size: 2048 KiB # [INFO] detected hugetlb page size: 1048576 KiB # [INFO] huge zeropage is enabled 1..778 # [INFO] Anonymous memory tests in private mappings # [RUN] Basic COW after fork() ... with base page ok 1 No leak from parent into child # [RUN] Basic COW after fork() ... with swapped out base page ok 2 No leak from parent into child # [RUN] Basic COW after fork() ... with PTE-mapped THP (16 kB) ok 3 No leak from parent into child # [RUN] Basic COW after fork() ... with swapped-out, PTE-mapped THP (16 kB) ok 4 No leak from parent into child # [RUN] Basic COW after fork() ... with single PTE of THP (16 kB) ok 5 No leak from parent into child # [RUN] Basic COW after fork() ... with single PTE of swapped-out THP (16 kB) ok 6 No leak from parent into child # [RUN] Basic COW after fork() ... with partially mremap()'ed THP (16 kB) ok 7 No leak from parent into child # [RUN] Basic COW after fork() ... with partially shared THP (16 kB) ok 8 No leak from parent into child # [RUN] Basic COW after fork() ... with PTE-mapped THP (32 kB) ok 9 No leak from parent into child # [RUN] Basic COW after fork() ... with swapped-out, PTE-mapped THP (32 kB) ok 10 No leak from parent into child # [RUN] Basic COW after fork() ... with single PTE of THP (32 kB) ok 11 No leak from parent into child # [RUN] Basic COW after fork() ... with single PTE of swapped-out THP (32 kB) ok 12 No leak from parent into child # [RUN] Basic COW after fork() ... with partially mremap()'ed THP (32 kB) ok 13 No leak from parent into child # [RUN] Basic COW after fork() ... with partially shared THP (32 kB) ok 14 No leak from parent into child # [RUN] Basic COW after fork() ... with PTE-mapped THP (64 kB) ok 15 No leak from parent into child # [RUN] Basic COW after fork() ... with swapped-out, PTE-mapped THP (64 kB) ok 16 No leak from parent into child # [RUN] Basic COW after fork() ... with single PTE of THP (64 kB) ok 17 No leak from parent into child # [RUN] Basic COW after fork() ... with single PTE of swapped-out THP (64 kB) ok 18 No leak from parent into child # [RUN] Basic COW after fork() ... with partially mremap()'ed THP (64 kB) ok 19 No leak from parent into child ...
Aren't the duplicate "No leak from parent into child" the problematic bits? But maybe I am getting it wrong, what needs to be "unique" :)
Probably, the affected tests should be converted to use kselftest_harness, where we just report the result for a single tests, and not the individual assertions.
That would reduce the output of these tests drastically as well.
So that is likely the way to clean this up properly and make tooling happy?
That'd certainly work, though doing that is more surgery on the test than I personally have the time/enthusiasm for right now.
Same over here.
But probably if we touch it, we should just clean it up right away. Well, if we decide that that is the right cleanup. (you mention something like that in your patch description :) )