Skip to content

Commit 83d31e5

Browse files
committed
KVM: nVMX: fixes for preemption timer migration
Commit 850448f ("KVM: nVMX: Fix VMX preemption timer migration", 2020-06-01) accidentally broke nVMX live migration from older version by changing the userspace ABI. Restore it and, while at it, ensure that vmx->nested.has_preemption_timer_deadline is always initialized according to the KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE flag. Cc: Makarand Sonare <[email protected]> Fixes: 850448f ("KVM: nVMX: Fix VMX preemption timer migration") Reviewed-by: Jim Mattson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 8038a92 commit 83d31e5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4339,14 +4339,15 @@ Errors:
43394339
#define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
43404340

43414341
struct kvm_vmx_nested_state_hdr {
4342-
__u32 flags;
43434342
__u64 vmxon_pa;
43444343
__u64 vmcs12_pa;
4345-
__u64 preemption_timer_deadline;
43464344

43474345
struct {
43484346
__u16 flags;
43494347
} smm;
4348+
4349+
__u32 flags;
4350+
__u64 preemption_timer_deadline;
43504351
};
43514352

43524353
struct kvm_vmx_nested_state_data {

arch/x86/include/uapi/asm/kvm.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data {
408408
};
409409

410410
struct kvm_vmx_nested_state_hdr {
411-
__u32 flags;
412411
__u64 vmxon_pa;
413412
__u64 vmcs12_pa;
414-
__u64 preemption_timer_deadline;
415413

416414
struct {
417415
__u16 flags;
418416
} smm;
417+
418+
__u32 flags;
419+
__u64 preemption_timer_deadline;
419420
};
420421

421422
struct kvm_svm_nested_state_data {

arch/x86/kvm/vmx/nested.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6176,6 +6176,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
61766176
goto error_guest_mode;
61776177
}
61786178

6179+
vmx->nested.has_preemption_timer_deadline = false;
61796180
if (kvm_state->hdr.vmx.flags & KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE) {
61806181
vmx->nested.has_preemption_timer_deadline = true;
61816182
vmx->nested.preemption_timer_deadline =

0 commit comments

Comments
 (0)