[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [RFC v2] queue_work proposal
From: |
Glauber Costa |
Subject: |
[Qemu-devel] Re: [RFC v2] queue_work proposal |
Date: |
Thu, 3 Sep 2009 16:28:03 -0300 |
User-agent: |
Jack Bauer |
On Thu, Sep 03, 2009 at 08:48:53PM +0200, Juan Quintela wrote:
> Glauber Costa <address@hidden> 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