Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4495107pxf; Tue, 23 Mar 2021 12:00:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeRVGnR3+EO1EMHbjfUS7dRsnYdS3zsHmOynYhIA0HywZGsxeDFT4iOu4PEaAzdPQTloVM X-Received: by 2002:aa7:cc03:: with SMTP id q3mr6139623edt.366.1616526033508; Tue, 23 Mar 2021 12:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616526033; cv=none; d=google.com; s=arc-20160816; b=g+04xeJee+VZ3ohazs648dCtsVhmJobWEnOteloEVYuwR+0d7dorjLX2pk6uHXYTco nRChK6D/0DymVyOQqZ1G39WYfsNoiRhA6hoSI9/E2jmGnPM6xGKt98a23b42Ggdu2OBN NoOrYvWieDYTY+J9+rpG2L3HnPAuHcAHgJ1QNRnM0sqlcwyo7+YKJE0SoPNKzsXZgxsk jh+k8w4n8fbdRPWiG2xSnPa8Pvu4D4ERLNFaIoqdUJmktYSQWqkIxLI08OVextaWhSnx I3DEbXkJxjqqORlc81JYXNK7vhI/xVwsTz+jsrozMCQ6qoa9E+qV1czgnWm0OG9RB5ql zmjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CT3Kmn+gEFR6z7R7WNTDWZaSULNoJGGKHGmVItsiXpw=; b=jJimggNiNMFy2pSv/+6jBdWZzpSo2c5bt0ncjYz4D/xxxvdAvYGYoXYlhPuccnrZAC SlWLW34t9vc1Yp7hauuX8yEph5OKMsPQnIIKs85OIMsn5vYXEtNloGlX3ch1kS6N1W5p IBR4snJYqnCakxxFK6OISuFgmwkhwsGFFgeR5+ySsMpfpG9f/ZtP3gdKPyFD96/snmIp nnB1t7bdUE5dBxuY1yL3fZ51TBuYyFjxWZHUWAt8XhsUUXuEFenABfSulxUuIuVD9InH 9tWgGL2QfCKdjJPE8Zli2tp5j4S800aLC7eqvt0RJ8uJmu9hzrYOz3VueB1xS05Ym2XI NWDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IrFeKU+f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb10si13842024ejc.273.2021.03.23.12.00.09; Tue, 23 Mar 2021 12:00:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IrFeKU+f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232667AbhCWS6m (ORCPT + 99 others); Tue, 23 Mar 2021 14:58:42 -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-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