qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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: Thu, 9 Jul 2015 11:43:22 +0100	[thread overview]
Message-ID: <20150709104322.GD28530@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CAOMf8tqqY_detoPijE5S1ttZaKDid1TdJ-U7Taknc6tK1t7k0g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]

On Tue, Jul 07, 2015 at 02:43:06PM +0300, Catalin Vasile wrote:
> My vhost module respects the format vhost-net uses:
> 
> /* <code> summary */
> mutex_lock(&vq->mutex);
> vhost_disable_notify();
> for (;;) {
>         head = vhost_get_vq_desc();
>        if (head == vq->num) {
>             if (unlikely(vhost_enable_notify())) {
>                 vhost_disable_notify();
>                 continue;
>             }
>             break;
>        }
>        vhost_add_used_and_signal();
> }
> mutex_unlock(&vq->mutex);
> /* </code> */
> 
> I have made a lot of printk() calls and the first job gets processed
> completely, and gets through all those calls:
> 1. it goes into a first loop and processes the first job (get
> descriptor, work with the descriptor, add used and signal).
> 2. On the second loop it hits head == vq->num, and goes back to
> listening to notifications (successfully, it does not get into the
> fallback).
> 
> Now in the guest:
> 1. sends first job and the paramers used to call vring_need_event() are:
> vring_avail_event=0, new=1, old=0 (which makes the function evaluate to "0 < 1")
> 2. the queue is kicked and vhost does its job.
> 3. the guest driver reaches the end of the first job, and lets the
> following job take its course, only this time vring_need_event()
> receives the following parameters:
> vring_avail_event=0, new=2, old=1 (which makes the function evaluate to "1 < 1")

This means you need to look at the vhost code because vring_avail_event
shouldn't be 0.

Why wasn't vhost_update_avail_event() called?

Maybe the feature bit negotiation for your device is broken and vhost
thinks VIRTIO_RING_F_EVENT_IDX is not set.

Or does the used ring have the VRING_USED_F_NO_NOTIFY flag?

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-07-09 10:43 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
2015-07-07 11:43   ` Catalin Vasile
2015-07-09 10:43     ` Stefan Hajnoczi [this message]
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=20150709104322.GD28530@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).