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.
pgpkpaAQtaSRm.pgp
Description: PGP signature