qemu-e2k/hw/scsi
Paolo Bonzini 51b19ebe43 virtio: move allocation to virtqueue_pop/vring_pop
The return code of virtqueue_pop/vring_pop is unused except to check for
errors or 0.  We can thus easily move allocation inside the functions
and just return a pointer to the VirtQueueElement.

The advantage is that we will be able to allocate only the space that
is needed for the actual size of the s/g list instead of the full
VIRTQUEUE_MAX_SIZE items.  Currently VirtQueueElement takes about 48K
of memory, and this kind of allocation puts a lot of stress on malloc.
By cutting the size by two or three orders of magnitude, malloc can
use much more efficient algorithms.

The patch is pretty large, but changes to each device are testable
more or less independently.  Splitting it would mostly add churn.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-02-06 20:39:07 +02:00
..
esp-pci.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
esp.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
lsi53c895a.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
Makefile.objs virtio-scsi-dataplane: Code to run virtio-scsi on iothread 2014-09-30 11:11:20 +02:00
megasas.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
mfi.h megasas: add MegaRAID SAS 2108 emulation 2014-10-31 11:29:00 +01:00
scsi-bus.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
scsi-disk.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
scsi-generic.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
spapr_vscsi.c ppc: Clean up includes 2016-01-29 15:07:22 +00:00
srp.h spapr-vscsi: add task management 2013-09-12 08:46:21 +02:00
vhost-scsi.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
viosrp.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
virtio-scsi-dataplane.c virtio: move allocation to virtqueue_pop/vring_pop 2016-02-06 20:39:07 +02:00
virtio-scsi.c virtio: move allocation to virtqueue_pop/vring_pop 2016-02-06 20:39:07 +02:00
vmw_pvscsi.c hw/scsi: Clean up includes 2016-01-29 15:07:24 +00:00
vmw_pvscsi.h scsi: VMWare PVSCSI paravirtual device implementation 2013-04-19 10:44:17 +02:00