From: sashiko-bot@kernel.org
To: "Jingyi Sun" <1045704958@qq.com>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>
Cc: "Alexandre Ghiti" <alex@ghiti.fr>,
"David Hildenbrand" <david@kernel.org>,
linux-mm@kvack.org
Subject: Re: [PATCH] riscv: mm: make pud_leaf() only care about the leaf bits
Date: Wed, 25 Nov 2026 08:06:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-232863@kernel.org> (raw)
In-Reply-To: <tencent_9D774595101D7C0F5A46CBCE69817B8A6E06@qq.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] riscv: mm: missing present check in pud_user_accessible_page()
--
commit d68f5d3a880f9ce9b41f596dae6d5013013582b2
Author: Jingyi Sun <1045704958@qq.com>
riscv: mm: make pud_leaf() only care about the leaf bits
This commit drops the pud_present() check from pud_leaf() so that
PROT_NONE huge PUD mappings are still recognized as leaf entries.
> diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h
> index eb7708e35cf92..1f45ebce8a750 100644
> --- a/arch/riscv/include/asm/pgtable-64.h
> +++ b/arch/riscv/include/asm/pgtable-64.h
> @@ -226,7 +226,7 @@ static inline int pud_bad(pud_t pud)
> #define pud_leaf pud_leaf
> static inline bool pud_leaf(pud_t pud)
> {
> - return pud_present(pud) && (pud_val(pud) & _PAGE_LEAF);
> + return pud_val(pud) & _PAGE_LEAF;
> }
>
> static inline int pud_user(pud_t pud)
[Severity: Low]
Does dropping pud_present() here cause pud_user_accessible_page() to
return true for invalidated PUDs created by pud_mkinvalid()?
arch/riscv/include/asm/pgtable.h:pud_user_accessible_page() {
return pud_leaf(pud) && pud_user(pud);
}
pud_mkinvalid() clears _PAGE_PRESENT and _PAGE_PROT_NONE while leaving
_PAGE_LEAF and _PAGE_USER set. During change_huge_pud(),
pudp_invalidate() installs pud_mkinvalid(*pudp) via pudp_establish() ->
page_table_check_pud_set(). Because pud_user_accessible_page() no longer
checks whether the PUD is present, page_table_check accounts the
invalidated intermediate PUD as a live user mapping and performs
262,144 redundant page_ext counter increments and decrements across the
1G range before set_pud_at() installs the modified PUD.
Should pud_user_accessible_page() check for _PAGE_PRESENT (or
_PAGE_PRESENT | _PAGE_PROT_NONE), matching pmd_user_accessible_page() from
commit bdda2887cbf3 ("riscv: mm: exclude invalid THP PMDs from page table
check")?
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_9D774595101D7C0F5A46CBCE69817B8A6E06@qq.com?part=1
prev parent reply other threads:[~2026-11-25 8:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 8:05 [PATCH] riscv: mm: make pud_leaf() only care about the leaf bits Jingyi Sun
2026-11-25 8:06 ` sashiko-bot [this message]
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=sashiko-outbox-232863@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=1045704958@qq.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=david@kernel.org \
--cc=linux-mm@kvack.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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