RFC KVM: Rework how halt-polling stats and per-VM debugfs use memory
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 RFC Latest4 patches 0 repliesNew
- v1 RFC3 patches 0 repliesSuperseded
Changes in v2 from the cover letter
- Add patch 2, fixing nested_mmu* ptdump files being created in the debugfs root and left dangling when the VM has no debugfs directory (reported by Sashiko AI review).
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | KVM: Add the halt-polling time to the kvm_vcpu_wakeup tracepointinclude/ virt/ | +11 | 0 replies | |
| 2/4 | KVM: arm64: nv: Skip nested stage-2 ptdump files without a debugfs dirarch/ | +4 | 0 replies | |
| 3/4 | KVM: Add a module param to disable the per-VM debugfs directoriesDocumentation/ virt/ | +17 | 0 replies | |
| 4/4 | KVM: Move the halt-polling histograms out of struct kvm_vcpu_statDocumentation/ arch/ include/ +3 more | +116 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [RFC PATCH v2 0/4] KVM: Rework how halt-polling stats and per-VM debugfs use memory
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 4)
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 3) Patch 2 fixes an arm64 bug that this makes easy to hit: nested stage-2 ptdump files end up in the debugfs root if the VM has no debugfs directory.
With patch 4, struct vcpu_vmx shrinks from 8384 to 7616 bytes and struct vcpu_svm from 6728 to 5968 bytes.
Tested on Intel with KVM selftests in all three configurations (default, kvm.extended_stats=0, kvm.per_vm_debugfs=0). Build-tested on powerpc and arm64.
v2:
- Add patch 2, fixing nested_mmu* ptdump files being created in the debugfs root and left dangling when the VM has no debugfs directory (reported by Sashiko AI review).
Peng Hao (4):
KVM: Add the halt-polling time to the kvm_vcpu_wakeup tracepoint
KVM: arm64: nv: Skip nested stage-2 ptdump files without a debugfs dir
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/arm64/kvm/ptdump.c | 4 + 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 +++++++++++++++---- 8 files changed, 148 insertions(+), 32 deletions(-)
base-commit: d21eef2084a9af87ac2a783bc7c2b175ba114e4e
Signature · 1 line
2.43.7