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 X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE7EFC433DB for ; Tue, 23 Mar 2021 18:58:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 46946619CA for ; Tue, 23 Mar 2021 18:58:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46946619CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B3FD56B0150; Tue, 23 Mar 2021 14:58:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B15766B016C; Tue, 23 Mar 2021 14:58:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B6116B016D; Tue, 23 Mar 2021 14:58:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 7E9026B0150 for ; Tue, 23 Mar 2021 14:58:14 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 41B494DBD for ; Tue, 23 Mar 2021 18:58:14 +0000 (UTC) X-FDA: 77952049308.24.D4AA4C0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 7A955A000841 for ; Tue, 23 Mar 2021 18:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616525892; 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: in-reply-to:in-reply-to:references:references; bh=CT3Kmn+gEFR6z7R7WNTDWZaSULNoJGGKHGmVItsiXpw=; b=gKQRIKe0IbUbbyOALcE2Zy/6E60QP/hM+Re1FZfSRiJ0i+tYGY8v5P/XVtcJOCv6vvlkPm gKqAH0I29oIl1fsS8oM2L+P7O3SMnCJ1T7F3N0TNVEcameZ+Vo6OzoRGjGe8L4fzs74P4G yNl9DoOjDRcVQNAiTc5R3YK/MQqq9YU= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-604-MyMplCitPY2inzqoR0rpag-1; Tue, 23 Mar 2021 14:58:09 -0400 X-MC-Unique: MyMplCitPY2inzqoR0rpag-1 Received: by mail-qk1-f199.google.com with SMTP id k68so2686612qke.2 for ; Tue, 23 Mar 2021 11:58:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CT3Kmn+gEFR6z7R7WNTDWZaSULNoJGGKHGmVItsiXpw=; b=V48p5fe4uleAZSI44UMw1aF+6v1dn72O/iAYcLGzC2Io1cHhORYRf++BRGbfAxPvo/ bhiUThFKgIWTQHo1e4ZTgbcZBRGfRSqNE7PYESHOTFS+CZwO8utpC9UzjgZe30Fbl0fI r3eUuLcMXehBV93Yo/WsuGn2x8HCIFsTmsbwyeD3HYIjkYEERrhWu6vzsDA9sxU2u9B6 bNDnSEirFi8d/lYZhnXE/udIywrQzD5WKekqgnEobpV3/qjkJlBvA0s15M4YTmdIFG4R NjVfQuwAi+omy0vJQtbTFLMELYB0lyFrR58mvxgYU/UmVyFAXc1742rNUEre6C+wyHwc bFlQ== X-Gm-Message-State: AOAM533m7LQfqiL+9e+ATV3SszzbogThNoWypyVp+gH4Yn4k+4BzGCJ6 qR3/ztGFB6qsUXVWSYhv7Ernqt45nTl/+aZfTwCPJhIgz7sPHixLsfaga2t0nKTHjC81x4vyHAs OSyZTq9J2gQI= X-Received: by 2002:a37:a74e:: with SMTP id q75mr6856179qke.165.1616525888330; Tue, 23 Mar 2021 11:58:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqGFOI1cIm+p4sU8Im1YESqE3vTsYvSjd4tyeZApy3bMia7WUOBF9Ocw26Ft/MNchUMe0vTA== X-Received: by 2002:a37:a74e:: with SMTP id q75mr6856154qke.165.1616525887980; Tue, 23 Mar 2021 11:58:07 -0700 (PDT) Received: from xz-x1 (bras-base-toroon474qw-grc-82-174-91-135-175.dsl.bell.ca. [174.91.135.175]) by smtp.gmail.com with ESMTPSA id y1sm13882066qki.9.2021.03.23.11.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 11:58:07 -0700 (PDT) Date: Tue, 23 Mar 2021 14:58:05 -0400 From: Peter Xu To: "Alejandro Colomar (man-pages)" Cc: linux-man@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mike Rapoport , Andrea Arcangeli , Axel Rasmussen , Michael Kerrisk , Nadav Amit , Andrew Morton Subject: Re: [PATCH v4 2/4] userfaultfd.2: Add write-protect mode Message-ID: <20210323185805.GI6486@xz-x1> References: <20210322220848.52162-1-peterx@redhat.com> <20210322220848.52162-3-peterx@redhat.com> <9c5a6fd4-e0f6-026a-e6a2-db34234a56c8@gmail.com> MIME-Version: 1.0 In-Reply-To: <9c5a6fd4-e0f6-026a-e6a2-db34234a56c8@gmail.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Stat-Signature: bd53daw53c6g9xy3d48s4s153nqtrote X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7A955A000841 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=63.128.21.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616525892-701362 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: On Tue, Mar 23, 2021 at 07:19:12PM +0100, Alejandro Colomar (man-pages) wrote: > Hi Peter, > > Please see a few more comments below. > > Thanks, > > Alex > > On 3/22/21 11:08 PM, Peter Xu wrote: > > Write-protect mode is supported starting from Linux 5.7. > > > > Signed-off-by: Peter Xu > > --- > > man2/userfaultfd.2 | 104 ++++++++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 102 insertions(+), 2 deletions(-) > > > > diff --git a/man2/userfaultfd.2 b/man2/userfaultfd.2 > > index 555e37409..8ad4a71b5 100644 > > --- a/man2/userfaultfd.2 > > +++ b/man2/userfaultfd.2 > > @@ -78,6 +78,32 @@ all memory ranges that were registered with the object are unregistered > > and unread events are flushed. > > .\" > > .PP > > +Userfaultfd supports two modes of registration: > > +.TP > > +.BR UFFDIO_REGISTER_MODE_MISSING " (since 4.10)" > > +When registered with > > +.B UFFDIO_REGISTER_MODE_MISSING > > +mode, the userspace will receive a page fault message > > +when a missing page is accessed. > > +The faulted thread will be stopped from execution until the page fault is > > +resolved from the userspace by either an > > +.B UFFDIO_COPY > > +or an > > +.B UFFDIO_ZEROPAGE > > +ioctl. > > +.TP > > +.BR UFFDIO_REGISTER_MODE_WP " (since 5.7)" > > +When registered with > > +.B UFFDIO_REGISTER_MODE_WP > > +mode, the userspace will receive a page fault message > > +when a write-protected page is written. > > +The faulted thread will be stopped from execution > > +until the userspace un-write-protect the page using an > > Here you use un-write-protect, but in the other patch you use > write-unprotect. Please, use a consistent wording if it's the same thing > (if there are other similar things with different wordings in different > pages, please fix them too, but I didn't see more of those). If there's > already a wording for that in any page, please reuse it (I ignore it). I tried to look for it, and these are the only ones I got that are related: man4/fd.4:gets the cached drive state (disk changed, write protected et al.) man4/st.4:The drive is write-protected. man4/st.4:An attempt was made to write or erase a write-protected tape. man4/st.4:when the tape in the drive is write-protected. Unluckily I didn't find the unprotect part. I think I'll reword it as "write-unprotect", since "write" should be an adjective-kind prefix. > > > +.B UFFDIO_WRITEPROTECT > > +ioctl. > > +.PP > > +Multiple modes can be enabled at the same time for the same memory range. > > +.PP > > Since Linux 4.14, userfaultfd page fault message can selectively embed faulting > > thread ID information into the fault message. > > One needs to enable this feature explicitly using the > > @@ -144,6 +170,17 @@ single threaded non-cooperative userfaultfd manager implementations. > > .\" and limitations remaining in 4.11 > > .\" Maybe it's worth adding a dedicated sub-section... > > .\" > > +.PP > > +Starting from Linux 5.7, userfaultfd is able to do > > The previous paragraph uses "Siince Linux 4.14". For consistency, please > use that same wording here. Ok. Unless Mike speaks out, I'll still keep Mike's a-b as a credit for reviewing, considering these changes are small. Thanks, -- Peter Xu