Re: [RFC v3 4/5] KVM: add ioregionfd context

Elena Afanasova
2021-03-10T16:43:09Z

On Wed, 2021-03-10 at 15:11 +0100, Paolo Bonzini wrote:
> On 10/03/21 14:20, Elena Afanasova wrote:
> > On Tue, 2021-03-09 at 09:01 +0100, Paolo Bonzini wrote:
> > > On 09/03/21 08:54, Jason Wang wrote:
> > > > > + return;
> > > > > +
> > > > > + spin_lock(&ctx->wq.lock);
> > > > > + wait_event_interruptible_exclusive_locked(ctx->wq, !ctx-
> > > > > > busy);
> > > >
> > > > Any reason that a simple mutex_lock_interruptible() can't work
> > > > here?
> > >
> > > Or alternatively why can't the callers just take the spinlock.
> > >
> > I'm not sure I understand your question. Do you mean why locked
> > version
> > of wait_event() is used?
>
> No, I mean why do you need to use ctx->busy and wait_event, instead
> of
> operating directly on the spinlock or on a mutex.
>
When ioregionfd communication is interrupted by a signal ioctl(KVM_RUN)
has to return to userspace. I'm not sure it's ok to do that with the
spinlock/mutex being held.

> Paolo
>