• Jing Zhang's avatar
    KVM: stats: Add documentation for binary statistics interface · fdc09ddd
    Jing Zhang authored
    This new API provides a file descriptor for every VM and VCPU to read
    KVM statistics data in binary format.
    It is meant to provide a lightweight, flexible, scalable and efficient
    lock-free solution for user space telemetry applications to pull the
    statistics data periodically for large scale systems. The pulling
    frequency could be as high as a few times per second.
    The statistics descriptors are defined by KVM in kernel and can be
    by userspace to discover VM/VCPU statistics during the one-time setup
    stage.
    The statistics data itself could be read out by userspace telemetry
    periodically without any extra parsing or setup effort.
    There are a few existed interface protocols and definitions, but no
    one can fulfil all the requirements this interface implemented as
    below:
    1. During high frequency periodic stats reading, there should be no
       extra efforts except the stats data read itself.
    2. Support stats annotation, like type (cumulative, instantaneous,
       peak, histogram, etc) and unit (counter, time, size, cycles, etc).
    3. The stats data reading should be free of lock/synchronization. We
       don't care about the consistency between all the stats data. All
       stats data can not be read out at exactly the same time. We really
       care about the change or trend of the stats data. The lock-free
       solution is not just for efficiency and scalability, also for the
       stats data accuracy and usability. For example, in the situation
       that all the stats data readings are protected by a global lock,
       if one VCPU died somehow with that lock held, then all stats data
       reading would be blocked, then we have no way from stats data that
       which VCPU has died.
    4. The stats data reading workload can be handed over to other
       unprivileged process.
    Reviewed-by: default avatarDavid Matlack <dmatlack@google.com>
    Reviewed-by: default avatarRicardo Koller <ricarkol@google.com>
    Reviewed-by: default avatarKrish Sadhukhan <krish.sadhukhan@oracle.com>
    Reviewed-by: default avatarFuad Tabba <tabba@google.com>
    Signed-off-by: default avatarJing Zhang <jingzhangos@google.com>
    Message-Id: <20210618222709.1858088-6-jingzhangos@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    fdc09ddd
api.rst 238 KB