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 90F4EC282C5 for ; Mon, 3 Mar 2025 10:49:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E05BB280003; Mon, 3 Mar 2025 05:48:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DB48B280001; Mon, 3 Mar 2025 05:48:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7C9F280003; Mon, 3 Mar 2025 05:48:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AA599280001 for ; Mon, 3 Mar 2025 05:48:59 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5C565806BA for ; Mon, 3 Mar 2025 10:48:59 +0000 (UTC) X-FDA: 83179917198.06.12FD81E Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by imf10.hostedemail.com (Postfix) with ESMTP id 6F55EC0012 for ; Mon, 3 Mar 2025 10:48:57 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=3LEAa01H; spf=pass (imf10.hostedemail.com: domain of jackmanb@google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=jackmanb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740998937; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=K+Ima0DPstNEgvXjJlluQ15dydqJt2/LyuMAnXcoK4Q=; b=Quj0YPPNui7Hq37QnL4J8yEntC7g4gQAjydHB+NShKD3AkLVJratbFmkSYd5JBuPkUpOCi XHx8zGFrPSW6R1cbmnrfrgiiFAoVxXV1clxKJZXh9KZCmSZWVBc52TP87DIQTXspF9vIlB uVCxaPZLzZ/Ub1AprvMlQVmOlAf8lsc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=3LEAa01H; spf=pass (imf10.hostedemail.com: domain of jackmanb@google.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=jackmanb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740998937; a=rsa-sha256; cv=none; b=Q1kexYWQRnNWdLMPoxiGkY26yxSnW+arTArQ5AkTnMepzGJ0EKQu5Y3IdK1RIvn5KjwrjK eE91Ozfk9gA7J1u7aHMsdANtC7ATJGB0rDta3I4D9A6qfXnWPS0dOhsJuuY8hXRcUfWbfX fi1KmNCmnL+0+7d9iPLP/E1iwHxlMFY= Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-438d9c391fcso80815e9.0 for ; Mon, 03 Mar 2025 02:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1740998936; x=1741603736; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=K+Ima0DPstNEgvXjJlluQ15dydqJt2/LyuMAnXcoK4Q=; b=3LEAa01HV1z+0fZGwEvK9rYG8JhpXSy1hHUxxi9xOupK7H+F7pVQy9aLUCIuaOuyUS LH4F2UtT2l0B/igJ+XT26YYy2oVw6xqBOhGg8vmU5rr9dJDTmXUp/OMuolH96uYZGTF9 DAdYhz2/rzvzQYI/64SOzOlSWRoNJLJXanWvXGkDoK822L9/aqs6WTeQBm8azvhFf54S Gsf0bPUVf0vfK7tkM50tBvYHvyXM/IJ8akdw60rY+AhhnS1S4i3b1puMvpisk4UGmz5Q rmi6C8AOCY/INzURyADVUjD0dCE2HrPaVPRJdkvR5zqYcQIU+yyRSa9w/7Xn0BHQfisM OAYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740998936; x=1741603736; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=K+Ima0DPstNEgvXjJlluQ15dydqJt2/LyuMAnXcoK4Q=; b=Fb1Hp+Zp52nQSl0WA/Yq0j0NHaCSYMd0ZA1Idd/w6rhi4AxSyxHa8sQCAmswSmQcZq iY7U9o27IbfC2crFi1qIYFVZmX6jd3n8jEjPMuy9XwFkl1CKLHJ++P+iO6AXJxGOvW4t AtjefDBriL6xy93zhEsa6OlTDoR/RGE6PSG2XvW+DHhxVlUQfMEnrevMtfBE5vRZ2UVj P8jxYXSb94KvnYva2Fq035i4+Y33+aQj2Tw1Se9b/2N/jsBQlDGp/nJYkSHhpyo/tN8C 6IjitYHboXQL4Tgxu5xaF9O+m65ZQf9LhFR71Ippsp5kE/+L2BCO35xwEZaSGS33XGao 4epw== X-Forwarded-Encrypted: i=1; AJvYcCV8vl3ZkVRKFICpYO0W2B8Te7wVjOf1EOkxn8SljTwaPk7abujzSbSgj+Gd0u5JAdat3UbliYEpEw==@kvack.org X-Gm-Message-State: AOJu0YxQ2z+hJTAvDTuduJNbLs+eSRS6KyIYtQrMvAcB7L4/dZTt+0hB J/VS6J8Sx5Bp2LATfbisblxWqpapvVoA+vHG2TOVkTD1m6S63+oKQaWNhNxCOWNnXJ082XR8gyk xrg== X-Gm-Gg: ASbGncvysqkHfgaNT200dRnE/VPyifrN7oH4043EAlSTDVpoOHk56rKMJd/g2xzao/0 VzRiYuUglb2/5IN7YcUytXGJE3xZhRF9eBPszIWvf8HH/vNaWEKQEZahtW547LFtY81Q9FxFipi 2DK7Rz3MCKleuQeivKeSU3YMRZYf4xS4KPB4THsMxp4clfn5hDsUu6rbQeaEFQru/jfDo/uh+oG U/mwoVcYs4AEmsokGfjESA6elLw0eJ8vcuHwcxKRSgSZOXnmFJf5MXKSRxDXWrVXsonAni/1icT ORx6nxvKP0Wp8FIZ0/SdkriqK1nyNLIJTeSCFiCHX06o1Q7N5URHzSJ2SSXVpnBOswRbYZM6qs6 RaIMs X-Google-Smtp-Source: AGHT+IHd8ZHKAZRkwCUv3CySl6Z5lqyKm8ohs6rgo4oSk5bfdq+8pAFaHNZHO3YC+e9UOzwjLKFEUA== X-Received: by 2002:a05:600c:3c90:b0:439:9434:1b66 with SMTP id 5b1f17b1804b1-43baff09304mr2313315e9.1.1740998935672; Mon, 03 Mar 2025 02:48:55 -0800 (PST) Received: from google.com (44.232.78.34.bc.googleusercontent.com. [34.78.232.44]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43b694524c6sm160673665e9.0.2025.03.03.02.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Mar 2025 02:48:54 -0800 (PST) Date: Mon, 3 Mar 2025 10:48:50 +0000 From: Brendan Jackman To: Dev Jain Cc: Lorenzo Stoakes , Andrew Morton , Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 03/10] selftests/mm: Skip uffd-wp-mremap if userfaultfd not available Message-ID: References: <20250228-mm-selftests-v3-0-958e3b6f0203@google.com> <20250228-mm-selftests-v3-3-958e3b6f0203@google.com> <99739a23-9843-4c96-a614-ce2d48431a5c@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <99739a23-9843-4c96-a614-ce2d48431a5c@arm.com> X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 6F55EC0012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8THfGLVc7lZ9kYxCr8tsnvxIKm7tXAX8810s/0bsZY0vdbqs/s7bJ8DQacPLpETOPEFmJ1F3MV73mxbfxvrHk2/9tNaPLUVGJ4VhI4I0e9gXiIC5fG63uTV8C75ruDA8VMIAmMYZutcT+HQ2jUTlrrYQ7Cvsh8qwtv9XqFYHOvBqz+9c0qtgpD9pvfdNpmeKURgSrAe9n9QbTebFCWJNTJ9MQ74MBHRc6qQr+SBKEzoG36IvmWWQMnx5g1mzWFWtt3rS90cldSL0JyBsm/jNuWlltXb5oVYpS8OaUv2HvKTWtxjKuu/jfBsvVrIDFcA14UtG15g3pA/qc86FWwDnOiMWO0+y5FB5dmVMwQuwJz41CDIcTq X-Bogosity: Unsure, tests=bogofilter, spamicity=0.487329, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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"); 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