kvm: stats: tell userspace which values are boolean
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2022 11:27:31 +0000 (07:27 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2022 12:01:59 +0000 (08:01 -0400)
commit1b870fa5573e260bc74d19f381ab0dd971a8d8e7
treeb69d78017e58e7d341c4d56603ce21d488d09c75
parent84e7051c0bc1f2a13101553959b3a9d9a8e24939
kvm: stats: tell userspace which values are boolean

Some of the statistics values exported by KVM are always only 0 or 1.
It can be useful to export this fact to userspace so that it can track
them specially (for example by polling the value every now and then to
compute a % of time spent in a specific state).

Therefore, add "boolean value" as a new "unit".  While it is not exactly
a unit, it walks and quacks like one.  In particular, using the type
would be wrong because boolean values could be instantaneous or peak
values (e.g. "is the rmap allocated?") or even two-bucket histograms
(e.g. "number of posted vs. non-posted interrupt injections").

Suggested-by: Amneesh Singh <natto@weirdnatto.in>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Documentation/virt/kvm/api.rst
arch/x86/kvm/x86.c
include/linux/kvm_host.h
include/uapi/linux/kvm.h