public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: KVM <kvm@vger.kernel.org>
Subject: Best way to busy-wait for a virtio queue?
Date: Fri, 29 Mar 2013 16:12:37 -0700	[thread overview]
Message-ID: <51561FE5.2020304@zytor.com> (raw)

Is there any preferred way to busy-wait on a virtio event?  As in: the
guest doesn't have anything useful to do until something is plopped down
on the virtio queue, but would like to proceed as quickly as possible
after that.  Passing through an interrupt handler seems like unnecessary
overhead.

Right now I have a poll loop looking like (pseudocode):

outw(0, trigger);
while (readl(ring->output pointer) != final output pointer)
	cpu_relax();		/* x86 PAUSE instruction */

... but I have no idea how much sense that makes.


	-hpa

             reply	other threads:[~2013-03-29 23:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29 23:12 H. Peter Anvin [this message]
2013-04-01 16:07 ` Best way to busy-wait for a virtio queue? Eric Northup

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=51561FE5.2020304@zytor.com \
    --to=hpa@zytor.com \
    --cc=kvm@vger.kernel.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