From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 9/9] KVM: Adds support for halting in the kernel Date: Tue, 19 Jun 2007 17:48:03 +0300 Message-ID: <4677ECA3.509@qumranet.com> References: <20070531180005.1810.23884.stgit@ghaskins-t60p.haskins.net> <20070531180934.1810.45024.stgit@ghaskins-t60p.haskins.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Gregory Haskins Return-path: In-Reply-To: <20070531180934.1810.45024.stgit-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Gregory Haskins wrote: > Halting in userspace requires a relatively cumbersome mechanism to signal the > halted VCPU. Implementing halt in kernel should be relatively straight > forward and it eliminates the need for the signaling > > Merging this one in, found some nits: > +/* > * This function is invoked whenever we want to interrupt a vcpu that is > * currently executing in guest-mode. It currently is a no-op because > * the simple delivery of the IPI to execute this function accomplishes our > @@ -2481,6 +2556,16 @@ static void kvm_vcpu_intr(struct kvm_irqsink *this, > BUG_ON(direct_ipi == smp_processor_id()); > ++vcpu->stat.guest_preempt; > } > + > + /* > + * If the CPU is halted it will be waiting for a wake-up > + */ > + if (waitqueue_active(&vcpu->irq.wq)) { > Why do the check? The only reason I can see is to keep the stats correct. Otherwise we can do the body of the if unconditionally. > + wake_up_interruptible_sync(&vcpu->irq.wq); > + set_tsk_need_resched(current); > This is unneeded? I'd expect wake_up_interruptible_sync() to take care of any rescheduling needed. > + ++vcpu->stat.halt_wakeup; > + } > + > -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/