[Devel,RHEL7,COMMIT] kvm/x86: do not clear hyperv synic pages when setting MSRs

Submitted by Konstantin Khorenko on April 13, 2017, 9:13 a.m.

Details

Message ID 201704130913.v3D9D1UX004496@finist_cl7.x64_64.work.ct
State New
Series "kvm/x86: do not clear hyperv synic pages when setting MSRs"
Headers show

Commit Message

Konstantin Khorenko April 13, 2017, 9:13 a.m.
The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.15
------>
commit fb03ad578cab3cab8904079ec687e76e4da8f3d8
Author: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
Date:   Thu Apr 13 13:13:01 2017 +0400

    kvm/x86: do not clear hyperv synic pages when setting MSRs
    
    Existing code resets guest synic message and event flag pages to zero
    when guest or host updates their guest PAs by writing to corresponding
    MSRs.
    
    This turned out to be a problem for migration code when guest had a
    SYNIC irq to inject before suspending. After resuming qemu resets MSRs to
    saved values and KVM zeroes out migrated guest memory as a side effect.
    Following that guest sees an IRQ but doesn't see any event flags in event
    flags page, skips this IRQ and hangs indefinitely.
    
    This memory is owned by guest so let us not assume any additional
    responsibility for it and remove zero out calls, which also fixes
    failing migration scenario described above.
    
    https://jira.sw.ru/browse/PSBM-63164
    
    Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
    Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
---
 arch/x86/kvm/hyperv.c | 12 ------------
 1 file changed, 12 deletions(-)

Patch hide | download patch | download mbox

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index eae314b..563c54fb 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -219,23 +219,11 @@  static int synic_set_msr(struct kvm_vcpu_hv_synic *synic,
 		synic->version = data;
 		break;
 	case HV_X64_MSR_SIEFP:
-		if (data & HV_SYNIC_SIEFP_ENABLE)
-			if (kvm_clear_guest(vcpu->kvm,
-					    data & PAGE_MASK, PAGE_SIZE)) {
-				ret = 1;
-				break;
-			}
 		synic->evt_page = data;
 		if (!host)
 			synic_exit(synic, msr);
 		break;
 	case HV_X64_MSR_SIMP:
-		if (data & HV_SYNIC_SIMP_ENABLE)
-			if (kvm_clear_guest(vcpu->kvm,
-					    data & PAGE_MASK, PAGE_SIZE)) {
-				ret = 1;
-				break;
-			}
 		synic->msg_page = data;
 		if (!host)
 			synic_exit(synic, msr);