From nobody Thu Apr 9 08:51:36 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 871DB44CAFB; Tue, 10 Mar 2026 09:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773136289; cv=none; b=H50yvXpMURz4JM1MzokUvRlJgkwsyUoThwqxY3VQamcQWd6KtAyXzU+k3vjk//JGjDdglUn0/ajGAwT1iPDwIccgW/tNhuioAVXIl6B5VgFNnGxXBITkNmSbRDyZBclhSpNBrv04W+CKzMwyNrKhf3a6wypi9j6O0S94bGGVXyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773136289; c=relaxed/simple; bh=A1+SSntr+mFQaWTxBtXe/P5gD3m7qbnkkaEGIIkrTvQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bZjdxd4X8t61NaO70TPTaFo03KDNNsaqf6I1L1DdjrgIQGjADNj2ncqaV7525FXZH/V6cF2e2HtWMLfOVnM4mw1+1KB+NaYl2uPHHOGwgaGMk/5SP9XwMtGyICYdWTWESOR7NU978g7N3fLNy9pFgM1Rv+Bl0PF/J12PHKJ/+NU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=sMzY4G5i; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="sMzY4G5i" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62A87eRb1651541; Tue, 10 Mar 2026 09:51:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=QGi1qF8PiOKDYjAiP GpA3ncjmf9jwUTDw9NnQ+rBsyQ=; b=sMzY4G5iyi+sGubv9NKWyKBvm8brljeKp Ha9S2d3pXst/fNP4ahAd4IqrMJ+bgzSqg3ynV2SQDUyBaHMUcp7A2XOGWhtvEaN3 X4v0/NwRkmVQyeevTIybm8gNkEFmIQzLPi4wzwTzPeqAONqVxj1khOmvlMe+8v+q udpHZ2xT6jWFNSg4ZUMD09NmYnQ3qzNpH/vQnFp9gtzAu/HFlQZGrFDQcN6z+VKK LUSAygctFY5ITAfllyfYkC8ZE7CpUIoIh1LsWTQcaDjur4ZZJFN/p9Fr76ZSm8dz l5bC7EKpQxbmPewGnwycroVsHoG9TG4Mqqf9U4da8UP1x8y2wNpmw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4crcun9yg9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Mar 2026 09:51:04 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 62A6FAnD023022; Tue, 10 Mar 2026 09:51:03 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ct8ng1gja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Mar 2026 09:51:03 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 62A9p1Ot52035974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Mar 2026 09:51:01 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7833D2004E; Tue, 10 Mar 2026 09:51:01 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 590EA20043; Tue, 10 Mar 2026 09:50:58 +0000 (GMT) Received: from li-3f69264c-2ce6-11b2-a85c-c3f414d24014.in.ibm.com (unknown [9.109.243.201]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 10 Mar 2026 09:50:58 +0000 (GMT) From: Sayali Patil To: Andrew Morton , Shuah Khan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Ritesh Harjani Cc: David Hildenbrand , Zi Yan , Michal Hocko , Oscar Salvador , Lorenzo Stoakes , Dev Jain , Muhammad Usama Anjum , Liam.Howlett@oracle.com, Sayali Patil Subject: [PATCH 09/13] selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported Date: Tue, 10 Mar 2026 15:19:27 +0530 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: SWxD8bpKaqy-0dfV_GENQ8P_aUbhnGDw X-Authority-Analysis: v=2.4 cv=Hp172kTS c=1 sm=1 tr=0 ts=69afe988 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=smpEqqgnm6pLQfsEXf8A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzEwMDA4MSBTYWx0ZWRfXx8Ggp5UJeC3z bgAh9pD69SkCLo8vgYvemGu1LTiQSgaa/rSo8xXVb2EstW+bSjSzyfYlB/1qzU61owb+pqRP2NW 9Nf5R4POWnv52IeANqEcmIl/6NexdPheiiqJEjSIqYTiTPNXfZSMf+WZD1ZzzcjdWdG0GjxDBXi QUmu8AukMRncSuB5NzBCkI3rmVN5qhtuSsO88kDdxemyKPA5HDEYLARN3Wj3TKC7xpUaIMxIC8e 7t4MZoleXLLeRgnvnpFaLX/cMJ6dOsSOWKWzfm6NEUYKoxNMmZ6zKOXG5QQ6wEI1PHFrDCIozl0 eR0cDgWsz3Iqs4/wZcUUwFIcJ/KkuQ0WlYCl8MxKMB/t4SALkJq9KbUoiDLiV0mBj6nZIier+hr suwscYiNuQ4bJG/y+xCq9nnmZweNXtCy4IXbkzYz0mVOYXMpkRbqKemPXx0Zfgy8sdIjJGPVptV /U/tvLIfXTjJZiV4G/g== X-Proofpoint-ORIG-GUID: K3yND6Lm82jlVHKWL0E0jpjFajuQexdH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-10_01,2026-03-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 malwarescore=0 impostorscore=0 suspectscore=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603100081 Content-Type: text/plain; charset="utf-8" The uffd-wp-mremap test requires the UFFD_FEATURE_PAGEFAULT_FLAG_WP capability. On systems where userfaultfd write-protect is not supported, uffd_register() fails and the test reports failures. Check for the required feature at startup and skip the test when the UFFD_FEATURE_PAGEFAULT_FLAG_WP capability is not present, preventing false failures on unsupported configurations. Before patch: running ./uffd-wp-mremap ------------------------ [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 1..24 [RUN] test_one_folio(size=3D65536, private=3Dfalse, swapout=3Dfalse, hugetlb=3Dfalse) not ok 1 uffd_register() failed [RUN] test_one_folio(size=3D65536, private=3Dtrue, swapout=3Dfalse, hugetlb=3Dfalse) not ok 2 uffd_register() failed [RUN] test_one_folio(size=3D65536, private=3Dfalse, swapout=3Dtrue, hugetlb=3Dfalse) not ok 3 uffd_register() failed [RUN] test_one_folio(size=3D65536, private=3Dtrue, swapout=3Dtrue, hugetlb=3Dfalse) not ok 4 uffd_register() failed [RUN] test_one_folio(size=3D262144, private=3Dfalse, swapout=3Dfalse, hugetlb=3Dfalse) not ok 5 uffd_register() failed [RUN] test_one_folio(size=3D524288, private=3Dfalse, swapout=3Dfalse, hugetlb=3Dfalse) not ok 6 uffd_register() failed . . . Bail out! 24 out of 24 tests failed Totals: pass:0 fail:24 xfail:0 xpass:0 skip:0 error:0 [FAIL] not ok 1 uffd-wp-mremap # exit=3D1 After patch: running ./uffd-wp-mremap ------------------------ 1..0 # SKIP uffd-wp feature not supported [SKIP] ok 1 uffd-wp-mremap # SKIP Signed-off-by: Sayali Patil Acked-by: Zi Yan --- tools/testing/selftests/mm/uffd-wp-mremap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/testing/selftests/mm/uffd-wp-mremap.c b/tools/testing/se= lftests/mm/uffd-wp-mremap.c index 17186d4a4147..73d53a4da389 100644 --- a/tools/testing/selftests/mm/uffd-wp-mremap.c +++ b/tools/testing/selftests/mm/uffd-wp-mremap.c @@ -19,6 +19,17 @@ static size_t thpsizes[20]; static int nr_hugetlbsizes; static size_t hugetlbsizes[10]; =20 +static void uffd_wp_feature_supported(void) +{ + uint64_t features; + + if (uffd_get_features(&features) && errno =3D=3D ENOENT) + ksft_exit_skip("failed to get available features (%d)\n", errno); + + if (!(features & UFFD_FEATURE_PAGEFAULT_FLAG_WP)) + ksft_exit_skip("uffd-wp feature not supported\n"); +} + static int detect_thp_sizes(size_t sizes[], int max) { int count =3D 0; @@ -336,6 +347,8 @@ int main(int argc, char **argv) struct thp_settings settings; int i, j, plan =3D 0; =20 + uffd_wp_feature_supported(); + pagesize =3D getpagesize(); nr_thpsizes =3D detect_thp_sizes(thpsizes, ARRAY_SIZE(thpsizes)); nr_hugetlbsizes =3D detect_hugetlb_page_sizes(hugetlbsizes, --=20 2.52.0