[Devel] [PATCH vz7.46 3/7] kvm: x86: factor out kvm.arch.hyperv (de)init

2018-04-10 Thread Roman Kagan
Move kvm.arch.hyperv initialization and cleanup to separate functions. For now only a mutex is inited in the former, and the latter is empty; more stuff will go in there in a followup patch. Signed-off-by: Roman Kagan Reviewed-by: David Hildenbrand

[Devel] [PATCH vz7.46 2/7] KVM: x86: cleanup the page tracking SRCU instance

2018-04-10 Thread Roman Kagan
From: Paolo Bonzini SRCU uses a delayed work item. Skip cleaning it up, and the result is use-after-free in the work item callbacks. Reported-by: Dmitry Vyukov Suggested-by: Dmitry Vyukov Cc: sta...@vger.kernel.org Fixes:

[Devel] [PATCH vz7.46 6/7] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-04-10 Thread Roman Kagan
From: Vitaly Kuznetsov Hyper-V 2016 on KVM with SynIC enabled doesn't boot with the following trace: kvm_entry:vcpu 0 kvm_exit: reason MSR_WRITE rip 0xf8000131c1e5 info 0 0 kvm_hv_synic_set_msr: vcpu_id 0 msr 0x4090 data 0x1

[Devel] [PATCH vz7.46 0/7] assorted hyperv-related backports

2018-04-10 Thread Roman Kagan
A few commits backported from mainline kernel related to hyperv emulation: a feature to allow to accelerate hyperv device emulation in QEMU, several prerequisite patches, and some bugfixes. Dan Carpenter (1): kvm: x86: hyperv: delete dead code in kvm_hv_hypercall() Paolo Bonzini (2): KVM:

[Devel] [PATCH vz7.46 4/7] kvm: x86: hyperv: guest->host event signaling via eventfd

2018-04-10 Thread Roman Kagan
In Hyper-V, the fast guest->host notification mechanism is the SIGNAL_EVENT hypercall, with a single parameter of the connection ID to signal. Currently this hypercall incurs a user exit and requires the userspace to decode the parameters and trigger the notification of the potentially different

[Devel] [PATCH vz7.46 1/7] KVM: hyperv: fix locking of struct kvm_hv fields

2018-04-10 Thread Roman Kagan
From: Paolo Bonzini Introduce a new mutex to avoid an AB-BA deadlock between kvm->lock and vcpu->mutex. Protect accesses in kvm_hv_setup_tsc_page too, as suggested by Roman. Reported-by: Dmitry Vyukov Reviewed-by: Roman Kagan

[Devel] [PATCH vz7.46 7/7] kvm: x86: hyperv: delete dead code in kvm_hv_hypercall()

2018-04-10 Thread Roman Kagan
From: Dan Carpenter "rep_done" is always zero so the "(((u64)rep_done & 0xfff) << 32)" expression is just zero. We can remove the "res" temporary variable as well and just use "ret" directly. Signed-off-by: Dan Carpenter Signed-off-by: Paolo

[Devel] [PATCH vz7.46 5/7] x86/kvm/hyper-v: remove stale entries from vec_bitmap/auto_eoi_bitmap on vector change

2018-04-10 Thread Roman Kagan
From: Vitaly Kuznetsov When a new vector is written to SINx we update vec_bitmap/auto_eoi_bitmap but we forget to remove old vector from these masks (in case it is not present in some other SINTx). Signed-off-by: Vitaly Kuznetsov Reviewed-by: Roman