From: David Hildenbrand <david@redhat.com>
To: Chunyan Zhang <zhangchunyan@iscas.ac.cn>,
linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Deepak Gupta <debug@rivosinc.com>,
Ved Shanbhogue <ved@rivosinc.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Xu <peterx@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Axel Rasmussen <axelrasmussen@google.com>,
Yuanchu Xie <yuanchu@google.com>,
Chunyan Zhang <zhang.lyra@gmail.com>
Subject: Re: [PATCH V10 2/5] mm: uffd_wp: Add pte_uffd_wp_available()
Date: Tue, 9 Sep 2025 13:43:28 +0200 [thread overview]
Message-ID: <0847f0b4-a02e-42d7-9bf3-797a753d3304@redhat.com> (raw)
In-Reply-To: <20250909095611.803898-3-zhangchunyan@iscas.ac.cn>
On 09.09.25 11:56, Chunyan Zhang wrote:
> Some platforms can customize the PTE uffd_wp bit and make it unavailable
> even if the architecture allows providing the PTE resource.
> This patch adds a macro API which allows architectures to define
> their specific ones for checking if the PTE uffd_wp bit is available.
>
> Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
> ---
> fs/userfaultfd.c | 25 +++++++++--------
> include/asm-generic/pgtable_uffd.h | 12 ++++++++
> include/linux/mm_inline.h | 7 +++++
> include/linux/userfaultfd_k.h | 44 +++++++++++++++++++-----------
> mm/memory.c | 6 ++--
> 5 files changed, 65 insertions(+), 29 deletions(-)
>
> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
> index 54c6cc7fe9c6..68e5006e5158 100644
> --- a/fs/userfaultfd.c
> +++ b/fs/userfaultfd.c
> @@ -1270,9 +1270,10 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
> if (uffdio_register.mode & UFFDIO_REGISTER_MODE_MISSING)
> vm_flags |= VM_UFFD_MISSING;
> if (uffdio_register.mode & UFFDIO_REGISTER_MODE_WP) {
> -#ifndef CONFIG_HAVE_ARCH_USERFAULTFD_WP
> - goto out;
> -#endif
> + if (!IS_ENABLED(CONFIG_HAVE_ARCH_USERFAULTFD_WP) ||
> + !pte_uffd_wp_available())
> + goto out;
> +
Same comment as for the other patch: make the
CONFIG_HAVE_ARCH_USERFAULTFD_WP part of the pte_uffd_wp_available()
check and better call it "pgtable_uffd_wp_" ... available/supported.
--
Cheers
David / dhildenb
next prev parent reply other threads:[~2025-09-09 11:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 9:56 [PATCH V10 0/5] riscv: mm: Add soft-dirty and uffd-wp support Chunyan Zhang
2025-09-09 9:56 ` [PATCH V10 1/5] mm: softdirty: Add pte_soft_dirty_available() Chunyan Zhang
2025-09-09 11:42 ` David Hildenbrand
2025-09-10 8:25 ` Chunyan Zhang
2025-09-10 8:51 ` David Hildenbrand
2025-09-11 2:51 ` Chunyan Zhang
2025-09-09 9:56 ` [PATCH V10 2/5] mm: uffd_wp: Add pte_uffd_wp_available() Chunyan Zhang
2025-09-09 11:43 ` David Hildenbrand [this message]
2025-09-09 9:56 ` [PATCH V10 3/5] riscv: Add RISC-V Svrsw60t59b extension support Chunyan Zhang
2025-09-09 17:12 ` Andrew Jones
2025-09-09 9:56 ` [PATCH V10 4/5] riscv: mm: Add soft-dirty page tracking support Chunyan Zhang
2025-09-09 9:56 ` [PATCH V10 5/5] riscv: mm: Add uffd write-protect support Chunyan Zhang
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=0847f0b4-a02e-42d7-9bf3-797a753d3304@redhat.com \
--to=david@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=axelrasmussen@google.com \
--cc=brauner@kernel.org \
--cc=debug@rivosinc.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=ved@rivosinc.com \
--cc=viro@zeniv.linux.org.uk \
--cc=yuanchu@google.com \
--cc=zhang.lyra@gmail.com \
--cc=zhangchunyan@iscas.ac.cn \
/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