• Andrey Smetanin's avatar
    kvm/x86: Remove Hyper-V SynIC timer stopping · 481d2bcc
    Andrey Smetanin authored
    It's possible that guest send us Hyper-V EOM at the middle
    of Hyper-V SynIC timer running, so we start processing of Hyper-V
    SynIC timers in vcpu context and stop the Hyper-V SynIC timer
    unconditionally:
    
        host                                       guest
        ------------------------------------------------------------------------------
                                               start periodic stimer
        start periodic timer
        timer expires after 15ms
        send expiration message into guest
        restart periodic timer
        timer expires again after 15 ms
        msg slot is still not cleared so
        setup ->msg_pending
    (1) restart periodic timer
                                               process timer msg and clear slot
                                               ->msg_pending was set:
                                                   send EOM into host
        received EOM
          kvm_make_request(KVM_REQ_HV_STIMER)
    
        kvm_hv_process_stimers():
            ...
            stimer_stop()
            if (time_now >= stimer->exp_time)
                    stimer_expiration(stimer);
    
    Because the timer was rearmed at (1), time_now < stimer->exp_time
    and stimer_expiration is not called.  The timer then never fires.
    
    The patch fixes such situation by not stopping Hyper-V SynIC timer
    at all, because it's safe to restart it without stop in vcpu context
    and timer callback always returns HRTIMER_NORESTART.
    Signed-off-by: default avatarAndrey Smetanin <asmetanin@virtuozzo.com>
    CC: Gleb Natapov <gleb@kernel.org>
    CC: Paolo Bonzini <pbonzini@redhat.com>
    CC: Roman Kagan <rkagan@virtuozzo.com>
    CC: Denis V. Lunev <den@openvz.org>
    CC: qemu-devel@nongnu.org
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    481d2bcc
hyperv.c 26.5 KB