public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Ladi Prosek <lprosek@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, KVM list <kvm@vger.kernel.org>
Subject: Re: [PATCH] virtio_ring: Make interrupt suppression spec compliant
Date: Mon, 22 Aug 2016 17:29:04 +0300	[thread overview]
Message-ID: <20160822172734-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CABdb735ANyN0Bk9fj3iyM-nsGFSqQgwDVR26RJBF1h0hdc3asw@mail.gmail.com>

On Wed, Jun 08, 2016 at 02:58:04PM +0200, Ladi Prosek wrote:
> On Mon, Jun 6, 2016 at 11:31 PM, Ladi Prosek <lprosek@redhat.com> wrote:
> > On Mon, Jun 6, 2016 at 4:35 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >>
> >>
> >> On 06/06/2016 15:55, Michael S. Tsirkin wrote:
> >>> > According to the spec, if the VIRTIO_RING_F_EVENT_IDX feature bit is
> >>> > negotiated the driver MUST set flags to 0. Not dirtying the available
> >>> > ring in virtqueue_disable_cb may also have a positive performance impact.
> >>>
> >>> Question would be, is this a gain or a loss. We have an extra branch,
> >>> and the write might serve to prefetch the cache line.
> >>>
> >>> > Writes to the used event field (vring_used_event) are still unconditional.
> >>> >
> >>> > Signed-off-by: Ladi Prosek <lprosek@redhat.com>
> >>>
> >>> Wow you are right wrt the spec. Should we change the spec or the
> >>> code though?
> >>
> >> I would change the spec and note that bit 0 of the flags is ignored if
> >> event indices are in use.
> >
> > Changing the spec sounds good. I'll see if I can get any meaningful
> > perf numbers with vring_bench, just in case. Would there be any
> > interest in having the tool checked in the tree? There are several
> > commits referencing vring_bench but it seems to exist only in a list
> > archive - took me a while to figure it out.
> 
> vring_bench with two threads, host thread polls the queue and moves
> indices from available to used, guest thread polls returned indices
> with:
> 
> do {
>   virtqueue_disable_cb(vq);
>   while ((p = virtqueue_get_buf(vq, &len)) != NULL)
>     returned++;
>   if (unlikely(virtqueue_is_broken(vq)))
>     break;
> } while (!virtqueue_enable_cb(vq));
> 
> Results:
> - no effect on branch misses
> - L1 dcache load misses ~0.5% down but with ~0.5% variance so not
> super convincing
> 
> Ladi

I think it makes sense to change this - the reason it
was written like this is because we did not have
a shadow, it was easier to change and check the flags directly.

Did you open an issue with virtio spec?

-- 
MST

  reply	other threads:[~2016-08-22 14:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06  9:51 [PATCH] virtio_ring: Make interrupt suppression spec compliant Ladi Prosek
2016-06-06 13:55 ` Michael S. Tsirkin
2016-06-06 14:35   ` Paolo Bonzini
2016-06-06 21:31     ` Ladi Prosek
2016-06-08 12:58       ` Ladi Prosek
2016-08-22 14:29         ` Michael S. Tsirkin [this message]
2016-08-30 14:26           ` Ladi Prosek
2016-08-22 14:26 ` Michael S. Tsirkin
2016-08-30 14:25   ` Ladi Prosek

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=20160822172734-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lprosek@redhat.com \
    --cc=pbonzini@redhat.com \
    /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