Re: [PATCH 5/5] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_SOCKET

Sasha Levin
2011-07-10T05:34:49Z

On Wed, 2011-07-06 at 20:58 +0300, Michael S. Tsirkin wrote:
> On Wed, Jul 06, 2011 at 06:01:46PM +0300, Sasha Levin wrote:
> > On Wed, 2011-07-06 at 14:42 +0300, Michael S. Tsirkin wrote:
> > > On Wed, Jul 06, 2011 at 07:37:58AM +0300, Sasha Levin wrote:
> > > > + if (p->sock) {
> > > > + socket_write(p->sock, &data, sizeof(data));
> > > > + socket_read(p->sock, &data, sizeof(data));
> > > > + set_val(val, len, data.data);
> > >
> > > Same here.
> >
> > The socket_read() here I should leave blocking, and spin on it until I
> > read something - right?
>
> I think it's best to exit to userspace.

Since sock_recvmsg for AF_UNIX SEQPACKET is interruptible, if we fail
the read here we'll take a regular MMIO exit and will allow the usermode
to deal with the MMIO in a regular way.

I've discussed the issue of usermode might having to handle the same
MMIO read request twice with Michael, and the solution proposed was to
add a new type of exit to handle this special case.

After working on that solution a bit I saw it's adding a lot of code and
complexity for this small issue, and I'm now thinking we may be better
off with just handling reads twice in case of a signal just between
socket_write() and socket_read() - once through the socket and once
through a regular MMIO exit.

--

Sasha.