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

2017-08-07 Thread Paolo Bonzini
On 07/08/2017 14:28, Longpeng(Mike) wrote: > * kvm_arch_spin_in_kernel() returns whether the vcpu (which exits due to > spinlock) is CPL=0. It only be called by kvm_vcpu_on_spin(), and the > input vcpu is 'me' which get a PAUSE exit now. * > > I split kvm_arch_vcpu_in_kernel(in RFC) into two

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

2017-08-07 Thread Paolo Bonzini
On 07/08/2017 14:28, Longpeng(Mike) wrote: > * kvm_arch_spin_in_kernel() returns whether the vcpu (which exits due to > spinlock) is CPL=0. It only be called by kvm_vcpu_on_spin(), and the > input vcpu is 'me' which get a PAUSE exit now. * > > I split kvm_arch_vcpu_in_kernel(in RFC) into two

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

2017-08-07 Thread Longpeng(Mike)
On 08/07/2017 06:45 PM, Paolo Bonzini wrote: On 07/08/2017 10:44, Longpeng(Mike) wrote: + + /* +* Intel sdm vol3 ch-25.1.3 says: The “PAUSE-loop exiting” +* VM-execution control is ignored if CPL > 0. So the vcpu +* is always exiting with CPL=0 if it uses PLE.

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

2017-08-07 Thread Longpeng(Mike)
On 08/07/2017 06:45 PM, Paolo Bonzini wrote: On 07/08/2017 10:44, Longpeng(Mike) wrote: + + /* +* Intel sdm vol3 ch-25.1.3 says: The “PAUSE-loop exiting” +* VM-execution control is ignored if CPL > 0. So the vcpu +* is always exiting with CPL=0 if it uses PLE.

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

2017-08-07 Thread Paolo Bonzini
On 07/08/2017 10:44, Longpeng(Mike) wrote: > + > + /* > + * Intel sdm vol3 ch-25.1.3 says: The “PAUSE-loop exiting” > + * VM-execution control is ignored if CPL > 0. So the vcpu > + * is always exiting with CPL=0 if it uses PLE. This is not true (how can it be?). What 25.1.3

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

2017-08-07 Thread Paolo Bonzini
On 07/08/2017 10:44, Longpeng(Mike) wrote: > + > + /* > + * Intel sdm vol3 ch-25.1.3 says: The “PAUSE-loop exiting” > + * VM-execution control is ignored if CPL > 0. So the vcpu > + * is always exiting with CPL=0 if it uses PLE. This is not true (how can it be?). What 25.1.3

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

2017-08-07 Thread Longpeng(Mike)
Implements the kvm_arch_vcpu_spin/preempt_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_arch_vcpu. Signed-off-by: Longpeng(Mike) --- arch/x86/include/asm/kvm_host.h | 5 +

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

2017-08-07 Thread Longpeng(Mike)
Implements the kvm_arch_vcpu_spin/preempt_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_arch_vcpu. Signed-off-by: Longpeng(Mike) --- arch/x86/include/asm/kvm_host.h | 5 + arch/x86/kvm/svm.c |