KVM: nVMX: fixes for preemption timer migration
Paolo Bonzini
maintainerPATCH v2 1/1 KVM: nVMX: fixes for preemption timer migration
Commit 850448f35aaf ("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.
---v1->v2: coding style [Jim]
arch/x86/include/uapi/asm/kvm.h | 5 +++-- arch/x86/kvm/vmx/nested.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/include/uapi/asm/kvm.h +3 -2
@@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data { };struct kvm_vmx_nested_state_hdr { -__u32 flags;__u64 vmxon_pa;__u64 vmcs12_pa; -__u64 preemption_timer_deadline;struct {__u16 flags; } smm; + +__u32 flags; +__u64 preemption_timer_deadline; };struct kvm_svm_nested_state_data {
arch/x86/kvm/vmx/nested.c +1 -0
@@ -6176,6 +6176,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, goto error_guest_mode; } + vmx->nested.has_preemption_timer_deadline = false;if (kvm_state->hdr.vmx.flags &KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE ) { vmx->nested.has_preemption_timer_deadline = true; vmx->nested.preemption_timer_deadline =
Signature · 1 line
2.26.2
Hi Paolo,
Quoted 28 lines · Paolo Bonzini
Commit
850448f35aaf("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 thatvmx->nested.has_preemption_timer_deadlineis always initialized according to theKVM_STATE_VMX_PREEMPTION_TIMER_DEADLINEflag.Cc Makarand Sonare <[email protected]>Fixes 850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration")Reviewed-by Jim Mattson <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>---
v1->v2: coding style [Jim]arch/x86/include/uapi/asm/kvm.h | 5 +++-- arch/x86/kvm/vmx/nested.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)arch/x86/include/uapi/asm/kvm.h +0
-1@@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data { };struct kvm_vmx_nested_state_hdr { -__u32 flags;__u64 vmxon_pa;__u64 vmcs12_pa;
arch/x86/include/uapi/asm/kvm.h struct kvm_vmx_nested_state_data { · line 421
Quoted 10 lines
arch/x86/include/uapi/asm/kvm.h +3
-1-__u64 preemption_timer_deadline;struct {__u16 flags; } smm; + +__u32 flags; +__u64 preemption_timer_deadline; };
Should we update also Documentation/virt/kvm/api.rst to be consistent?
Thanks,
Stefano
Paolo Bonzini
maintainerQuoted 33 lines · Stefano Garzarella
Hi Paolo,
Quoted 30 lines · Paolo Bonzini
Commit
850448f35aaf("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 thatvmx->nested.has_preemption_timer_deadlineis always initialized according to theKVM_STATE_VMX_PREEMPTION_TIMER_DEADLINEflag.Cc Makarand Sonare <[email protected]>Fixes 850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration")Reviewed-by Jim Mattson <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>---
v1->v2: coding style [Jim]arch/x86/include/uapi/asm/kvm.h | 5 +++-- arch/x86/kvm/vmx/nested.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)arch/x86/include/uapi/asm/kvm.h +0
-2@@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data { };struct kvm_vmx_nested_state_hdr { -__u32 flags;__u64 vmxon_pa;__u64 vmcs12_pa; -__u64 preemption_timer_deadline;
Quoted 10 lines
arch/x86/include/uapi/asm/kvm.h struct kvm_vmx_nested_state_data { · line 421
Quoted 8 lines
arch/x86/include/uapi/asm/kvm.h +3
-0struct {__u16 flags; } smm; + +__u32 flags; +__u64 preemption_timer_deadline; };Should we update also
Documentation/virt/kvm/api.rstto be consistent?
Yes, of course. Thanks for pointing it out.
Paolo