From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B5C2C282C5 for ; Mon, 3 Mar 2025 11:00:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A40B280004; Mon, 3 Mar 2025 06:00:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9547B280003; Mon, 3 Mar 2025 06:00:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81AA5280004; Mon, 3 Mar 2025 06:00:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 46AF0280003 for ; Mon, 3 Mar 2025 06:00:55 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 98B01C06CF for ; Mon, 3 Mar 2025 11:00:54 +0000 (UTC) X-FDA: 83179947228.21.C486959 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf09.hostedemail.com (Postfix) with ESMTP id BA33D140014 for ; Mon, 3 Mar 2025 11:00:52 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf09.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740999653; a=rsa-sha256; cv=none; b=kdLq4xQywvB7cPhPYKhNRwRMWBJs4Dfjy+s46/hR4yA64mt9cRPZmNS2gFWyprUTaMBPoU k6nmDn06XhascFRwE4eyKWb/UtSPno9rJ8EHo9kpqgSkgTl4nKF6zJvsHNqlmmvyOW2wjX J3f6HKSQSnMzfhKme2dA1o2yeH9zHkw= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf09.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740999653; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d5o+8UjgvMKqBvxF60VI3NqE2wQzLEZdCdb68Fk8UXU=; b=B5bs8EfShWdGxr4a0DKTC3VzoSWuY5Ra41afyq8AiOao7zdSq5wqB++5mRvrKT8DtXE4Gh iAkvq0dQsDjfgU3z1/S3OzPMplFn7q0+zD70CTBmubADoJ6NnhYu7y0ZervhRoch+kD9kK Z32CbDzRp9SRoaZYsSJxsoLnv7K9NlQ= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 23097113E; Mon, 3 Mar 2025 03:01:06 -0800 (PST) Received: from [10.163.38.109] (unknown [10.163.38.109]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C3AA3F673; Mon, 3 Mar 2025 03:00:48 -0800 (PST) Message-ID: Date: Mon, 3 Mar 2025 16:30:45 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 03/10] selftests/mm: Skip uffd-wp-mremap if userfaultfd not available To: Brendan Jackman Cc: Lorenzo Stoakes , Andrew Morton , Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Muhammad Usama Anjum References: <20250228-mm-selftests-v3-0-958e3b6f0203@google.com> <20250228-mm-selftests-v3-3-958e3b6f0203@google.com> <99739a23-9843-4c96-a614-ce2d48431a5c@arm.com> Content-Language: en-US From: Dev Jain In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: BA33D140014 X-Stat-Signature: 1s5reopeg549fatow1zntapmephhg1te X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1740999652-836209 X-HE-Meta: U2FsdGVkX196shO1fNsHRfurc0br4QwaZZd6EBBsXd+78IApGisjwHG5Mee7B8xjY0S7fmukGiOP9OzBEffenkyGKatfpKwC7CH1ofpe5o9tGilO1xhCCmQ9yep1/VlXqLUVn+KFeos0pa30fF3KQNuCZj/mWt42qwrZnHtB3adkb2ItJ/H3s5TTLfF5QbvHOVRtZkEiQNTvkv/PIBppApCAuBs16UsWqr2N8KtbXAX+DmumghiTTziXbmIz9THvoii0jGkUZk3jMmM1vfMoOeHQyDtU/7R8KpbIPUVs2EgQbXN0HGdZMjgguKIfQMDp+RikNTy/O+b6bPO21UDKnXGpZrOkvo5m0YYiNnlQuX63SXFF+D/eq/1J5/Bbjq7SZDJG3ePprvMRdih16mOv52XmeOa62Hc7s+8xkJGQF1KugD0IzASbfSa3/6ztAilxcUAyxWMjibgTehlRnqNW54T7k1mtXggzL5XvM+7N+5Yn/R4AIc8FLxiIDb1N9Jm3f5NOlLqPcFgtgibzXJz6ONZX14q39YyCNRDjmrQzkUVHjX0WH6tzMfPBBUWJtj+ju52pWAcQJBgUgCM9VfWtTq4sdhFk52kuhFpUlLOeuFEpsxRX1bva+mphpm0+ePIAA25hdlFifBV40cyPLKAohAQI/uWdjYozkld5AxdTF9ECXrL6h42PWR0W5Num9kjgg3dgtp4cjxwc/uZm5xBmL66t6KAZjU7H7rjYZNGkr727DDEwCAQ7UMn+bgCAUkGE1bBf5FTF0wXrtZ3mQHoMGTRikZmbCe9Jrxv48o/wWRkOHXlt3rbwyxSUiAzvYsHF9Ro7aU0p51lqiNNzvU3i2imei5p/TaNXs/4g1BR/sE2kL21IN5n9k37ouZp41VUGFiq82N2c+zOTMNslrDIJjaL4lYQRza+VJslrZ8KIfj+i2QMhsUhYopE44AMFhIQuxGPuwdThQ4zexFLJPL7 LL5UWrvn EngTzZ+W1Q9RhYvD52+QkIYhCmDX5EmVGAEazMkrQd6352tIFHomZriUhXDaMiJHN3vQflwVBN7yDfNRFFT4saLLtS6v2UV9prLFCX+2qIYtafl08Ns2GQnMmgNa7/RwPtqTd0YgEM7C3qXGILGgqImR/2hWZILPdAjj2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.187262, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: + 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 >>> --- >>> 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