From: Dev Jain <dev.jain@arm.com>
To: Brendan Jackman <jackmanb@google.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Muhammad Usama Anjum <usama.anjum@collabora.com>
Subject: Re: [PATCH v3 03/10] selftests/mm: Skip uffd-wp-mremap if userfaultfd not available
Date: Mon, 3 Mar 2025 16:30:45 +0530 [thread overview]
Message-ID: <ca8d7011-5f5a-4270-af8e-44b37aff2bb4@arm.com> (raw)
In-Reply-To: <Z8WJEsEAwUPeMkqy@google.com>
+ Muhammad, I guess he has been working on selftests, maybe he can chime in.
On 03/03/25 4:18 pm, Brendan Jackman wrote:
> On Fri, Feb 28, 2025 at 10:55:00PM +0530, Dev Jain wrote:
>>
>>
>> On 28/02/25 10:24 pm, Brendan Jackman wrote:
>>> It's obvious that this should fail in that case, but still, save the
>>> reader the effort of figuring out that they've run into this by just
>>> SKIPping
>>>
>>> Signed-off-by: Brendan Jackman <jackmanb@google.com>
>>> ---
>>> tools/testing/selftests/mm/uffd-wp-mremap.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/mm/uffd-wp-mremap.c b/tools/testing/selftests/mm/uffd-wp-mremap.c
>>> index 2c4f984bd73caa17e12b9f4a5bb71e7fdf5d8554..c2ba7d46c7b4581a3c32a6b6acd148e3e89c2172 100644
>>> --- a/tools/testing/selftests/mm/uffd-wp-mremap.c
>>> +++ b/tools/testing/selftests/mm/uffd-wp-mremap.c
>>> @@ -182,7 +182,10 @@ static void test_one_folio(size_t size, bool private, bool swapout, bool hugetlb
>>> /* Register range for uffd-wp. */
>>> if (userfaultfd_open(&features)) {
>>> - ksft_test_result_fail("userfaultfd_open() failed\n");
>>> + if (errno == ENOENT)
>>> + ksft_test_result_skip("userfaultfd not available\n");
>>> + else
>>> + ksft_test_result_fail("userfaultfd_open() failed\n");
>>> goto out;
>>> }
>>> if (uffd_register(uffd, mem, size, false, true, false)) {
>>>
>>
>> I think you are correct, just want to confirm whether "uffd not available"
>> if and only if "errno == ENOENT" is true. That is,
>> is it possible that errno can be something else and uffd is still not
>> available,
>
> Yeah, I strongly suspect this can happen. This is an attempt to
> improve things but I don't think it's a full solution.
>
> I've been pondering this a bit and I think it's impractical to solve
> problems like this in the code of individual testst. I think the right
> thing to do is either:
>
> 1. Have a centralised facility for detecting conditions like
> "userfaultfd not available" that tests can just query it, so they
> say something like:
>
> ksft_test_requires("userfaultfd");
Agreed, there should be a single point of reporting whether the facility
is available.
>
> Which would do some sort of actual principled check for presence
> and then skip the test with an informative message when it's not
> there. There would be a list of these "system requirements" in the
> code so you can easily see in one place what things might be needed
> to successfully run all the tests.
>
> or
>
> 2. Specify out of band that there's a fixed set of requirements for
> running the tests and document that you shouldn't run them without
> satisfying them. Then just don't bother with SKIPs and call it user
> error.
>
> This would require some reasonably usable tooling for actually
> getting a system that satisfies the requirements.
>
> But both of them require a deeper investment. I would quite like to
> explore option 1 a bit but that's for a future Brendan.
>
> In the meantime I'm just trying to get these tests running on
> virtme-ng. (I'm not even gonna add all of them, because e.g. once I
> noticed this one I added a `scripts/config -e USERFAULTFD` to my
> script, so I won't notice if anything else is missing the check).
>
>> or errno can be ENOENT even if uffd is available.
>
> I think it's probably posible for this to happen too, e.g. if the
> system has a perverted /dev or something. But again I think that can
> only be solved with the kinda stuff I mentioned above.
>
> Sorry for the essay :D
next prev parent reply other threads:[~2025-03-03 11:00 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 16:54 [PATCH v3 00/10] selftests/mm: Some cleanups from trying to run them Brendan Jackman
2025-02-28 16:54 ` [PATCH v3 01/10] selftests/mm: Report errno when things fail in gup_longterm Brendan Jackman
2025-02-28 17:17 ` Dev Jain
2025-03-06 9:34 ` David Hildenbrand
2025-02-28 16:54 ` [PATCH v3 02/10] selftests/mm: Skip uffd-stress if userfaultfd not available Brendan Jackman
2025-02-28 17:20 ` Dev Jain
2025-02-28 16:54 ` [PATCH v3 03/10] selftests/mm: Skip uffd-wp-mremap " Brendan Jackman
2025-02-28 17:25 ` Dev Jain
2025-03-03 10:48 ` Brendan Jackman
2025-03-03 11:00 ` Dev Jain [this message]
2025-02-28 16:54 ` [PATCH v3 04/10] selftests/mm/uffd: Rename nr_cpus -> nr_threads Brendan Jackman
2025-02-28 17:36 ` Dev Jain
2025-03-03 9:47 ` Brendan Jackman
2025-03-03 10:18 ` Dev Jain
2025-03-03 10:34 ` Brendan Jackman
2025-03-03 10:46 ` Dev Jain
2025-02-28 16:54 ` [PATCH v3 05/10] selftests/mm: Print some details when uffd-stress gets bad params Brendan Jackman
2025-02-28 17:26 ` Dev Jain
2025-02-28 16:54 ` [PATCH v3 06/10] selftests/mm: Don't fail uffd-stress if too many CPUs Brendan Jackman
2025-02-28 17:37 ` Dev Jain
2025-03-05 11:07 ` Brendan Jackman
2025-02-28 16:54 ` [PATCH v3 07/10] selftests/mm: Skip map_populate on weird filesystems Brendan Jackman
2025-02-28 16:54 ` [PATCH v3 08/10] selftests/mm: Skip gup_longerm tests " Brendan Jackman
2025-03-06 9:28 ` David Hildenbrand
2025-03-06 12:42 ` Brendan Jackman
2025-03-06 14:40 ` David Hildenbrand
2025-03-11 13:00 ` Brendan Jackman
2025-03-11 19:53 ` David Hildenbrand
2025-03-12 8:34 ` Brendan Jackman
2025-03-14 12:10 ` David Hildenbrand
2025-03-14 12:17 ` David Hildenbrand
2025-03-14 15:56 ` Brendan Jackman
2025-03-14 21:19 ` David Hildenbrand
2025-02-28 16:54 ` [PATCH v3 09/10] selftests/mm: Drop unnecessary sudo usage Brendan Jackman
2025-02-28 17:26 ` Dev Jain
2025-02-28 16:54 ` [PATCH v3 10/10] selftests/mm: Ensure uffd-wp-mremap gets pages of each size Brendan Jackman
2025-03-05 8:25 ` [PATCH v3 00/10] selftests/mm: Some cleanups from trying to run them Muhammad Usama Anjum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca8d7011-5f5a-4270-af8e-44b37aff2bb4@arm.com \
--to=dev.jain@arm.com \
--cc=akpm@linux-foundation.org \
--cc=jackmanb@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=shuah@kernel.org \
--cc=usama.anjum@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox