From: Marc Zyngier <maz@kernel.org>
To: Yoan Picchi <yoan.picchi@arm.com>
Cc: james.morse@arm.com, julien.thierry.kdev@gmail.com,
suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, catalin.marinas@arm.com,
will@kernel.org
Subject: Re: [PATCH 5/7] KVM: arm64: Add memory_slot_unmaped counter for kvm_stat
Date: Tue, 23 Mar 2021 17:33:04 +0000 [thread overview]
Message-ID: <87o8f9kc6n.wl-maz@kernel.org> (raw)
In-Reply-To: <20210319161711.24972-6-yoan.picchi@arm.com>
On Fri, 19 Mar 2021 16:17:09 +0000,
Yoan Picchi <yoan.picchi@arm.com> wrote:
>
> Add a counter for when a memory slot is unmapped, meaning that all
> memory belonging to a specific VM is made available to be mapped for
> anoother VM.
No. It just means it is unmapped from the guest. The VMM still has the
pages.
> A memory slot is the memory that can be used to hold a
> guest's pages and can be made available by Qemu for instance. For
> now the memory slot are only unmapped when a vm restarts.
>
> Signed-off-by: Yoan Picchi <yoan.picchi@arm.com>
> ---
> arch/arm64/include/asm/kvm_host.h | 1 +
> arch/arm64/kvm/guest.c | 1 +
> arch/arm64/kvm/mmu.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index e6967951f..76c81aa79 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -548,6 +548,7 @@ static inline bool __vcpu_write_sys_reg_to_cpu(u64 val, int reg)
> struct kvm_vm_stat {
> ulong remote_tlb_flush;
> ulong flush_all_cache_lines;
> + ulong memory_slot_unmaped;
> ulong cached_page_invalidated;
> };
>
> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
> index d948c3bd2..cd227136e 100644
> --- a/arch/arm64/kvm/guest.c
> +++ b/arch/arm64/kvm/guest.c
> @@ -42,6 +42,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
> VCPU_STAT("huge_page_mapped", huge_page_mapped),
> VM_STAT("remote_tlb_flush", remote_tlb_flush),
> VM_STAT("flush_all_cache_lines", flush_all_cache_lines),
> + VM_STAT("memory_slot_unmaped", memory_slot_unmaped),
> VM_STAT("cached_page_invalidated", cached_page_invalidated),
> VCPU_STAT("exits", exits),
> VCPU_STAT("halt_poll_success_ns", halt_poll_success_ns),
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 985b048df..1e8aeafc2 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -419,6 +419,7 @@ static void stage2_unmap_memslot(struct kvm *kvm,
> phys_addr_t addr = memslot->base_gfn << PAGE_SHIFT;
> phys_addr_t size = PAGE_SIZE * memslot->npages;
> hva_t reg_end = hva + size;
> + kvm->stat.memory_slot_unmaped++;
Why is that a relevant thing to track? You even increment the counter
before even checking whether this will unmap anything... :-(
M.
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-03-23 17:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 16:17 [PATCH 0/7] KVM: arm64: add more event counters for kvm_stat Yoan Picchi
2021-03-19 16:17 ` [PATCH 1/7] KVM: arm64: Add two page mapping " Yoan Picchi
2021-03-23 11:52 ` Keqian Zhu
2021-03-23 17:03 ` Marc Zyngier
2021-03-19 16:17 ` [PATCH 2/7] KVM: arm64: Add remote_tlb_flush counter " Yoan Picchi
2021-03-23 17:12 ` Marc Zyngier
2021-03-19 16:17 ` [PATCH 3/7] KVM: arm64: Add cached_page_invalidated " Yoan Picchi
2021-03-23 17:17 ` Marc Zyngier
2021-03-19 16:17 ` [PATCH 4/7] KVM: arm64: Add flush_all_cache_lines " Yoan Picchi
2021-03-23 17:22 ` Marc Zyngier
2021-03-19 16:17 ` [PATCH 5/7] KVM: arm64: Add memory_slot_unmaped " Yoan Picchi
2021-03-23 17:33 ` Marc Zyngier [this message]
2021-03-19 16:17 ` [PATCH 6/7] KVM: arm64: Add stage2_unmap_vm " Yoan Picchi
2021-03-23 17:33 ` Marc Zyngier
2021-03-19 16:17 ` [PATCH 7/7] KVM: arm64: Add irq_inject " Yoan Picchi
2021-03-23 17:37 ` Marc Zyngier
2021-03-23 17:53 ` Yoan Picchi
2021-03-23 18:36 ` Marc Zyngier
2021-03-23 18:04 ` [PATCH 0/7] KVM: arm64: add more event counters " Marc Zyngier
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=87o8f9kc6n.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yoan.picchi@arm.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;
as well as URLs for NNTP newsgroup(s).