Re: [PATCH v2 1/4] KVM: add spinlock optimization framework

From: Paolo Bonzini
Date: Tue Aug 08 2017 - 05:01:15 EST


On 08/08/2017 10:42, David Hildenbrand wrote:
>
>> +bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
>> +{
>> + return false;
>> +}
>
> why don't we need an EXPORT_SYMBOL here?

Is it used outside the KVM module? I think no architecture actually needs
to export it.

>> -void kvm_vcpu_on_spin(struct kvm_vcpu *me)
>> +void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool me_in_kern)
>> {
>> struct kvm *kvm = me->kvm;
>> struct kvm_vcpu *vcpu;
>> @@ -2348,6 +2348,8 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me)
>> continue;
>> if (swait_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu))
>> continue;
>> + if (me_in_kern && !kvm_arch_vcpu_in_kernel(vcpu))
>> + continue;
>
>
> hm, does this patch compile? (me_in_kern)

Why not? :) This is what I have: