On Thu, Oct 22, 2026 at 03:47:22PM +0200, Tim Pambor wrote: > vhost-user injects a kick by writing to the fd it has just passed to the > back-end. With an eventfd that fd is writable, but when pipes are used > it is the read end and the write fails. > > Instead, kick via event_notifier_set() on the queue's host notifier, > which writes to the correct end in both cases. > > Signed-off-by: Tim Pambor <[email protected]> > --- > hw/virtio/vhost-user.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c > index 65889b0776..b817b15d0b 100644 > --- a/hw/virtio/vhost-user.c > +++ b/hw/virtio/vhost-user.c > @@ -1527,16 +1527,9 @@ static int vhost_user_set_vring_kick(struct vhost_dev > *dev, > * receiving a kick. The spec suggests this to improve compatibility. > */ > if (file->fd != -1) { > - uint64_t val = 1; > - ssize_t nwritten; > + VirtQueue *vq = virtio_get_queue(dev->vdev, file->index); > > - do { > - nwritten = write(file->fd, &val, sizeof(val)); > - } while (nwritten < 0 && errno == EINTR); > - > - if (nwritten < 0 && errno != EAGAIN /* back-end can already read */) > { > - return -errno; > - }
Please add a comment here explaining why we are not using file->fd (like you correctly did in the commit message), or update the comment before this block. Also, should we add an assert to check that file->fd is equal to event_notifier_get_fd() ? The rest LGTM. Stefano > + return event_notifier_set(virtio_queue_get_host_notifier(vq)); > } > > return 0; > > -- > 2.55.0 >
