From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQDKF-0006YZ-Th for qemu-devel@nongnu.org; Sun, 29 Sep 2013 05:30:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VQDKA-0008B8-UI for qemu-devel@nongnu.org; Sun, 29 Sep 2013 05:30:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VQDKA-0008Aq-Mi for qemu-devel@nongnu.org; Sun, 29 Sep 2013 05:29:58 -0400 Message-ID: <5247F306.6040002@redhat.com> Date: Sun, 29 Sep 2013 17:29:42 +0800 From: Jason Wang MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Virtio Polling Mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Yaohui , qemu-devel@nongnu.org On 09/28/2013 02:56 AM, Hu Yaohui wrote: > Hi All, > I am wondering whether virtio has provided polling mode already. > Instead of sending a event from guest to host through eventfd on guest > side and inject an interrupt into guest on host side to notify each > other? Could both sides keep polling the Vring to communicate with > each other? > Thanks for your time! > For virtio-net, both qemu and driver (at least Linux) mix using polling and notification. Usually one side will disable the notification from another side when it gets an interrupt, and then enter the polling mode until no more buffers submitted from another side. After this it will enable the interrupts again. One of the method to improve this a little bit is to do the busy polling even if there's no new buffers in case the other side will submit one or more shortly. Linux has implemented this as low latency polling for network stack (see http://lwn.net/Articles/551284/). It will do busy polling for a time which can be configured by user. I've played a little bit of this for both virtio-net and vhost, it can improves the latency (more obvious for single session test) at the cost of extra cpu overhead. The key to balance them is to choose time spent on busy polling correctly. I don't think about it further but maybe we can make it adaptive. > Best Wishes, > Yaohui