From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 3/8] KVM: Adds ability to preempt an executing VCPU Date: Mon, 14 May 2007 18:45:42 +0300 Message-ID: <46488426.8090705@qumranet.com> References: <20070509023731.23443.86578.stgit@novell1.haskins.net> <20070509030325.23443.90129.stgit@novell1.haskins.net> <46482D2E.7040809@qumranet.com> <464845AD.BA47.005A.0@novell.com> 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: <464845AD.BA47.005A.0-Et1tbQHTxzrQT0dZR+AlfA@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: >>> index 059f074..0f6cc32 100644 >>> --- a/drivers/kvm/kvm.h >>> +++ b/drivers/kvm/kvm.h >>> @@ - 329,6 +329,8 @@ struct kvm_vcpu_irq { >>> struct kvm_irqdevice dev; >>> int pending; >>> int deferred; >>> + struct task_struct *task; >>> + int guest_mode; >>> >>> >> - >guest_mode can be folded into - >task, by specifying that - >task != >> NULL is equivalent to - >guest_mode != 0. This will make the rest of the >> code easier to read. >> > > The problem with doing it this way is that its no longer possible to detect the optimizing condition of "irq.task != current" when injecting interrupts. This means that userspace will be inadvertently sending itself a signal every time it injects interrupts, which IMHO is undesirable. > > I meant keeping ->task and dropping ->guest_mode. Or did I misunderstand something? >>> >>> + vcpu- >irq.task = current; >>> + smp_wmb(); >>> + >>> >>> >> This is best moved where - >guest_mode is set. >> > > I can do this, but its common to all platforms so I figured it was best to be out here? > > Well, it scatters the logic. If we can merge guest_mode and task it's moot anyway. -- 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/