From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46702 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pd2mA-0002oN-LV for qemu-devel@nongnu.org; Wed, 12 Jan 2011 10:38:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pd2m9-0001SX-6Q for qemu-devel@nongnu.org; Wed, 12 Jan 2011 10:38:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pd2m8-0001SP-VX for qemu-devel@nongnu.org; Wed, 12 Jan 2011 10:38:17 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0CFcFjt019001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 Jan 2011 10:38:15 -0500 Date: Wed, 12 Jan 2011 17:37:58 +0200 From: "Michael S. Tsirkin" Message-ID: <20110112153758.GA32468@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] Re: [PATCH][RESEND] virtio-serial-bus: Bump up control vq descriptors to min. required List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: qemu list On Tue, Jan 11, 2011 at 09:47:44PM +0530, Amit Shah wrote: > The current default of 16 buffers for the control vq is too small for > the default max_nr_ports of 32. We can get more entries in there, > example when asking the guest to add max. allowed ports. > > Default to using the minimum required (next power of 2) of the > max_nr_ports in use. > > Signed-off-by: Amit Shah > --- So looking at this more closely, this reduces but does not eliminate the chance of notification event drops. I think I liked v1 better. > hw/virtio-serial-bus.c | 13 ++++++++++--- > 1 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > index 74ba5ec..eb7b362 100644 > --- a/hw/virtio-serial-bus.c > +++ b/hw/virtio-serial-bus.c > @@ -736,7 +736,7 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, uint32_t max_nr_ports) > { > VirtIOSerial *vser; > VirtIODevice *vdev; > - uint32_t i, max_supported_ports; > + uint32_t i, max_supported_ports, cvq_len; > > if (!max_nr_ports) > return NULL; > @@ -769,10 +769,17 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, uint32_t max_nr_ports) > /* Add a queue for guest to host transfers for port 0 (backward compat) */ > vser->ovqs[0] = virtio_add_queue(vdev, 128, handle_output); > > + /* > + * The number of descriptors to use should always be a power of > + * two. Use the next power of 2 of max_nr_ports to keep the > + * entries to a minimum. > + */ > + cvq_len = 1 << qemu_fls(max_nr_ports - 1); > + > /* control queue: host to guest */ > - vser->c_ivq = virtio_add_queue(vdev, 16, control_in); > + vser->c_ivq = virtio_add_queue(vdev, cvq_len, control_in); > /* control queue: guest to host */ > - vser->c_ovq = virtio_add_queue(vdev, 16, control_out); > + vser->c_ovq = virtio_add_queue(vdev, cvq_len, control_out); > > for (i = 1; i < vser->bus->max_nr_ports; i++) { > /* Add a per-port queue for host to guest transfers */ > -- > 1.7.3.4 >