The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Dev Jain <dev.jain@arm.com>
Cc: Wei-Lin Chang <weilin.chang@arm.com>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	linux-kernel@vger.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>,
	Will Deacon <will@kernel.org>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Ryan Roberts <ryan.roberts@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>,
	Sashiko AI <sashiko-bot@kernel.org>
Subject: Re: [PATCH v2 2/2] KVM: arm64: ptdump: Flush the last region
Date: Sat, 25 Jul 2026 18:28:52 +0100	[thread overview]
Message-ID: <87v7a3ou5n.wl-maz@kernel.org> (raw)
In-Reply-To: <a2548783-ee41-49c0-bfe3-80b3816dc6b2@arm.com>

On Sat, 25 Jul 2026 18:16:37 +0100,
Dev Jain <dev.jain@arm.com> wrote:
> 
> 
> 
> On 25/07/26 12:24 am, Wei-Lin Chang wrote:
> > Currently the stage-2 ptdump calls note_page() at each leaf entry visit.
> > This simply misses the output of the last region, because note_page()
> > only dumps output when it detects a change in level/prot, or when the
> > walk enters a next marker section. The last region in the guest IPA
> > space with the same level/prot is not dumped since there is no change
> > after it.
> > 
> > Call note_page_flush() to dump the final region. note_page_flush()
> > expects ptdump_state.range[] to be initialized to the range of the
> > address space, so also do that.
> > 
> > Also change the second marker's start address to ULONG_MAX so we never
> > cross it. This avoids dumping redundant marker names (which are NULL),
> > and advancing beyond the end of the marker array.
> > 
> > Fixes: 7c4f73548ed1 ("KVM: arm64: Register ptdump with debugfs on guest creation")
> > Reported-by: Sashiko AI <sashiko-bot@kernel.org>
> > Closes: https://lore.kernel.org/kvmarm/20260630122758.891011F00A3A@smtp.kernel.org/
> > Signed-off-by: Wei-Lin Chang <weilin.chang@arm.com>
> > ---
> >  arch/arm64/kvm/ptdump.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/arm64/kvm/ptdump.c b/arch/arm64/kvm/ptdump.c
> > index c9140e22abcf..222577163d2b 100644
> > --- a/arch/arm64/kvm/ptdump.c
> > +++ b/arch/arm64/kvm/ptdump.c
> > @@ -130,7 +130,7 @@ static struct kvm_ptdump_guest_state *kvm_ptdump_parser_create(struct kvm_s2_mmu
> >  	}
> >  
> >  	st->ipa_marker[0].name		= "Guest IPA";
> > -	st->ipa_marker[1].start_address = BIT(pgtable->ia_bits);
> > +	st->ipa_marker[1].start_address = ULONG_MAX;
> >  
> >  	st->mmu				= mmu;
> >  	return st;
> > @@ -148,18 +148,26 @@ static int kvm_ptdump_guest_show(struct seq_file *m, void *unused)
> >  		.flags	= KVM_PGTABLE_WALK_LEAF,
> >  	};
> >  
> > +	guard(write_lock)(&kvm->mmu_lock);
> >  	st->parser_state = (struct ptdump_pg_state) {
> >  		.marker		= &st->ipa_marker[0],
> >  		.level		= -1,
> >  		.pg_level	= &st->level[0],
> >  		.seq		= m,
> > +		.ptdump		= {
> > +			.range = (struct ptdump_range[]){
> > +				{0, BIT(mmu->pgt->ia_bits)},
> > +				{0, 0}
> > +			}
> 
> I am having a real hard time reading that indentation :) you
> could make it look like what we have currently in ptdump_walk().

This patch:

		.ptdump		= {
			.range = (struct ptdump_range[]){
				{0, BIT(mmu->pgt->ia_bits)},
				{0, 0}
			}
		}

ptdump_walk():

		.ptdump = {
			[...]
			.range = (struct ptdump_range[]){
				{info->base_addr, end},
				{0, 0}
			}
		}

Zero difference in indentation. Consider using a better email client,
or look at the applied patches.

	M.

-- 
Jazz isn't dead. It just smells funny.

      reply	other threads:[~2026-07-25 17:27 UTC|newest]

Thread overview: 5+ 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-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 [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=87v7a3ou5n.wl-maz@kernel.org \
    --to=maz@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=oupton@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=sashiko-bot@kernel.org \
    --cc=sebastianene@google.com \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=vdonnefort@google.com \
    --cc=weilin.chang@arm.com \
    --cc=will@kernel.org \
    --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