diff mbox

[2/3] KVM: add kvm_arch_vcpu_runnable() test to kvm_vcpu_on_spin() loop

Message ID 1393427659-42501-3-git-send-email-borntraeger@de.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian Borntraeger Feb. 26, 2014, 3:14 p.m. UTC
From: Michael Mueller <mimu@linux.vnet.ibm.com>

Use the arch specific function kvm_arch_vcpu_runnable() to add a further
criterium to identify a suitable vcpu to yield to during undirected yield
processing.

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Raghavendra KT Feb. 27, 2014, 6:11 p.m. UTC | #1
On Wed, Feb 26, 2014 at 8:44 PM, Christian Borntraeger
<borntraeger@de.ibm.com> wrote:
> From: Michael Mueller <mimu@linux.vnet.ibm.com>
>
> Use the arch specific function kvm_arch_vcpu_runnable() to add a further
> criterium to identify a suitable vcpu to yield to during undirected yield
> processing.
>
> Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  virt/kvm/kvm_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index f5668a4..5fd4cf8 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1801,7 +1801,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me)
>                                 continue;
>                         if (vcpu == me)
>                                 continue;
> -                       if (waitqueue_active(&vcpu->wq))
> +                       if (waitqueue_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu))
>                                 continue;
>                         if (!kvm_vcpu_eligible_for_directed_yield(vcpu))
>                                 continue;
> --
> 1.8.4.2
>

I ran kernbench/sysbench/ebizzy on x86 guest to confirm that this did
not have any adverse effect in ple handler path.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paolo Bonzini Feb. 27, 2014, 6:20 p.m. UTC | #2
Il 27/02/2014 19:11, Raghavendra KT ha scritto:
> On Wed, Feb 26, 2014 at 8:44 PM, Christian Borntraeger
> <borntraeger@de.ibm.com> wrote:
>> From: Michael Mueller <mimu@linux.vnet.ibm.com>
>>
>> Use the arch specific function kvm_arch_vcpu_runnable() to add a further
>> criterium to identify a suitable vcpu to yield to during undirected yield
>> processing.
>>
>> Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
>> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  virt/kvm/kvm_main.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index f5668a4..5fd4cf8 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -1801,7 +1801,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me)
>>                                 continue;
>>                         if (vcpu == me)
>>                                 continue;
>> -                       if (waitqueue_active(&vcpu->wq))
>> +                       if (waitqueue_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu))
>>                                 continue;
>>                         if (!kvm_vcpu_eligible_for_directed_yield(vcpu))
>>                                 continue;
>> --
>> 1.8.4.2
>>
>
> I ran kernbench/sysbench/ebizzy on x86 guest to confirm that this did
> not have any adverse effect in ple handler path.

Thanks!

Paolo

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f5668a4..5fd4cf8 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1801,7 +1801,7 @@  void kvm_vcpu_on_spin(struct kvm_vcpu *me)
 				continue;
 			if (vcpu == me)
 				continue;
-			if (waitqueue_active(&vcpu->wq))
+			if (waitqueue_active(&vcpu->wq) && !kvm_arch_vcpu_runnable(vcpu))
 				continue;
 			if (!kvm_vcpu_eligible_for_directed_yield(vcpu))
 				continue;