From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12D653EFFC5; Sat, 25 Jul 2026 17:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785000452; cv=none; b=HQzP7/7h4MpyPkRwZ0f0tyxNh17UEV69toIeL00H7JarDafSfWdsthaDnsiOHO+9mfTlMfl0SdrFz5LojP3jET+S4HlJBkEiy9ToKFTQ3b9Yrjm4ut7nQeUU91dT6YliLz6vEunNz8BBn/R/UT50pJefz8aqWSoDsR3zU1DXLds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785000452; c=relaxed/simple; bh=F+WPa8sKca90dWuD0wWr5Rde2JZVzjJ9OwZx2rn79Zg=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=dc7sl4wPoEI1UfZpPCHXC2BnN/Iy1nbbZmUnmpkO4+8Be8nrNSGQb9G6j2G8191nAiZDDqQgYsxTwn1ITGZWnm75a9Thr+uI3O6DrKJzZ850a28uHfWjAcKM5OFuAY3bonUEK5P1gO91KJd91loEguDsNTKTKErMFRquUHf4Cqo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k0Mr59JY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k0Mr59JY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7D1E1F000E9; Sat, 25 Jul 2026 17:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785000451; bh=Xwer28G5pw4wsNF0yku4ROFLV/J4AXdW7aaxUo/gEhU=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=k0Mr59JYb8ILX93+B86WiJm6zWa3u9aRWj5DEP6Q+wRxarh0b+aRW6r7zwy1Ecd6Q /qSwmrKTrkL9WlLIISdG6AIkFkT9kcZ53MnzZyBHQedM+OYUaDgKn+x7osmYelZpGX W9kyKBWV3AXxA7HSYogLcgBNm+fqGHzL2JPYwvER/bp7s7CZ8qIoJApCuFBW08qxjw 91VfZirduIxYRwXWf65hAR1sdH5WHMvgT6GYHIy7IwKLn9SLz68pdRIDGx6q8PCdvO e427vn7Df3JoDj/EgVJBPIt8vY0NpyDetYwVnipHPtGhdxb8CLpHjpygSZNNMLCw2i B6PlnddOxtomg== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wng9o-00000008oCk-3L6Y; Sat, 25 Jul 2026 17:27:28 +0000 Date: Sat, 25 Jul 2026 18:28:52 +0100 Message-ID: <87v7a3ou5n.wl-maz@kernel.org> From: Marc Zyngier To: Dev Jain Cc: Wei-Lin Chang , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Oliver Upton , Fuad Tabba , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Anshuman Khandual , Ryan Roberts , "David Hildenbrand (Arm)" , Matt Fleming , Ard Biesheuvel , Mark Rutland , Sebastian Ene , Vincent Donnefort , Sashiko AI Subject: Re: [PATCH v2 2/2] KVM: arm64: ptdump: Flush the last region In-Reply-To: References: <20260724185431.2990395-1-weilin.chang@arm.com> <20260724185431.2990395-3-weilin.chang@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: dev.jain@arm.com, weilin.chang@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, oupton@kernel.org, fuad.tabba@linux.dev, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, anshuman.khandual@arm.com, ryan.roberts@arm.com, david@kernel.org, matt@codeblueprint.co.uk, ardb@kernel.org, mark.rutland@arm.com, sebastianene@google.com, vdonnefort@google.com, sashiko-bot@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Sat, 25 Jul 2026 18:16:37 +0100, Dev Jain 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 > > Closes: https://lore.kernel.org/kvmarm/20260630122758.891011F00A3A@smtp.kernel.org/ > > Signed-off-by: Wei-Lin Chang > > --- > > 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.