All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Gleb Natapov <gleb@kernel.org>, Paolo Bonzini <pbonzini@redhat.com>
Cc: KVM <kvm@vger.kernel.org>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Michael Mueller <mimu@linux.vnet.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [PATCH/RFC 1/3] kvm: Introduction of kvm_arch_vcpu_dont_yield()
Date: Tue, 11 Feb 2014 12:45:30 +0100	[thread overview]
Message-ID: <1392119132-50182-2-git-send-email-borntraeger@de.ibm.com> (raw)
In-Reply-To: <1392119132-50182-1-git-send-email-borntraeger@de.ibm.com>

From: Michael Mueller <mimu@linux.vnet.ibm.com>

The function kvm_arch_vcpu_dont_yield() allows the platform dependant
extension of the heuristic being used to identify unsuitable virtual cpus
during undirected yield processing.

The default implementation used the existing waitqueue check.

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>
---
 include/linux/kvm_host.h | 9 +++++++++
 virt/kvm/Kconfig         | 3 +++
 virt/kvm/kvm_main.c      | 2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index f5937b8..3e979a2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -686,6 +686,15 @@ static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
 #endif
 }
 
+#ifndef CONFIG_HAVE_KVM_ARCH_VCPU_DONT_YIELD
+static inline bool kvm_arch_vcpu_dont_yield(struct kvm_vcpu *vcpu)
+{
+	return waitqueue_active(kvm_arch_vcpu_wq(vcpu));
+}
+#else
+bool kvm_arch_vcpu_dont_yield(struct kvm_vcpu *vcpu);
+#endif
+
 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
 void kvm_arch_destroy_vm(struct kvm *kvm);
 void kvm_arch_sync_events(struct kvm *kvm);
diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig
index 13f2d19..e1e46a8 100644
--- a/virt/kvm/Kconfig
+++ b/virt/kvm/Kconfig
@@ -34,3 +34,6 @@ config HAVE_KVM_CPU_RELAX_INTERCEPT
 
 config KVM_VFIO
        bool
+
+config HAVE_KVM_ARCH_VCPU_DONT_YIELD
+       bool
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index a9e999a..6829e6f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1804,7 +1804,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me)
 				continue;
 			if (vcpu == me)
 				continue;
-			if (waitqueue_active(&vcpu->wq))
+			if (kvm_arch_vcpu_dont_yield(vcpu))
 				continue;
 			if (!kvm_vcpu_eligible_for_directed_yield(vcpu))
 				continue;
-- 
1.8.4.2

  reply	other threads:[~2014-02-11 11:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 11:45 [PATCH/RFC 0/3] KVM: yield heuristic improvements Christian Borntraeger
2014-02-11 11:45 ` Christian Borntraeger [this message]
2014-02-11 11:45 ` [PATCH/RFC 2/3] s390/kvm: Platform specific kvm_arch_vcpu_dont_yield Christian Borntraeger
2014-02-13 22:37   ` Paolo Bonzini
2014-02-13 22:54     ` Christian Borntraeger
2014-02-13 23:32       ` Paolo Bonzini
2014-02-14  9:55         ` Christian Borntraeger
2014-02-14  9:56           ` Paolo Bonzini
2014-02-24 14:22           ` Michael Mueller
2014-02-11 11:45 ` [PATCH/RFC 3/3] s390/kvm: Set preempted flag during vcpu wakeup and interrupt delivery Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392119132-50182-2-git-send-email-borntraeger@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mimu@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.