From patchwork Fri Jun 3 17:37:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12869265 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 9CAB3C43334 for ; Fri, 3 Jun 2022 17:37:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF5EB6B0072; Fri, 3 Jun 2022 13:37:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A560C6B0073; Fri, 3 Jun 2022 13:37:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 917D38D0001; Fri, 3 Jun 2022 13:37:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 807C06B0072 for ; Fri, 3 Jun 2022 13:37:45 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5B995617B4 for ; Fri, 3 Jun 2022 17:37:45 +0000 (UTC) X-FDA: 79537632090.26.6959AD7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf11.hostedemail.com (Postfix) with ESMTP id 4584640031 for ; Fri, 3 Jun 2022 17:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654277864; 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=bvNdDteJSKV8nPr70UjTL9Ga0ysM0wiU173XEAoRmEg=; b=IriE9KlhMvKj8jPcVWOeqVCyelsJt6vhmq4QIXHYZ8QrnVnX/+dKiLE0zQMtnhFcjUVvdy d1TUi3fYBC4dxWP5hLQhBF5WmCjH5qhXnHsPpkFItq1fsu6Tm2UjAu/E7OBWBpA4qsna70 Yiw4mLYuy5/MkNcA18Crsq1jpmQ5IEU= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-tETGx9ngMb-a-x9tyCrLRA-1; Fri, 03 Jun 2022 13:37:43 -0400 X-MC-Unique: tETGx9ngMb-a-x9tyCrLRA-1 Received: by mail-il1-f199.google.com with SMTP id h18-20020a056e021d9200b002d40280eeadso2489787ila.23 for ; Fri, 03 Jun 2022 10:37:43 -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=bvNdDteJSKV8nPr70UjTL9Ga0ysM0wiU173XEAoRmEg=; b=smW7QWmxgeXIVn2AFoEKvADM7dS9Zj3olP3eBokwvMjt+chfsI8qGOMNU7qoLZHwh2 tbpJi0IIbmDrMMQAUOy6yu/FzipS0/T1oER1/qKl6pbIEKk6QE0BtngO+7eZ/uolgWpb rRmKUujAND1so3jNCZxkhhET9R435rkYLBheidsm34p/GcNJqtcxwYyJedfGzZFncT7L HcKTqehGPFdYBAkNSqLzCMODCkVqd0gTfJ0imcoK++526Jr3417DvWCSUfZQKBX2oYm1 DkX7vOtxfYZZKPiigTwD/0DyusL2VmHBLNlkJzsEEqUhZLGR1PewSrkP3Bwlu7SZDqwr MUVw== X-Gm-Message-State: AOAM531ehC+aJDmopYsFGHLoNFqdT5pgOFApCpEY2/ewAF547Prz+hK+ 3c2fs7TMYrpYDBo4ATcjWHfhT4nIVuWAAh42NrV3twPjilkweZRBY0omKLEuphUoZx9rUzBlBiY HgOamUb+hRHo= X-Received: by 2002:a05:6e02:1c42:b0:2d1:aaac:ecc2 with SMTP id d2-20020a056e021c4200b002d1aaacecc2mr6160209ilg.128.1654277862907; Fri, 03 Jun 2022 10:37:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD6QpwDL7Wd5u30b73amnDkQf+0XrVGTTVTW2Zv3Vw4x28t8LPwaKvFl/gRzlApcqbp9Utcw== X-Received: by 2002:a05:6e02:1c42:b0:2d1:aaac:ecc2 with SMTP id d2-20020a056e021c4200b002d1aaacecc2mr6160200ilg.128.1654277862717; Fri, 03 Jun 2022 10:37:42 -0700 (PDT) Received: from localhost.localdomain (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id g23-20020a02bb97000000b0032e1e0ac289sm2791117jan.8.2022.06.03.10.37.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Jun 2022 10:37:42 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-man@vger.kernel.org, linux-mm@kvack.org Cc: Michael Kerrisk , Andrea Arcangeli , Alejandro Colomar , Nadav Amit , Axel Rasmussen , Andrew Morton , peterx@redhat.com Subject: [PATCH v2 2/2] userfaultfd.2: Update on write-protection support Date: Fri, 3 Jun 2022 13:37:36 -0400 Message-Id: <20220603173736.62581-3-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220603173736.62581-1-peterx@redhat.com> References: <20220603173736.62581-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IriE9Klh; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf11.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=peterx@redhat.com X-Stat-Signature: ojx44juekd7ppoxrwh1pewxy47bwocx6 X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4584640031 X-HE-Tag: 1654277856-853514 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2 index 6b9412aaf..9b5ec0358 100644 --- a/man2/userfaultfd.2 +++ b/man2/userfaultfd.2 @@ -270,13 +270,18 @@ 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 @@ -327,8 +332,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 Userfaultfd minor fault mode (since 5.13) Since Linux 5.13,