STRUCT KVM_STATS_DESC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct kvm_stats_desc(9) ✨

okay bestie so this is a page from the Kernel API Manual and it's literally all about struct kvm_stats_desc β€” the Descriptor of a KVM statistics. yes, a statistics, that's what the manpage says, we don't question the manpage πŸ’… it's giving "small struct, big responsibilities."


🌸 NAME 🌸

struct kvm_stats_desc β€” Descriptor of a KVM statistics. that's it, that's the whole job description πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct kvm_stats_desc {
    __u32 flags;
    __s16 exponent;
    __u16 size;
    __u32 offset;
    __u32 bucket_size;
  #ifdef __KERNEL__;
    char name[KVM_STATS_NAME_SIZE];
  #else;
    char name[];
  #endif;
};

no cap, copy it exactly like that, semicolons after the preprocessor lines and all β€” that's what the original says and we are not out here editing the source, periodt πŸ”₯


πŸ‘‘ Members πŸ‘‘

  • flags β€” the annotations of the stats, like type, unit, etc. basically the little vibe check labels so everyone knows what kind of stat this is ✨
  • exponent β€” used together with flags to determine the unit. dynamic duo energy, they work as a team 🫢
  • size β€” the number of data items for this stats. and every single data item is of type __u64, so plan accordingly πŸ’–
  • offset β€” the offset of the stats to the start of stat structure in structure kvm or kvm_vcpu. yes, it's a whole "where do I even sit" situation πŸͺ‘
  • bucket_size β€” a parameter value used for histogram stats. it is only used for linear histogram stats, specifying the size of the bucket; lowkey a niche queen but iconic in her lane πŸ“
  • name β€” the name string for the stats. its size is indicated by the kvm_stats_header->name_size. πŸŽ€
  • name β€” the name string for the stats. its size is indicated by the kvm_stats_header->name_size. yeah bestie it's listed twice in the original, i'm not gonna gaslight you and pretend it isn't 😭 twice! we respect the duplication πŸ’€

🧚 SEE ALSO 🧚

  • Kernel file ./tools/include/uapi/linux/kvm.h
  • struct kvm_stats_header(9)

like, go read those too, iykyk πŸ“š


🌈 tiny reminder: the name field is sized differently depending on whether you're in __KERNEL__ or not β€” char name[KVM_STATS_NAME_SIZE] inside the kernel, flexible char name[] outside. the #ifdef says it all, no notes πŸ’œ

and that's the page!! ty for coming to my ted talk, go forth and describe your KVM stats with confidence πŸ’…πŸ¦‹βœ¨

β€” with love, from ./tools/include/uapi/linux, October 2026 πŸŽ€

πŸ“¦ where this page comes from