Re: [kvm-ppc-devel] [PATCH 2 of 3] Add PowerPC KVM guest wait handling support

Hollis Blanchard
2008-04-25T13:56:03Z

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 <jyoung5@us.ibm.com>
>
> 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