From: Hollis Blanchard Subject: Re: [kvm-ppc-devel] [PATCH 2 of 3] Add PowerPC KVM guest wait handling support Date: Fri, 25 Apr 2008 08:56:03 -0500 Message-ID: <200804250856.04031.hollisb@us.ibm.com> References: <60c9ee8343f554ad90d3.1209102963@thinkpadL> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-ppc-devel@lists.sourceforge.net, kvm-devel@lists.sourceforge.net To: Jerone Young Return-path: In-Reply-To: <60c9ee8343f554ad90d3.1209102963@thinkpadL> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org On Friday 25 April 2008 00:56:03 Jerone Young wrote: > 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 > > diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c > --- a/arch/powerpc/kvm/emulate.c > +++ b/arch/powerpc/kvm/emulate.c > @@ -265,6 +265,11 @@ int kvmppc_emulate_instruction(struct kv > case 146: /* mtmsr */ > rs = get_rs(inst); > kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]); > + > + /* handle guest vcpu that is in wait state */ > + if (vcpu->arch.msr & MSR_WE) { > + kvm_vcpu_block(vcpu); > + } > break; > > case 163: /* wrteei */ So if I apply this patch and not #3, the guest will put itself to sleep and never wake up? You need to combine patches 2 and 3. Also, for completeness, you should add the same test to the rfi emulation, which could (theoretically) also set MSR[WE]. -- Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone