Re: [PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-08 Thread Paolo Bonzini
On 08/08/2017 10:31, Longpeng (Mike) wrote: > > > On 2017/8/8 15:30, Paolo Bonzini wrote: > >> On 08/08/2017 06:05, Longpeng(Mike) wrote: >>> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c >>> index cd0e6e6..dec5e8a 100644 >>> --- a/arch/x86/kvm/hyperv.c >>> +++

Re: [PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-08 Thread Paolo Bonzini
On 08/08/2017 10:31, Longpeng (Mike) wrote: > > > On 2017/8/8 15:30, Paolo Bonzini wrote: > >> On 08/08/2017 06:05, Longpeng(Mike) wrote: >>> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c >>> index cd0e6e6..dec5e8a 100644 >>> --- a/arch/x86/kvm/hyperv.c >>> +++

Re: [PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-08 Thread Longpeng (Mike)
On 2017/8/8 15:30, Paolo Bonzini wrote: > On 08/08/2017 06:05, Longpeng(Mike) wrote: >> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c >> index cd0e6e6..dec5e8a 100644 >> --- a/arch/x86/kvm/hyperv.c >> +++ b/arch/x86/kvm/hyperv.c >> @@ -1268,7 +1268,7 @@ int kvm_hv_hypercall(struct

Re: [PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-08 Thread Longpeng (Mike)
On 2017/8/8 15:30, Paolo Bonzini wrote: > On 08/08/2017 06:05, Longpeng(Mike) wrote: >> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c >> index cd0e6e6..dec5e8a 100644 >> --- a/arch/x86/kvm/hyperv.c >> +++ b/arch/x86/kvm/hyperv.c >> @@ -1268,7 +1268,7 @@ int kvm_hv_hypercall(struct

Re: [PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-08 Thread Paolo Bonzini
On 08/08/2017 06:05, Longpeng(Mike) wrote: > diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c > index cd0e6e6..dec5e8a 100644 > --- a/arch/x86/kvm/hyperv.c > +++ b/arch/x86/kvm/hyperv.c > @@ -1268,7 +1268,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) > > switch (code) { >

Re: [PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-08 Thread Paolo Bonzini
On 08/08/2017 06:05, Longpeng(Mike) wrote: > diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c > index cd0e6e6..dec5e8a 100644 > --- a/arch/x86/kvm/hyperv.c > +++ b/arch/x86/kvm/hyperv.c > @@ -1268,7 +1268,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) > > switch (code) { >

[PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-07 Thread Longpeng(Mike)
1. Implements the kvm_arch_vcpu_in_kernel(), because get_cpl requires vcpu_load, so we must cache the result(whether the vcpu was preempted when its cpl=0) in kvm_vcpu_arch. 2. Add ->spin_in_kernel hook, because we can get benefit from VMX. Signed-off-by: Longpeng(Mike)

[PATCH v2 2/4] KVM: X86: implement the logic for spinlock optimization

2017-08-07 Thread Longpeng(Mike)
1. Implements the kvm_arch_vcpu_in_kernel(), because get_cpl requires vcpu_load, so we must cache the result(whether the vcpu was preempted when its cpl=0) in kvm_vcpu_arch. 2. Add ->spin_in_kernel hook, because we can get benefit from VMX. Signed-off-by: Longpeng(Mike) ---