From: Will Deacon <will@kernel.org>
To: Wei-Lin Chang <weilin.chang@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org, Marc Zyngier <maz@kernel.org>,
Oliver Upton <oupton@kernel.org>,
Fuad Tabba <fuad.tabba@linux.dev>,
Joey Gouly <joey.gouly@arm.com>,
Steffen Eiden <seiden@linux.ibm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
"David Hildenbrand (Arm)" <david@kernel.org>,
Matt Fleming <matt@codeblueprint.co.uk>,
Ard Biesheuvel <ardb@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Sebastian Ene <sebastianene@google.com>,
Vincent Donnefort <vdonnefort@google.com>
Subject: Re: [PATCH v2 1/2] arm64: ptdump: Make note_page_flush() range aware
Date: Fri, 7 Aug 2026 12:46:43 +0100 [thread overview]
Message-ID: <anXFo-igVdqrCogQ@willie-the-truck> (raw)
In-Reply-To: <20260724185431.2990395-2-weilin.chang@arm.com>
On Fri, Jul 24, 2026 at 07:54:30PM +0100, Wei-Lin Chang wrote:
> note_page_flush() calls note_page() with addr == 0 and level == -1 to
> dump the last row of a ptdump. addr == 0 (1 << 64 wrapped around)
> renders a huge region with enormous size for address spaces with
> IA bits < 64. For example the stage-2 page tables and the EFI runtime
> page table.
>
> More importantly, the last region of the address space and everything
> after the address space up to 1 << 64 are merged into one row of
> output. If the last region within the address space is valid, it will
> appear to remain valid up to 1 << 64 with the same attributes.
>
> Currently only the EFI runtime ptdump is affected by this, but KVM will
> soon fix its stage-2 ptdump by using note_page_flush(). Here is an
> example of an EFI runtime ptdump (last row):
>
> 0x0000008000000000-0x0000000000000000 17179868672G PGD
>
> With this patch:
>
> 0x0000008000000000-0x0001000000000000 261632G PGD
>
> To fix this, use ptdump_state.range[] to figure out where the address
> space ends, and call note_page() with that.
>
> Fixes: 9d80448ac92b ("efi/arm64: Add debugfs node to dump UEFI runtime page tables")
> Signed-off-by: Wei-Lin Chang <weilin.chang@arm.com>
> ---
> arch/arm64/mm/ptdump.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
> index 1c20144700d7..5b34060ceb96 100644
> --- a/arch/arm64/mm/ptdump.c
> +++ b/arch/arm64/mm/ptdump.c
> @@ -278,9 +278,24 @@ void note_page_pgd(struct ptdump_state *pt_st, unsigned long addr, pgd_t pgd)
>
> void note_page_flush(struct ptdump_state *pt_st)
> {
> + const struct ptdump_range *range = pt_st->range;
> + unsigned long end = 0;
> pte_t pte_zero = {0};
>
> - note_page(pt_st, 0, -1, pte_val(pte_zero));
> + while (range->start != range->end) {
> + end = range->end;
> + range++;
> + }
This seems to be duplicating some of what the core code does already in
ptdump_walk_pgd(). Can we retrieve the information we need from the
containing 'struct ptdump_pg_state' structure instead of recomputing
the address?
Will
next prev parent reply other threads:[~2026-08-07 11:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 18:54 [PATCH v2 0/2] arm64: ptdump flush fixes Wei-Lin Chang
2026-07-24 18:54 ` [PATCH v2 1/2] arm64: ptdump: Make note_page_flush() range aware Wei-Lin Chang
2026-08-07 11:46 ` Will Deacon [this message]
2026-08-07 14:22 ` Wei-Lin Chang
2026-07-24 18:54 ` [PATCH v2 2/2] KVM: arm64: ptdump: Flush the last region Wei-Lin Chang
2026-07-25 17:16 ` Dev Jain
2026-07-25 17:28 ` Marc Zyngier
2026-07-26 8:11 ` Dev Jain
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=anXFo-igVdqrCogQ@willie-the-truck \
--to=will@kernel.org \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matt@codeblueprint.co.uk \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=sebastianene@google.com \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=vdonnefort@google.com \
--cc=weilin.chang@arm.com \
--cc=yuzenghui@huawei.com \
/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
all inboxes | Powered by JetHome®