qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [virtio guest] vring_need_event() from virtqueue_kick_p


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [virtio guest] vring_need_event() from virtqueue_kick_prepare()
Date: Tue, 7 Jul 2015 11:17:30 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Jul 06, 2015 at 06:13:29PM +0300, Catalin Vasile wrote:
> What is the logic behind vring_need_event() when used with
> virtqueue_kick_prepare()?
> What does the keyword >>just<< refer to from the following context:
> /* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */
> /* Assuming a given event_idx value from the other size, if
>  * we have just incremented index from old to new_idx,
>  * should we trigger an event? */
> ?

"just" means since the last time the host/guest-visible index field was
changed.  After avail or used rings have been processed, the index field
for that ring is published to the host/guest.  At that point a check is
made whether the other side needs to be kicked.

> I am sending 2 jobs, one after another, and the second one just does
> not want to kick, although the first one finished completely and the
> backend went back to interrupt mode, all because vring_need_event()
> returns false.

Maybe the vhost driver called vhost_disable_notify() and hasn't
re-enabled notify yet?

This could happen if the guest adds buffers to the virtqueue while the
host is processing the virtqueue.  Take a look at the vhost_net code for
how to correctly disable and re-enable notify without race conditions on
the host.

The idea behind disabling notify is to eliminate unnecessary
vmexits/notifications since the host is already processing the virtqueue
and will see new buffers.  It's like a polling vs interrupt mode.

If the vhost driver on the host doesn't implement it correctly, then the
device could stop responding to the avail ring.

Attachment: pgp3Y6xhtdgVE.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]