• Roman Kagan's avatar
    x86: kvm: hyperv: simplify SynIC message delivery · 3a0e7731
    Roman Kagan authored
    SynIC message delivery is somewhat overengineered: it pretends to follow
    the ordering rules when grabbing the message slot, using atomic
    operations and all that, but does it incorrectly and unnecessarily.
    
    The correct order would be to first set .msg_pending, then atomically
    replace .message_type if it was zero, and then clear .msg_pending if
    the previous step was successful.  But this all is done in vcpu context
    so the whole update looks atomic to the guest (it's assumed to only
    access the message page from this cpu), and therefore can be done in
    whatever order is most convenient (and is also the reason why the
    incorrect order didn't trigger any bugs so far).
    
    While at this, also switch to kvm_vcpu_{read,write}_guest_page, and drop
    the no longer needed synic_clear_sint_msg_pending.
    Signed-off-by: default avatarRoman Kagan <rkagan@virtuozzo.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    3a0e7731
hyperv.c 45.5 KB