* [PATCH v2] KVM: nVMX: fixes for preemption timer migration
@ 2020-07-09 17:28 Paolo Bonzini
2020-07-10 9:05 ` Stefano Garzarella
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2020-07-09 17:28 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: Makarand Sonare, Jim Mattson
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.
Cc: Makarand Sonare <makarandsonare@google.com>
Fixes: 850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration")
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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(-)
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index 17c5a038f42d..0780f97c1850 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -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 {
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index b26655104d4a..d4a4cec034d0 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -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 =
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM: nVMX: fixes for preemption timer migration
2020-07-09 17:28 [PATCH v2] KVM: nVMX: fixes for preemption timer migration Paolo Bonzini
@ 2020-07-10 9:05 ` Stefano Garzarella
2020-07-10 9:27 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Garzarella @ 2020-07-10 9:05 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, Makarand Sonare, Jim Mattson
Hi Paolo,
On Thu, Jul 09, 2020 at 01:28:01PM -0400, Paolo Bonzini wrote:
> 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.
>
> Cc: Makarand Sonare <makarandsonare@google.com>
> Fixes: 850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration")
> Reviewed-by: Jim Mattson <jmattson@google.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> 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(-)
>
> diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
> index 17c5a038f42d..0780f97c1850 100644
> --- a/arch/x86/include/uapi/asm/kvm.h
> +++ b/arch/x86/include/uapi/asm/kvm.h
> @@ -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;
> };
>
Should we update also Documentation/virt/kvm/api.rst to be consistent?
Thanks,
Stefano
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM: nVMX: fixes for preemption timer migration
2020-07-10 9:05 ` Stefano Garzarella
@ 2020-07-10 9:27 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-07-10 9:27 UTC (permalink / raw)
To: Stefano Garzarella; +Cc: linux-kernel, kvm, Makarand Sonare, Jim Mattson
On 10/07/20 11:05, Stefano Garzarella wrote:
> Hi Paolo,
>
> On Thu, Jul 09, 2020 at 01:28:01PM -0400, Paolo Bonzini wrote:
>> 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.
>>
>> Cc: Makarand Sonare <makarandsonare@google.com>
>> Fixes: 850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration")
>> Reviewed-by: Jim Mattson <jmattson@google.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> 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(-)
>>
>> diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
>> index 17c5a038f42d..0780f97c1850 100644
>> --- a/arch/x86/include/uapi/asm/kvm.h
>> +++ b/arch/x86/include/uapi/asm/kvm.h
>> @@ -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;
>> };
>>
>
> Should we update also Documentation/virt/kvm/api.rst to be consistent?
Yes, of course. Thanks for pointing it out.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-10 9:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 17:28 [PATCH v2] KVM: nVMX: fixes for preemption timer migration Paolo Bonzini
2020-07-10 9:05 ` Stefano Garzarella
2020-07-10 9:27 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).