From patchwork Tue May 31 01:11:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12865016 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 0E907C433F5 for ; Tue, 31 May 2022 01:12:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C9D46B0074; Mon, 30 May 2022 21:12:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9521F6B0075; Mon, 30 May 2022 21:12:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77D466B0078; Mon, 30 May 2022 21:12:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 69F286B0074 for ; Mon, 30 May 2022 21:12:07 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 333FE20286 for ; Tue, 31 May 2022 01:12:07 +0000 (UTC) X-FDA: 79524261894.03.ADE0F12 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 710C9A0053 for ; Tue, 31 May 2022 01:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653959525; h=from:from: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=+ftsvv1kgyZ07pkGYMo31JDRVN0rVbQcS4X4QP8a2k4=; b=OH1/Gb9JfpyiMei5A4RVXXqXDb84/O+7BoSnRSK+ybtemePxSyOHZRkGgsYK3xekxHvKWw 8DE7W55no9QDWd0oF/on+VwsRqyl+rzM8B//RpEgvJgdXraWjt/1APigQYe9FbPxG6DgPF ZysjG4WOBGgvRXDgHGA0NcksEf3v7uU= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-203-QYqsAcFYNRWU84xmkNu3Kw-1; Mon, 30 May 2022 21:12:04 -0400 X-MC-Unique: QYqsAcFYNRWU84xmkNu3Kw-1 Received: by mail-il1-f198.google.com with SMTP id q6-20020a056e0215c600b002c2c4091914so9272885ilu.14 for ; Mon, 30 May 2022 18:12:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+ftsvv1kgyZ07pkGYMo31JDRVN0rVbQcS4X4QP8a2k4=; b=hBn7ByYl9S5dOUmYkm0zy3iIbYlAWDlRgBipPfAQp2hO/AmW1i9SspahHrdqNUQiZD GF+y322mjrtsIz6UBd8O2m31r8dNaagm5BK/iKkXEs7UA6ihPBD8NitNV27k2RxZK4pe c980e9ztDhDm0LFIryuSNWriNCTnt49S20dGWlSY+mjTFJE+6aBkXQ1sgoRHohlmfQ1u eB5Csju28r/60TKkBLHfzJTLqb5orMkBqQ9OWPCZvrgtpMYe1NhR+A2EZxlNMkBTMdpU Zf9GFA4dU/+lgX2UPYNeKvoX07O1muBT1od4tuAXiUiK4W5ZxA/89Imwt8tRIdg9KUjS 26fQ== X-Gm-Message-State: AOAM533oZtwPABBvOcp6q5m1pqmGyN6UC6xt9oN9/2nwGwv4yk+NBBi0 aTRoE7RT9TL2C6QYwYMwG7WvcNqV/X12LH/vaRoPHINkia8eTKTsOZyYrRKQSSpMz99U6y5e8WL YWPi2LcIUD5I= X-Received: by 2002:a5e:d614:0:b0:65e:42c8:c51b with SMTP id w20-20020a5ed614000000b0065e42c8c51bmr25644011iom.78.1653959523752; Mon, 30 May 2022 18:12:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMlE0Rt5YEOvPReAT+xVKJwEsp+VIfQPBHnAmvRHpzn4UHcneOh9VgrZzAwMT91V2dYrCgyA== X-Received: by 2002:a5e:d614:0:b0:65e:42c8:c51b with SMTP id w20-20020a5ed614000000b0065e42c8c51bmr25643999iom.78.1653959523503; Mon, 30 May 2022 18:12:03 -0700 (PDT) Received: from localhost.localdomain (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id s6-20020a02c7c6000000b0032be3784b9bsm3158234jao.117.2022.05.30.18.12.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 May 2022 18:12:02 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-man@vger.kernel.org, linux-mm@kvack.org Cc: Alejandro Colomar , Michael Kerrisk , Axel Rasmussen , Andrea Arcangeli , peterx@redhat.com, Nadav Amit , Andrew Morton Subject: [PATCH 2/2] userfaultfd.2: Update on write-protection support Date: Mon, 30 May 2022 21:11:57 -0400 Message-Id: <20220531011157.46868-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220531011157.46868-1-peterx@redhat.com> References: <20220531011157.46868-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="OH1/Gb9J"; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf25.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 710C9A0053 X-Stat-Signature: z7s78f3gtp3xo34jbztrrzzr65qfekqw X-Rspam-User: X-HE-Tag: 1653959493-351109 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The shmem/hugetlbfs memory types are supported for write-protection messages very lately. Update the man page to reflect that. Signed-off-by: Peter Xu --- man2/userfaultfd.2 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2 index 0928a76d2..99aae8b50 100644 --- a/man2/userfaultfd.2 +++ b/man2/userfaultfd.2 @@ -273,13 +273,17 @@ Since Linux 4.11, userfaultfd can be also used with hugetlbfs and shared memory mappings. .\" .SS Userfaultfd write-protect mode (since 5.7) -Since Linux 5.7, userfaultfd supports write-protect mode. +Since Linux 5.7, userfaultfd supports write-protect mode for anonymous memory. The user needs to first check availability of this feature using .B UFFDIO_API ioctl against the feature bit .B UFFD_FEATURE_PAGEFAULT_FLAG_WP before using this feature. .PP +Since Linux 5.19, the write-protection mode was also supported on shmem and hugetlbfs +memory types. It can be detected with the feature bit +.BR UFFD_FEATURE_WP_HUGETLBFS_SHMEM . +.PP To register with userfaultfd write-protect mode, the user needs to initiate the .B UFFDIO_REGISTER ioctl with mode @@ -330,8 +334,6 @@ ioctl, whose should have the flag .B UFFDIO_WRITEPROTECT_MODE_WP cleared upon the faulted page or range. -.PP -Write-protect mode supports only private anonymous memory. .SS Reading from the userfaultfd structure Each .BR read (2)