Thread (3 messages) 3 messages, 2 authors, 2025-03-04

Re: [PATCH] KVM: arm64: Count pKVM stage-2 usage in secondary pagetable stats

From: Oliver Upton <hidden>
Date: 2025-03-03 21:18:49
Also in: kvmarm, lkml

On Fri, Feb 28, 2025 at 12:13:55PM +0000, Vincent Donnefort wrote:
quoted hunk ↗ jump to hunk
Count the pages used by pKVM for the guest stage-2 in memory stats under
secondary pagetable stats, similarly to what the VHE mode does.

Signed-off-by: Vincent Donnefort <redacted>
diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
index 1f55b0c7b11d..c2e022c41313 100644
--- a/arch/arm64/kvm/mmu.c
+++ b/arch/arm64/kvm/mmu.c
@@ -1088,12 +1088,18 @@ void kvm_free_stage2_pgd(struct kvm_s2_mmu *mmu)
 
 static void hyp_mc_free_fn(void *addr, void *unused)
 {
+	kvm_account_pgtable_pages(addr, -1);
 	free_page((unsigned long)addr);
 }
Don't we drain more than just stage-2 page tables into the teardown_mc
(e.g. vcpu structs)?

Thanks,
Oliver
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help