Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjHyu-0001US-Jp for qemu-devel@nongnu.org; Thu, 03 Sep 2009 15:28:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjHyq-0001Ra-2S for qemu-devel@nongnu.org; Thu, 03 Sep 2009 15:28:28 -0400 Received: from [199.232.76.173] (port=47699 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjHyp-0001RQ-QZ for qemu-devel@nongnu.org; Thu, 03 Sep 2009 15:28:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22294) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjHyp-0006A7-C6 for qemu-devel@nongnu.org; Thu, 03 Sep 2009 15:28:23 -0400 Date: Thu, 3 Sep 2009 16:28:03 -0300 From: Glauber Costa Message-ID: <20090903192803.GT30340@mothafucka.localdomain> References: <1252000886-20611-1-git-send-email-glommer@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] Re: [RFC v2] queue_work proposal List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Thu, Sep 03, 2009 at 08:48:53PM +0200, Juan Quintela wrote: > Glauber Costa wrote: > > Hi Glauber > > > +int kvm_vcpu_ioctl(CPUState *env, int type, ...) > > +{ > > void *arg; > > va_list ap; > > + KVMIoctl data; > > > > va_start(ap, type); > > arg = va_arg(ap, void *); > > va_end(ap); > > > > - ret = ioctl(env->kvm_fd, type, arg); > > - if (ret == -1) > > - ret = -errno; > > + data.type = type; > > + data.data = arg; > > + data.fd = env->kvm_fd; > > > > - return ret; > > + qemu_queue_work(env, kvm_remote_ioctl, (void *)&data); > > + > > + return data.ret; > > Does this work? giving the address of a local variable is a no-no. Yes, because it synchronous. The stack will keep existing until queue_work returns. Actually, this was one of the reasons Avi pushed so hardly against the async mechanism