From: Ryan Roberts <ryan.roberts@arm.com>
To: Muhammad Usama Anjum <usama.anjum@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Ard Biesheuvel <ardb@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
kasan-dev@googlegroups.com, linux-mm@kvack.org
Subject: Re: [PATCH 4/6] arm64: use hw_pte_t for fixmap HW PTEs
Date: Fri, 18 Sep 2026 17:03:55 +0100 [thread overview]
Message-ID: <829523cd-85a4-4f8e-b9f2-f3c1d7ce4fb1@arm.com> (raw)
In-Reply-To: <20260914-pte0_arm-v1-4-bb53b663e396@arm.com>
On 14/09/2026 14:51, Muhammad Usama Anjum wrote:
> fixmap_pte() returns a pointer into bm_pte, and early_fixmap_init_pte()
> installs those arrays as page tables. Their elements are therefore
> HW PTEs.
>
> Change the element type of bm_pte to hw_pte_t so it matches the HW PTE
> pointers returned and passed to the accessors. This is needed before
> ARCH_HAS_HW_PTE_T makes HW PTEs and SW PTE values distinct types; the
> array dimensions and placement are unchanged.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@arm.com>
> ---
> arch/arm64/mm/fixmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/fixmap.c b/arch/arm64/mm/fixmap.c
> index 237a9136bc73b..709a97fe327d8 100644
> --- a/arch/arm64/mm/fixmap.c
> +++ b/arch/arm64/mm/fixmap.c
> @@ -31,7 +31,7 @@ static_assert(NR_BM_PMD_TABLES == 1);
>
> #define BM_PTE_TABLE_IDX(addr) __BM_TABLE_IDX(addr, PMD_SHIFT)
>
> -static pte_t bm_pte[NR_BM_PTE_TABLES][PTRS_PER_PTE] __bss_pgtbl;
> +static hw_pte_t bm_pte[NR_BM_PTE_TABLES][PTRS_PER_PTE] __bss_pgtbl;
I think in my original proposal it was impossible to have a hw_pte value; only a
hw_pte pointer was possible. Being able to create hw_pte values means that it is
possible that a hw_pte_t pointer is not actually pointing to an entry in a HW
pgtable. The main motivation for this is that we want to dereference neighbours
of a hw pte based on it's pointer and be confident that it is safe. I think this
removes some of the safety.
Clearly in this instance, bm_pte is still defined such that we have an aligned
page worth of ptes, so its ok. I'm just concerned about the potential for
changes that don't follow the rules (and don't get picked up by the compiler) in
future.
I guess that's the trade off for having something that looks like a pointer
instead of an opaque handle.
Thanks,
Ryan
> static pmd_t bm_pmd[PTRS_PER_PMD] __bss_pgtbl __maybe_unused;
> static pud_t bm_pud[PTRS_PER_PUD] __bss_pgtbl __maybe_unused;
>
>
next prev parent reply other threads:[~2026-09-18 16:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 13:51 [PATCH 0/6] arm64: distinguish HW PTE pointers from SW PTE value pointers Muhammad Usama Anjum
2026-09-14 13:51 ` [PATCH 1/6] arm64: use hw_pte_t for HW PTE pointers Muhammad Usama Anjum
2026-09-21 7:59 ` Ryan Roberts
2026-09-21 8:20 ` Muhammad Usama Anjum
2026-09-14 13:51 ` [PATCH 2/6] arm64: use hw_pte_val for HW PTE atomics Muhammad Usama Anjum
2026-09-18 15:55 ` Ryan Roberts
2026-09-21 8:49 ` Muhammad Usama Anjum
2026-09-14 13:51 ` [PATCH 3/6] arm64: convert between HW PTEs and SW PTE values Muhammad Usama Anjum
2026-09-18 15:56 ` Ryan Roberts
2026-09-21 8:26 ` Ryan Roberts
2026-09-21 9:50 ` Muhammad Usama Anjum
2026-09-14 13:51 ` [PATCH 4/6] arm64: use hw_pte_t for fixmap HW PTEs Muhammad Usama Anjum
2026-09-18 16:03 ` Ryan Roberts [this message]
2026-09-18 20:00 ` David Hildenbrand (Arm)
2026-09-21 7:37 ` Ryan Roberts
2026-09-21 8:29 ` Ryan Roberts
2026-09-14 13:51 ` [PATCH 5/6] arm64: use HW PTE accessors in early map_range() Muhammad Usama Anjum
2026-09-21 9:44 ` Ryan Roberts
2026-09-14 13:51 ` [PATCH 6/6] arm64: enable a distinct type for HW PTEs Muhammad Usama Anjum
2026-09-21 9:44 ` Ryan Roberts
2026-09-21 9:51 ` [PATCH 0/6] arm64: distinguish HW PTE pointers from SW PTE value pointers Ryan Roberts
2026-09-21 10:10 ` Muhammad Usama Anjum
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=829523cd-85a4-4f8e-b9f2-f3c1d7ce4fb1@arm.com \
--to=ryan.roberts@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=ilias.apalodimas@linaro.org \
--cc=kasan-dev@googlegroups.com \
--cc=liam@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--cc=surenb@google.com \
--cc=usama.anjum@arm.com \
--cc=vbabka@kernel.org \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.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