All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: Alejandro Colomar <alx.manpages@gmail.com>,
	linux-man@vger.kernel.org,
	Mike Rapoport <rppt@linux.vnet.ibm.com>
Subject: Re: [PATCH 3/5] userfaultfd.2: Add write-protect mode
Date: Tue, 6 Apr 2021 12:36:08 -0400	[thread overview]
Message-ID: <20210406163608.GH628002@xz-x1> (raw)
In-Reply-To: <f7496c55-600d-9ac0-fe6c-7fcc75dc6955@gmail.com>

On Mon, Apr 05, 2021 at 11:13:14PM +0200, Michael Kerrisk (man-pages) wrote:
> Hello Alex, Peter,

Hi, Michael,

[...]

> > @@ -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
> > +Since Linux 5.7, userfaultfd is able to do
> > +synchronous page dirty tracking using the new write-protect register mode.
> > +One should check against the feature bit
> > +.B UFFD_FEATURE_PAGEFAULT_FLAG_WP
> > +before using this feature.
> > +Similar to the original userfaultfd missing mode, the write-protect mode will
> > +generate an userfaultfd message when the protected page is written.
> > +The user needs to resolve the page fault by unprotecting the faulted page and
> 
> You use "user-space" elsewhere, but "the user" here. What is the difference?

I wanted to mean the same idea of user-space indeed.

> 
> More generally, What is "the user" in this context? I think you 
> really mean  something like "the trap-handling thread"" or something
> like that? The same statement applies for various pieces below.

Yes, it's just a more general wording since the trap-handling thread in the
userfaultfd world belongs to the user, or the user-space.

> 
> > +kick the faulted thread to continue.
> 
> What does "kick" mean here. This should be explained.

Sorry about that, "kick" is a very frequently used wording for developers but
probably confusing for manpage readers, it means "wake up".

> 
> > +For more information, please refer to "Userfaultfd write-protect mode" section.
> >  .SS Userfaultfd operation
> >  After the userfaultfd object is created with
> >  .BR userfaultfd (),
> > @@ -179,7 +216,7 @@ or
> >  .BR ioctl (2)
> >  operations to resolve the page fault.
> >  .PP
> > -Starting from Linux 4.14, if the application sets the
> > +Since Linux 4.14, if the application sets the
> >  .B UFFD_FEATURE_SIGBUS
> >  feature bit using the
> >  .B UFFDIO_API
> > @@ -219,6 +256,65 @@ userfaultfd can be used only with anonymous private memory mappings.
> >  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.
> > +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
> > +To register with userfaultfd write-protect mode, the user needs to initiate the
> 
> You use "user-space" elsewhere, but "the user" here. What is the difference?

(I'm skipping same questions)

[...]

> > +.B UFFDIO_REGISTER
> > +with the mode set to
> > +.BR "UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP" .
> > +When there is only
> > +.B UFFDIO_REGISTER_MODE_WP
> > +registered, the userspace will
> > +.I not
> > +receive any message when a missing page is written.
> > +Instead, the userspace will only receive a write-protect page fault message
> > +when an existing but write-protected page got written.
> 
> The wording here is a bit off. What does it mean: "an existing but 
> write-protected page"?

I wanted to emphasize the fact that this write-protect message won't be
generated if the page does not exist at all.  That belongs to the missing page
fault even if a memory write triggerred the page fault.

Thanks,

-- 
Peter Xu


  reply	other threads:[~2021-04-06 16:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 13:13 [PATCH 0/5] Merged patches from others Alejandro Colomar
2021-04-05 13:13 ` [PATCH 1/5] scanf.3: clarify that %n supports type modifiers Alejandro Colomar
2021-04-05 19:48   ` Michael Kerrisk (man-pages)
2021-04-05 13:13 ` [PATCH 2/5] userfaultfd.2: Add UFFD_FEATURE_THREAD_ID docs Alejandro Colomar
2021-04-05 19:56   ` Michael Kerrisk (man-pages)
2021-04-05 20:01     ` Michael Kerrisk (man-pages)
2021-04-05 13:13 ` [PATCH 3/5] userfaultfd.2: Add write-protect mode Alejandro Colomar
2021-04-05 21:13   ` Michael Kerrisk (man-pages)
2021-04-06 16:36     ` Peter Xu [this message]
2021-04-05 13:13 ` [PATCH 4/5] ioctl_userfaultfd.2: Add UFFD_FEATURE_THREAD_ID docs Alejandro Colomar
2021-04-05 21:13   ` Michael Kerrisk (man-pages)
2021-04-05 13:13 ` [PATCH 5/5] ioctl_userfaultfd.2: Add write-protect mode docs Alejandro Colomar
2021-04-05 21:14   ` Michael Kerrisk (man-pages)
2021-04-06  8:10 ` [PATCH 0/5] Merged patches from others Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210406163608.GH628002@xz-x1 \
    --to=peterx@redhat.com \
    --cc=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=rppt@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.