lkml.org 
[lkml]   [2022]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v8 22/23] mm: Enable PTE markers by default
On Tue, Apr 19, 2022 at 11:13:48AM -0400, Johannes Weiner wrote:
> Hi Peter,

Hi, Johannes,

>
> On Mon, Apr 04, 2022 at 09:49:29PM -0400, Peter Xu wrote:
> > Enable PTE markers by default. On x86_64 it means it'll auto-enable
> > PTE_MARKER_UFFD_WP as well.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > mm/Kconfig | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/mm/Kconfig b/mm/Kconfig
> > index 6e7c2d59fa96..3eca34c864c5 100644
> > --- a/mm/Kconfig
> > +++ b/mm/Kconfig
> > @@ -911,12 +911,14 @@ config ANON_VMA_NAME
> >
> > config PTE_MARKER
> > bool "Marker PTEs support"
> > + default y
> >
> > help
> > Allows to create marker PTEs for file-backed memory.
>
> make oldconfig just prompted me on these:
>
> ---
> Marker PTEs support (PTE_MARKER) [Y/n/?] (NEW) ?
>
> CONFIG_PTE_MARKER:
>
> Allows to create marker PTEs for file-backed memory.
>
> Symbol: PTE_MARKER [=y]
> Type : bool
> Defined at mm/Kconfig:1046
> Prompt: Marker PTEs support
> Location:
> Main menu
> -> Memory Management options
> ---
>
> > config PTE_MARKER_UFFD_WP
> > bool "Marker PTEs support for userfaultfd write protection"
> > + default y
> > depends on PTE_MARKER && HAVE_ARCH_USERFAULTFD_WP
>
> It's not possible to answer them without looking at the code.
>
> But after looking at the code, I'm still not sure why it asks
> me. Isn't this infrastructure code?
>
> Wouldn't it make more sense to remove the prompt string and have
> userfaultfd simply select those?
>
> If this is too experimental to enable per default, a more reasonable
> question for the user would be a "userfaultfd file support" option or
> something, and have *that* select the marker code.

Thanks for raising this question.

Actually it's right now enabled by default, so I kept the options just to
make sure we can always explicitly disable those options when we want.
That's majorly why I kept this patch standalone one so if we want we can
even drop it.

Said that, I fully agree with you that having two options seem to be an
overkill, especially the PTE_MARKER option will be too challenging to be
correctly understood by anyone not familiar with it.

So after a 2nd thought I'm trying to refine what I want to achieve with the
kbuild system on this new feature:

- On supported systems (x86_64), should be by default y with "make
olddefconfig", but able to turn it off using "make oldconfig" etc., so
the user will have a choice when they want.

- On not-supported systems (non-x86_64), should be always n without
any prompt asking, and user won't even see this entry.

- PTE_MARKER option should always be hidden for all archs

I plan to post a patch that is attached (I also reworded the entry to not
mention about pte markers). Does that look acceptable on your side?

Thanks,

--
Peter Xu
From 5d25e9d685bf129a1730caa61c1545fb16c094bb Mon Sep 17 00:00:00 2001
From: Peter Xu <peterx@redhat.com>
Date: Tue, 19 Apr 2022 15:31:12 -0400
Subject: [PATCH] mm/uffd: Hide PTE_MARKER option
Content-type: text/plain

The PTE_MARKER option should not need to be exposed to the kernel builder,
keep it internal and remove the prompt so it won't be seen.

Instead, make the PTE_MARKER_UFFD_WP option to explicitly choose PTE_MARKER
when necessary.

While PTE_MARKER_UFFD_WP will still prompt to user, change the wording so
that it'll not mention PTE_MARKER at all but renaming it to "Userfaultfd
write protection support for shmem/hugetlbfs".

Reported-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
mm/Kconfig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/Kconfig b/mm/Kconfig
index 3eca34c864c5..d740e1ff3b2f 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -910,16 +910,16 @@ config ANON_VMA_NAME
difference in their name.

config PTE_MARKER
- bool "Marker PTEs support"
- default y
+ bool

help
Allows to create marker PTEs for file-backed memory.

config PTE_MARKER_UFFD_WP
- bool "Marker PTEs support for userfaultfd write protection"
+ bool "Userfaultfd write protection support for shmem/hugetlbfs"
default y
- depends on PTE_MARKER && HAVE_ARCH_USERFAULTFD_WP
+ depends on HAVE_ARCH_USERFAULTFD_WP
+ select PTE_MARKER

help
Allows to create marker PTEs for userfaultfd write protection
--
2.32.0
\
 
 \ /
  Last update: 2022-04-19 21:59    [W:0.081 / U:0.604 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site