Skip to content

KVM: Refactor KVM stats macros to allow custom names

David Matlack kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: Consistently use "stat" name in stats macrosinclude/linux/kvm_host.h+26 -260 replies
2/5KVM: Spell out parameter names in stats macrosinclude/linux/kvm_host.h+73 -610 replies
3/5KVM: Fix indentation in stats macrosinclude/linux/kvm_host.h+13 -130 replies
4/5KVM: Allow custom names for statsinclude/linux/kvm_host.h+64 -401 reply
5/5KVM: x86: Drop union for pages_{4k,2m,1g} statsarch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c+4 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] KVM: Refactor KVM stats macros to allow custom names

This series refactors the KVM stats macros to allow specifying custom names, e.g.

STATS_DESC_COUNTER(VM, foo),
__STATS_DESC_COUNTER(VM, bar, "custom_name"),

Custom name makes it possible to decouple the userspace-visible stat names from their internal representation in C. This can allow future commits to refactor the various stats structs without impacting userspace tools that read KVM stats.

This also allows stats to be stored in data structures such as arrays, without needing unions to access specific stats. Case in point, the last patch in this series removes the pages_{4k,2m,1g} union, which is a useful cleanup to prepare for the Common MMU [1].

And for full transparency, another motivation for this series it that at Google we have several out-of-tree stats that use arrays. Custom name support is something we added internally and it reduces our technical debt to get the support merged upstream.

David Matlack (5):
KVM: Consistently use "stat" name in stats macros
KVM: Spell out parameter names in stats macros
KVM: Fix indentation in stats macros
KVM: Allow custom names for stats
KVM: x86: Drop union for pages_{4k,2m,1g} stats

 arch/x86/include/asm/kvm_host.h |   9 +-
 arch/x86/kvm/x86.c              |   6 +-
 include/linux/kvm_host.h        | 170 +++++++++++++++++++-------------
 3 files changed, 107 insertions(+), 78 deletions(-)

base-commit: de60733246ff4545a0483140c1f21426b8d7cb7f
prerequisite-patch-id: 42a76ce7cec240776c21f674e99e893a3a6bee58

Signature · 1 line
2.39.0.246.g2a6d74b583-goog