From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Best way to busy-wait for a virtio queue? Date: Fri, 29 Mar 2013 16:12:37 -0700 Message-ID: <51561FE5.2020304@zytor.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: KVM Return-path: Received: from terminus.zytor.com ([198.137.202.10]:41114 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757238Ab3C2XMo (ORCPT ); Fri, 29 Mar 2013 19:12:44 -0400 Sender: kvm-owner@vger.kernel.org List-ID: 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