From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [patch 3/4] KVM: use smp_send_reschedule in kvm_vcpu_kick Date: Fri, 8 May 2009 10:13:25 +0300 Message-ID: <20090508071325.GB25357@redhat.com> References: <20090507205509.522421993@amt.cnet> <20090507205536.827800402@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com To: mtosatti@redhat.com Return-path: Received: from mx2.redhat.com ([66.187.237.31]:43661 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752152AbZEHHN1 (ORCPT ); Fri, 8 May 2009 03:13:27 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n487DS5v011527 for ; Fri, 8 May 2009 03:13:28 -0400 Content-Disposition: inline In-Reply-To: <20090507205536.827800402@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, May 07, 2009 at 05:55:12PM -0300, mtosatti@redhat.com 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 > Acked-by: Gleb Natapov 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.