> +bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
> +{
> +     return false;
> +}

why don't we need an EXPORT_SYMBOL here?

> +
>  /* Just ensure a guest exit from a particular CPU */
>  static void exit_vm_noop(void *info)
>  {
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 15252d7..e7720d2 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -2317,7 +2317,7 @@ static bool kvm_vcpu_eligible_for_directed_yield(struct 
> kvm_vcpu *vcpu)
>  #endif
>  }
>  
> -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)

I would even move this to an other patch.

Maybe even split into

a) introducing kvm_arch_vcpu_in_kernel() for all archs
b) modifying kvm_vcpu_on_spin(), passing the result from
kvm_arch_vcpu_in_kernel()
c) filling kvm_arch_vcpu_in_kernel() with life for different archs
(multiple patches)
d) pimping kvm_vcpu_on_spin()

>                       if (!kvm_vcpu_eligible_for_directed_yield(vcpu))
>                               continue;
>  
> 


-- 

Thanks,

David

Reply via email to