linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, "Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Matthew Wilcox <willy@infradead.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Eric Biederman <ebiederm@xmission.com>,
	Kees Cook <kees@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	SeongJae Park <sj@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Brendan Higgins <brendanhiggins@google.com>,
	David Gow <davidgow@google.com>, Rae Moar <rmoar@google.com>
Subject: Re: [PATCH v2 1/7] userfaultfd: move core VMA manipulation logic to mm/userfaultfd.c
Date: Tue, 9 Jul 2024 15:14:46 +0100	[thread overview]
Message-ID: <428d74c2-f7d5-4660-b44e-7818b6a3bdd8@lucifer.local> (raw)
In-Reply-To: <f8658375-db8c-4fc1-9401-5e59b61c76a1@suse.cz>

On Tue, Jul 09, 2024 at 12:40:12PM GMT, Vlastimil Babka wrote:
> On 7/4/24 9:27 PM, Lorenzo Stoakes wrote:
> > This patch forms part of a patch series intending to separate out VMA logic
> > and render it testable from userspace, which requires that core
> > manipulation functions be exposed in an mm/-internal header file.
> >
> > In order to do this, we must abstract APIs we wish to test, in this
> > instance functions which ultimately invoke vma_modify().
> >
> > This patch therefore moves all logic which ultimately invokes vma_modify()
> > to mm/userfaultfd.c, trying to transfer code at a functional granularity
> > where possible.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
>
> > --- a/include/linux/userfaultfd_k.h
> > +++ b/include/linux/userfaultfd_k.h
> > @@ -264,6 +264,25 @@ extern void userfaultfd_unmap_complete(struct mm_struct *mm,
> >  extern bool userfaultfd_wp_unpopulated(struct vm_area_struct *vma);
> >  extern bool userfaultfd_wp_async(struct vm_area_struct *vma);
> >
> > +extern void userfaultfd_reset_ctx(struct vm_area_struct *vma);
> > +
> > +extern struct vm_area_struct *userfaultfd_clear_vma(struct vma_iterator *vmi,
> > +						    struct vm_area_struct *prev,
> > +						    struct vm_area_struct *vma,
> > +						    unsigned long start,
> > +						    unsigned long end);
> > +
> > +int userfaultfd_register_range(struct userfaultfd_ctx *ctx,
> > +			       struct vm_area_struct *vma,
> > +			       unsigned long vm_flags,
> > +			       unsigned long start, unsigned long end,
> > +			       bool wp_async);
> > +
> > +extern void userfaultfd_release_new(struct userfaultfd_ctx *ctx);
> > +
> > +extern void userfaultfd_release_all(struct mm_struct *mm,
> > +				    struct userfaultfd_ctx *ctx);
> > +
>
> Nit: the externs are superfluous. AFAIU the tribal knowledge (or is it
> documented?), we don't add them even if other declarations around have them,
> but we don't also actively remove them unless the lines are touched for
> other reasons. So the declarations are inconsistent but slowly move towards
> no externs.

Oh right, I was just keeping it consistent with existing decls (apart from
uffd_register_range() for some reason). Am aware the extern's are
superfluous here so this was the only reason.

I think as it's a nitty thing let's keep it as-is for now, I can do a
follow up patch perhaps to correct.

>
> >  #else /* CONFIG_USERFAULTFD */
> >
> >  /* mm helpers */
>


  reply	other threads:[~2024-07-09 14:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 19:27 [PATCH v2 0/7] Make core VMA operations internal and testable Lorenzo Stoakes
2024-07-04 19:27 ` [PATCH v2 1/7] userfaultfd: move core VMA manipulation logic to mm/userfaultfd.c Lorenzo Stoakes
2024-07-09 10:40   ` Vlastimil Babka
2024-07-09 14:14     ` Lorenzo Stoakes [this message]
2024-07-09 13:07   ` Liam R. Howlett
2024-07-04 19:27 ` [PATCH v2 2/7] mm: move vma_modify() and helpers to internal header Lorenzo Stoakes
2024-07-09 10:45   ` Vlastimil Babka
2024-07-09 13:09   ` Liam R. Howlett
2024-07-04 19:27 ` [PATCH v2 3/7] mm: move vma_shrink(), vma_expand() " Lorenzo Stoakes
2024-07-09 10:49   ` Vlastimil Babka
2024-07-04 19:27 ` [PATCH v2 4/7] mm: move internal core VMA manipulation functions to own file Lorenzo Stoakes
2024-07-09 11:09   ` Vlastimil Babka
2024-07-09 13:12   ` Liam R. Howlett
2024-07-04 19:28 ` [PATCH v2 5/7] MAINTAINERS: Add entry for new VMA files Lorenzo Stoakes
2024-07-09 11:11   ` Vlastimil Babka
2024-07-09 13:13   ` Liam R. Howlett
2024-07-04 19:28 ` [PATCH v2 6/7] tools: separate out shared radix-tree components Lorenzo Stoakes
2024-07-09 11:14   ` Vlastimil Babka
2024-07-09 13:13   ` Liam R. Howlett
2024-07-04 19:28 ` [PATCH v2 7/7] tools: add skeleton code for userland testing of VMA logic Lorenzo Stoakes
2024-07-05 18:28   ` SeongJae Park
2024-07-08 13:14     ` Lorenzo Stoakes
2024-07-09 11:29   ` Vlastimil Babka
2024-07-09 13:16   ` Liam R. Howlett
2024-07-10 19:32 ` [PATCH v2 0/7] Make core VMA operations internal and testable Lorenzo Stoakes
2024-07-11  2:54   ` Andrew Morton
2024-07-11 18:00     ` Liam R. Howlett
2024-07-19 10:52       ` Lorenzo Stoakes
2024-07-19 20:49         ` Andrew Morton

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=428d74c2-f7d5-4660-b44e-7818b6a3bdd8@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=ebiederm@xmission.com \
    --cc=jack@suse.cz \
    --cc=kees@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rmoar@google.com \
    --cc=shuah@kernel.org \
    --cc=sj@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox