From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: Re: [PATCH 3/9] kvm: qemu: Remove virtio_net tx ring-full heuristic Date: Fri, 25 Jul 2008 10:30:39 +1000 Message-ID: <200807251030.39301.rusty@rustcorp.com.au> References: <1216899979-32532-1-git-send-email-markmc@redhat.com> <1216899979-32532-4-git-send-email-markmc@redhat.com> <48890ECD.10104@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: Mark McLoughlin , kvm@vger.kernel.org, Herbert Xu To: Dor Laor Return-path: Received: from ozlabs.org ([203.10.76.45]:45799 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755116AbYGYAan (ORCPT ); Thu, 24 Jul 2008 20:30:43 -0400 In-Reply-To: <48890ECD.10104@qumranet.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Friday 25 July 2008 09:22:53 Dor Laor wrote: > Mark McLoughlin wrote: > > vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY; > > qemu_del_timer(n->tx_timer); > > n->tx_timer_active = 0; > > As stated by newer messages, we should handle the first tx notification > if the timer wasn't active to shorten latency. > Cheers, Dor Here's what lguest does at the moment. Basically, we cut the timeout a tiny bit each time, until we get *fewer* packets than last time. Then we bump it up again. Rough, but seems to work (it should be a per-device var of course, not a static). @@ -921,6 +922,7 @@ static void handle_net_output(int fd, st unsigned int head, out, in, num = 0; int len; struct iovec iov[vq->vring.num]; + static int last_timeout_num; if (!timeout) net_xmit_notify++; @@ -941,6 +943,14 @@ static void handle_net_output(int fd, st /* Block further kicks and set up a timer if we saw anything. */ if (!timeout && num) block_vq(vq); + + if (timeout) { + if (num < last_timeout_num) + timeout_usec += 10; + else if (timeout_usec > 1) + timeout_usec--; + last_timeout_num = num; + } }