]> git.baikalelectronics.ru Git - kernel.git/commit
x86: kvm: hyperv: simplify SynIC message delivery
authorRoman Kagan <rkagan@virtuozzo.com>
Mon, 10 Dec 2018 18:47:26 +0000 (18:47 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Dec 2018 16:59:51 +0000 (17:59 +0100)
commit5da6757ab860853743ec4321a7c6467ac6c50596
treec9703c6b051d56c8af3b5a3c71a1d4183e8a4432
parent42e3716562f8287585238cf16a59d4da5c9dbb24
x86: kvm: hyperv: simplify SynIC message delivery

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: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/hyperv.c