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=unavailable 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 20FF1C433E0 for ; Tue, 23 Mar 2021 18:59:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E49D46191E for ; Tue, 23 Mar 2021 18:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232614AbhCWS6n (ORCPT ); Tue, 23 Mar 2021 14:58:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51045 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232129AbhCWS6S (ORCPT ); Tue, 23 Mar 2021 14:58:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616525890; 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=IrFeKU+fZnrsiYhtxzeejTPyR1Gj3OZEchEpBH04dTQLPryMh/PAcxCthCl5wdZdjT/5aR 9c+fE/tdK7/OC4aPSwnEbk9x2HoFNlPud2GA+kvD6HprR0G9/orMugHXGC7TNHmMRfi88R HrfWgNRfS7Dz97Xy8h489AEKohc++N0= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-553-Va-_gsrANvimmHmpkvp94A-1; Tue, 23 Mar 2021 14:58:09 -0400 X-MC-Unique: Va-_gsrANvimmHmpkvp94A-1 Received: by mail-qv1-f69.google.com with SMTP id x20so2203802qvd.21 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=mlPCUb+0OsuDy3z1+Q/Emt9HXZzGDeXaZQQcwtYLTbNzF7b6/KqCGH+reV5q3vdGjX ixhZxSSxYgvnD5klWFPsquwnnN9LB5HRx0/f0+DU4hEoIJ90zOUh9ocOHYfz7lIgYKJ/ Fayje50O9s8Y/a7X9CAWXB2p3dF+kBVFHc2BzNTnUlVTdSOrqvjU1EcPzhxqjIxNwlnx DN+3uZtQgAGaTZIqFcskY0yCOS2yzaWCWj/Dv/CNvAr8OVUOlu9sJSryBVE4pmw0HjJj nwb9xjisuKfBzYqVdb6vd3kXWCahv61j12cmPXPxFXylXtXHDF3Zzvu+BJr/1mNhnIDw WOfg== X-Gm-Message-State: AOAM533hoOXMFDFFSfN0WAXySbwyJ9wj18iMk1ykSclo3f+hWXBLNWMk Xqz6sp0p6hbUhQAZ8Kj8l+wUESpl0z2b1s+GmEQz5HiyUWKsjhllNzVQDL8zSIUQMCPSaTqtJU7 MofaXL7GpIXZf+9FoHfePfdGr X-Received: by 2002:a37:a74e:: with SMTP id q75mr6856170qke.165.1616525888325; 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <9c5a6fd4-e0f6-026a-e6a2-db34234a56c8@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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