diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2012-08-03 14:57:49 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2012-08-13 15:10:45 -0400 |
commit | 51d59c6b422f3f95940ae4e5b42f165595906aee (patch) | |
tree | dc1afa1f084c78b09af2dc829a5bfda8cfa00a0c /arch/x86/kvm/x86.c | |
parent | 64eb0620296f924d5fded755c5ed95fb73649e06 (diff) |
KVM: x86: fix pvclock guest stopped flag reporting
kvm_guest_time_update unconditionally clears hv_clock.flags field,
so the notification never reaches the guest.
Fix it by allowing PVCLOCK_GUEST_STOPPED to passthrough.
Reviewed-by: Eric B Munson <emunson@mgebm.net>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 91a595827deb..fb0d93788bfb 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1134,6 +1134,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1134 | unsigned long this_tsc_khz; | 1134 | unsigned long this_tsc_khz; |
1135 | s64 kernel_ns, max_kernel_ns; | 1135 | s64 kernel_ns, max_kernel_ns; |
1136 | u64 tsc_timestamp; | 1136 | u64 tsc_timestamp; |
1137 | u8 pvclock_flags; | ||
1137 | 1138 | ||
1138 | /* Keep irq disabled to prevent changes to the clock */ | 1139 | /* Keep irq disabled to prevent changes to the clock */ |
1139 | local_irq_save(flags); | 1140 | local_irq_save(flags); |
@@ -1215,7 +1216,14 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1215 | vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; | 1216 | vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; |
1216 | vcpu->last_kernel_ns = kernel_ns; | 1217 | vcpu->last_kernel_ns = kernel_ns; |
1217 | vcpu->last_guest_tsc = tsc_timestamp; | 1218 | vcpu->last_guest_tsc = tsc_timestamp; |
1218 | vcpu->hv_clock.flags = 0; | 1219 | |
1220 | pvclock_flags = 0; | ||
1221 | if (vcpu->pvclock_set_guest_stopped_request) { | ||
1222 | pvclock_flags |= PVCLOCK_GUEST_STOPPED; | ||
1223 | vcpu->pvclock_set_guest_stopped_request = false; | ||
1224 | } | ||
1225 | |||
1226 | vcpu->hv_clock.flags = pvclock_flags; | ||
1219 | 1227 | ||
1220 | /* | 1228 | /* |
1221 | * The interface expects us to write an even number signaling that the | 1229 | * The interface expects us to write an even number signaling that the |
@@ -2624,10 +2632,9 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu, | |||
2624 | */ | 2632 | */ |
2625 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) | 2633 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) |
2626 | { | 2634 | { |
2627 | struct pvclock_vcpu_time_info *src = &vcpu->arch.hv_clock; | ||
2628 | if (!vcpu->arch.time_page) | 2635 | if (!vcpu->arch.time_page) |
2629 | return -EINVAL; | 2636 | return -EINVAL; |
2630 | src->flags |= PVCLOCK_GUEST_STOPPED; | 2637 | vcpu->arch.pvclock_set_guest_stopped_request = true; |
2631 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); | 2638 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); |
2632 | return 0; | 2639 | return 0; |
2633 | } | 2640 | } |