qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH][RESEND] virtio-serial-bus: Bump up control vq descriptors to min. required
@ 2011-01-11 16:17 Amit Shah
  2011-01-12 15:37 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 4+ messages in thread
From: Amit Shah @ 2011-01-11 16:17 UTC (permalink / raw)
  To: qemu list; +Cc: Amit Shah

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 <amit.shah@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [Qemu-devel] [[PATCH][RESEND]] virtio-serial-bus: Bump up control vq descriptors to min. required
@ 2011-01-04 11:43 Amit Shah
  0 siblings, 0 replies; 4+ messages in thread
From: Amit Shah @ 2011-01-04 11:43 UTC (permalink / raw)
  To: qemu list; +Cc: Amit Shah

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 <amit.shah@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [Qemu-devel] [[PATCH][RESEND]] virtio-serial-bus: Bump up control vq descriptors to min. required
@ 2010-12-07 13:48 Amit Shah
  0 siblings, 0 replies; 4+ messages in thread
From: Amit Shah @ 2010-12-07 13:48 UTC (permalink / raw)
  To: qemu list; +Cc: Amit Shah

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 <amit.shah@redhat.com>
---
 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.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-12 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11 16:17 [Qemu-devel] [PATCH][RESEND] virtio-serial-bus: Bump up control vq descriptors to min. required Amit Shah
2011-01-12 15:37 ` [Qemu-devel] " Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2011-01-04 11:43 [Qemu-devel] [[PATCH][RESEND]] " Amit Shah
2010-12-07 13:48 Amit Shah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).