Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] KVM: Rework how halt-polling stats and per-VM debugfs use memory
@ 2026-11-16  3:27 Peng Hao
  2026-11-16  3:27 ` [RFC PATCH 1/3] KVM: Add the halt-polling time to the kvm_vcpu_wakeup tracepoint Peng Hao
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Peng Hao @ 2026-11-16  3:27 UTC (permalink / raw)
  To: pbonzini, seanjc; +Cc: kvm

This series replaces the halt-polling histogram Kconfig patch, as a first
step towards a general plan for KVM stats.

Take a VM with 8 vCPUs on x86.  Each vCPU has 1104 bytes of stats, 768 of
which are the three halt-polling histograms, i.e. 6KiB for the VM.  The VM
also gets ~95 debugfs entries (one file per stat, plus a directory and a few
files per vCPU), each costing a dentry and an inode, i.e. ~70KiB, all
duplicating the binary stats.

The plan:

 1. Counters stay embedded in the stats structs; they're cheap and
    monitoring wants them always on.

 2. Arrays and histograms move to a separately allocated block, controlled
    by kvm.extended_stats (default on).  The binary stats ABI doesn't change;
    the values read as zero if the block isn't allocated.  (patch 3)

 3. Debug-only data goes to tracepoints and is aggregated with BPF.  Adding
    the halt-polling time to kvm_vcpu_wakeup is enough to rebuild the three
    histograms.  (patch 1)

In addition, kvm.per_vm_debugfs (default on) allows skipping the per-VM
debugfs directories.  (patch 2)

With patch 3, struct vcpu_vmx shrinks from 8384 to 7616 bytes and struct
vcpu_svm from 6728 to 5968 bytes.

Peng Hao (3):
  KVM: Add the halt-polling time to the kvm_vcpu_wakeup tracepoint
  KVM: Add a module param to disable the per-VM debugfs directories
  KVM: Move the halt-polling histograms out of struct kvm_vcpu_stat

 .../admin-guide/kernel-parameters.txt         | 13 ++++
 arch/powerpc/kvm/book3s_hv.c                  | 11 ++-
 include/linux/kvm_host.h                      | 24 +++++-
 include/linux/kvm_types.h                     | 10 ++-
 include/trace/events/kvm.h                    | 16 ++--
 virt/kvm/binary_stats.c                       | 29 +++++++-
 virt/kvm/kvm_main.c                           | 73 +++++++++++++++----
 7 files changed, 144 insertions(+), 32 deletions(-)

-- 
2.43.7


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-16  3:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16  3:27 [RFC PATCH 0/3] KVM: Rework how halt-polling stats and per-VM debugfs use memory Peng Hao
2026-11-16  3:27 ` [RFC PATCH 1/3] KVM: Add the halt-polling time to the kvm_vcpu_wakeup tracepoint Peng Hao
2026-11-16  3:27 ` [RFC PATCH 2/3] KVM: Add a module param to disable the per-VM debugfs directories Peng Hao
2026-11-16  3:43   ` sashiko-bot
2026-11-16  3:27 ` [RFC PATCH 3/3] KVM: Move the halt-polling histograms out of struct kvm_vcpu_stat Peng Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox