From: Stefan Hajnoczi <stefanha@gmail.com>
To: Catalin Vasile <catalinvasile92@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [virtio guest] vring_need_event() from virtqueue_kick_prepare()
Date: Tue, 7 Jul 2015 11:17:30 +0100 [thread overview]
Message-ID: <20150707101730.GB1648@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CAOMf8totwCXXDLkJ=_i8T88Z-zY9pz0RCB4+MejZBc0+LwJdEg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1587 bytes --]
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 #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-07-07 10:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 15:13 [Qemu-devel] [virtio guest] vring_need_event() from virtqueue_kick_prepare() Catalin Vasile
2015-07-07 10:17 ` Stefan Hajnoczi [this message]
2015-07-07 11:43 ` Catalin Vasile
2015-07-09 10:43 ` Stefan Hajnoczi
2015-07-09 10:45 ` Catalin Vasile
2015-07-16 12:52 ` Stefan Hajnoczi
2015-07-16 12:54 ` Catalin Vasile
2015-07-16 16:33 ` Stefan Hajnoczi
2015-07-17 6:30 ` Catalin Vasile
2015-07-17 12:58 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150707101730.GB1648@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=catalinvasile92@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).