On 02/24/2012 08:26 AM, Alexander Graf wrote: > -void kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) > +int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) > { > unsigned long *pending = &vcpu->arch.pending_exceptions; > unsigned long old_pending = vcpu->arch.pending_exceptions; > @@ -283,6 +283,8 @@ void kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) > > /* Tell the guest about our interrupt status */ > kvmppc_update_int_pending(vcpu, *pending, old_pending); > + > + return 0; > } > > pfn_t kvmppc_gfn_to_pfn(struct kvm_vcpu *vcpu, gfn_t gfn) > diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c > index 9979be1..3fcec2c 100644 > --- a/arch/powerpc/kvm/booke.c > +++ b/arch/powerpc/kvm/booke.c > @@ -439,8 +439,9 @@ static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) > } > > /* Check pending exceptions and deliver one, if possible. */ > -void kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) > +int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) > { > + int r = 0; > WARN_ON_ONCE(!irqs_disabled()); > > kvmppc_core_check_exceptions(vcpu); > @@ -451,8 +452,44 @@ void kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) > local_irq_disable(); > > kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS); > - kvmppc_core_check_exceptions(vcpu); > + r = 1; > }; > + > + return r; > +} > + > +/* > + * Common checks before entering the guest world. Call with interrupts > + * disabled. > + * > + * returns !0 if a signal is pending and check_signal is true > + */ > +static int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu, bool check_signal) > +{ > + int r = 0; > + > + WARN_ON_ONCE(!irqs_disabled()); > + while (true) { > + if (need_resched()) { > + local_irq_enable(); > + cond_resched(); > + local_irq_disable(); > + continue; > + } > + > + if (kvmppc_core_prepare_to_enter(vcpu)) { > + /* interrupts got enabled in between, so we > + are back at square 1 */ > + continue; > + } > + > + > + if (check_signal && signal_pending(current)) > + r = 1; If there is a signal pending and MSR[WE] is set, we'll loop forever without reaching this check. -Scott -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html