• Sean Christopherson's avatar
    KVM: Reconcile discrepancies in halt-polling stats · 30c94347
    Sean Christopherson authored
    Move the halt-polling "success" and histogram stats update into the
    dedicated helper to fix a discrepancy where the success/fail "time" stats
    consider polling successful so long as the wait is avoided, but the main
    "success" and histogram stats consider polling successful if and only if
    a wake event was detected by the halt-polling loop.
    
    Move halt_attempted_poll to the helper as well so that all the stats are
    updated in a single location.  While it's a bit odd to update the stat
    well after the fact, practically speaking there's no meaningful advantage
    to updating before polling.
    
    Note, there is a functional change in addition to the success vs. fail
    change.  The histogram updates previously called ktime_get() instead of
    using "cur".  But that change is desirable as it means all the stats are
    now updated with the same polling time, and avoids the extra ktime_get(),
    which isn't expensive but isn't free either.
    Reviewed-by: default avatarDavid Matlack <dmatlack@google.com>
    Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
    Message-Id: <20211009021236.4122790-8-seanjc@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    30c94347
kvm_main.c 143 KB