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

Pekka Enberg
2011-07-13T11:14:27Z

On Wed, Jul 13, 2011 at 1:56 PM, Pekka Enberg <penberg@kernel.org> wrote:
> On Wed, Jul 13, 2011 at 1:26 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
>> The problem is that if we received a signal during the read notification
>> the write and before receiving the read, we have to go back to
>> userspace.
>>
>> This means that userspace will see same read request twice (once in the
>> socket and once in the MMIO exit).
>
> So the problem is only in ioeventfd_read() if socket_write() succeeds
> but socket_read() fails? If so, can we do the socket_read() somewhere
> else in the code which is able to restart it?
>
> AFAICT, both ioeventfd_read() and ioeventfd_write() should -ENOSUPP if
> socket_write() fails. If socket_write() succeeds, we should return
> -EINTR and teach vcpu_mmio_read() and kernel_pio() to KVM_EXIT_INTR in
> those cases. We'll can just restart the read, no? The only
> complication I can see is that ioeventfd_read() needs to keep track if
> it did the socket_write() already or not.

Maybe struct _ioeventfd could hold a flag that tells ioevenfd_read()
that the write part was already successful?