All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait handling
@ 2008-03-28 21:34 Jerone Young
  2008-03-31 12:57 ` Jerone Young
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Jerone Young @ 2008-03-28 21:34 UTC (permalink / raw)
  To: kvm-ppc

# HG changeset patch
# User Jerone Young <jyoung5@us.ibm.com>
# Date 1206739218 18000
# Node ID 21179d0ab8a62ecc24d18be2da1600694aeca71a
# Parent  e48cf2ad6c85c457ff64c04b83960fc305420842
Add PowerPC KVM guest wait handling support

This patch handles a guest that is in a wait state. This ensures that the guest is not allways eating up 100% cpu when it is idle.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -177,6 +177,11 @@ static int kvmppc_can_deliver_interrupt(
 static int kvmppc_can_deliver_interrupt(struct kvm_vcpu *vcpu, int interrupt)
 {
 	int r;
+
+	/* clear guest wait state */
+	if (vcpu->arch.msr & MSR_WE) {
+		vcpu->arch.msr &= ~MSR_WE;
+	}
 
 	switch (interrupt) {
 	case BOOKE_INTERRUPT_CRITICAL:
@@ -294,6 +299,21 @@ int kvmppc_handle_exit(struct kvm_run *r
 
 	run->exit_reason = KVM_EXIT_UNKNOWN;
 	run->ready_for_interrupt_injection = 1;
+
+	/* handle guest vcpu that is in wait state */
+	if (vcpu->arch.msr & MSR_WE) {
+		DECLARE_WAITQUEUE(wait, current);
+		add_wait_queue(&vcpu->wq, &wait);
+
+		while(vcpu->arch.pending_exceptions) {
+			set_current_state(TASK_INTERRUPTIBLE);
+			schedule();
+			kvmppc_check_and_deliver_interrupts(vcpu);
+		}
+
+		set_current_state(TASK_RUNNING);
+		remove_wait_queue(&vcpu->wq, &wait);
+	}
 
 	switch (exit_nr) {
 	case BOOKE_INTERRUPT_MACHINE_CHECK:

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
kvm-ppc-devel mailing list
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-04-15 19:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 21:34 [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait handling Jerone Young
2008-03-31 12:57 ` Jerone Young
2008-03-31 13:33 ` [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait Christian Ehrhardt
2008-04-02  7:52 ` [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait handling Jerone Young
2008-04-02  9:17 ` [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait Christian Ehrhardt
2008-04-02 16:27 ` Hollis Blanchard
2008-04-02 18:07 ` [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait handling Jerone Young
2008-04-02 19:23 ` [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait Hollis Blanchard
2008-04-02 19:41 ` Hollis Blanchard
2008-04-03 13:34 ` Jimi Xenidis
2008-04-03 19:35 ` [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait handling Jerone Young
2008-04-15 15:28 ` [kvm-ppc-devel] [PATCH 2 of 2] Add PowerPC KVM guest wait Hollis Blanchard
2008-04-15 18:19 ` Hollis Blanchard
2008-04-15 18:56 ` Hollis Blanchard
2008-04-15 19:28 ` Hollis Blanchard

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.