From patchwork Wed Jun 26 13:05:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Audra Mitchell X-Patchwork-Id: 13712887 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 28AD8C30659 for ; Wed, 26 Jun 2024 13:05:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5F916B0089; Wed, 26 Jun 2024 09:05:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B11516B008A; Wed, 26 Jun 2024 09:05:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93D326B0093; Wed, 26 Jun 2024 09:05:38 -0400 (EDT) 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 744C86B0089 for ; Wed, 26 Jun 2024 09:05:38 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DD77A160FE8 for ; Wed, 26 Jun 2024 13:05:37 +0000 (UTC) X-FDA: 82273061514.05.5B46AED Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 170394001D for ; Wed, 26 Jun 2024 13:05:35 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KdBdKsND; spf=pass (imf11.hostedemail.com: domain of audra@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=audra@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719407120; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JykDiXdqlJ6ciyv4C7jHD9UAaumemJj0MYtCVwinG38=; b=iXiKzxWk4836SUOju8E7ZkQdvbSc9jENlOyuYNECnlZFbM8IAGmchQe0oWHRruSdNcruKc BpUlAYRfMjlyY39jiZXRcUWrslS98sc18BN7cG86k8u4PcNqlEQ2ags5sGIUS+SygY+R3I m1yvyjg+bGJmnwb7rD0vd92tmLN1XNU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719407120; a=rsa-sha256; cv=none; b=OXBEA4FDl9sJmlJIp9Le+qk2rAzgDnlEBpsGqC+l75tUchZp1//czIO0549PFLUSPX5zLj 3lkfuqAHtaeEr758s321SqoDeOJO9xaTF3PkGc3j8Y73tT+uiv4mdUPSuXQOOhJqnZFr0p TmXnQ108yEJQKAgGKZRJxlWbvxIESwU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KdBdKsND; spf=pass (imf11.hostedemail.com: domain of audra@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=audra@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719407135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JykDiXdqlJ6ciyv4C7jHD9UAaumemJj0MYtCVwinG38=; b=KdBdKsNDhj9uSs6MQ+Jg48EjDHpNfGGJFY1UniHziZGXLNT0Xob0dVbSeekbFVtr/JpyVS eQdFNNVy7wWwKIViNFa4B+DG49ntoGF8OZ8VjLLCdcya7xc7sthbxk6x+cBLhYfah/ozhB Hyt49QM6kpgUcpjsaouHNChnhn0PjwA= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-ITRtfxPeOlmGxIiufKwUFg-1; Wed, 26 Jun 2024 09:05:31 -0400 X-MC-Unique: ITRtfxPeOlmGxIiufKwUFg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 04A4E19560A7; Wed, 26 Jun 2024 13:05:28 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.34.168]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 117261956050; Wed, 26 Jun 2024 13:05:24 +0000 (UTC) From: Audra Mitchell To: viro@zeniv.linux.org.uk Cc: brauner@kernel.org, jack@suse.cz, aarcange@redhat.com, akpm@linux-foundation.org, rppt@linux.vnet.ibm.com, shli@fb.com, peterx@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, shuah@kernel.org, linux-kselftest@vger.kernel.org, raquini@redhat.com, linux-mm@kvack.org Subject: [PATCH v3 3/3] Turn off test_uffdio_wp if CONFIG_PTE_MARKER_UFFD_WP is not configured. Date: Wed, 26 Jun 2024 09:05:13 -0400 Message-ID: <20240626130513.120193-3-audra@redhat.com> In-Reply-To: <20240626130513.120193-1-audra@redhat.com> References: <20240626130513.120193-1-audra@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Stat-Sign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dE2YsENvy /8box8NH mJo2Sb9AvnuQFf5lvMkDSzmwDMtvM57fibXglGOlRXgyvp/+lMCtiOaTAZ8dUxbbOxeOzUQfI+8tnI31NlDZcvvo+yvV7YmyN/anl0RVicC7d2kB233rUYuV08sksxotthdtWzFq7XNaxaLM0RIaIhbmWR55Axc+NAC/10nNl9vl6h3ki80iwDx6lVzplM4zqPKeSUpxAsFDMp5BQm7nHxJQCxcGoHnFBFa60F8x+6icz9GS6GG9YKZQJ3f5Vt2zgi0jeTFVazGXgkcNJRVvhmvOGTZFFTMek7QFYBuwBRdmXUYoIXZLgrMKBTMcWUyAQu4iV+x9SwAILinmGkaAdGgsAag== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000338, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If CONFIG_PTE_MARKER_UFFD_WP is disabled, then we turn off three features in userfaultfd_api (UFFD_FEATURE_WP_HUGETLBFS_SHMEM, UFFD_FEATURE_WP_UNPOPULATED, and UFFD_FEATURE_WP_ASYNC). Currently this test always will call uffdio_regsiter with the flag UFFDIO_REGISTER_MODE_WP. However, the kernel ensures in vma_can_userfault that if the feature UFFD_FEATURE_WP_HUGETLBFS_SHMEM is disabled, only allow the VM_UFFD_WP on anonymous vmas, meaning our call to uffdio_regsiter will fail. We still want to be able to run the test even if we have CONFIG_PTE_MARKER_UFFD_WP disabled, so check to see if the feature UFFD_FEATURE_WP_HUGETLBFS_SHMEM has been turned off in the test and if so, disable us from calling uffdio_regsiter with the flag UFFDIO_REGISTER_MODE_WP. Signed-off-by: Audra Mitchell Reviewed-by: Peter Xu --- tools/testing/selftests/mm/uffd-stress.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c index b9b6d858eab8..3266ae885f75 100644 --- a/tools/testing/selftests/mm/uffd-stress.c +++ b/tools/testing/selftests/mm/uffd-stress.c @@ -419,6 +419,9 @@ static void parse_test_type_arg(const char *raw_type) test_uffdio_wp = test_uffdio_wp && (features & UFFD_FEATURE_PAGEFAULT_FLAG_WP); + if (test_type != TEST_ANON && !(features & UFFD_FEATURE_WP_HUGETLBFS_SHMEM)) + test_uffdio_wp = false; + close(uffd); uffd = -1; }