On Thu, May 07, 2009 at 05:55:12PM -0300, mtosatti@xxxxxxxxxx wrote: > KVM uses a function call IPI to cause the exit of a guest running on a > physical cpu. For virtual interrupt notification there is no need to > wait on IPI receival, or to execute any function. > > This is exactly what the reschedule IPI does, without the overhead > of function IPI. So use it instead of smp_call_function_single in > kvm_vcpu_kick. > > Also change the "guest_mode" variable to a bit in vcpu->requests, and > use that to collapse multiple IPI's that would be issued between the > first one and zeroing of guest mode. > > This allows kvm_vcpu_kick to called with interrupts disabled. > > Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx> > Acked-by: Gleb Natapov <gleb@xxxxxxxxxx> Except one small nitpick below. > Index: kvm-pending/arch/x86/kvm/x86.c > =================================================================== > --- kvm-pending.orig/arch/x86/kvm/x86.c > +++ kvm-pending/arch/x86/kvm/x86.c > @@ -3259,6 +3259,9 @@ static int vcpu_enter_guest(struct kvm_v > > local_irq_disable(); > > + clear_bit(KVM_REQ_KICK, &vcpu->requests); > + smp_mb__after_clear_bit(); > + > if (vcpu->requests || need_resched() || signal_pending(current)) { > local_irq_enable(); > preempt_enable(); > @@ -3266,13 +3269,6 @@ static int vcpu_enter_guest(struct kvm_v > goto out; > } > > - vcpu->guest_mode = 1; > - /* > - * Make sure that guest_mode assignment won't happen after > - * testing the pending IRQ vector bitmap. > - */ > - smp_wmb(); > - Can you leave this comment. I like it :) -- Gleb. -- 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