[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v4 08/29] virtio: improve virtio devices initializati
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v4 08/29] virtio: improve virtio devices initialization time |
Date: |
Thu, 18 Jan 2018 22:44:52 +0200 |
From: Gal Hammer <address@hidden>
The loading time of a VM is quite significant when its virtio
devices use a large amount of virt-queues (e.g. a virtio-serial
device with max_ports=511). Most of the time is spend in the
creation of all the required event notifiers (ioeventfd and memory
regions).
This patch pack all the changes to the memory regions in a
single memory transaction.
Reported-by: Sitong Liu <address@hidden>
Reported-by: Xiaoling Gao <address@hidden>
Signed-off-by: Gal Hammer <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/virtio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index d6002ee..3ac3491 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2574,6 +2574,7 @@ static int
virtio_device_start_ioeventfd_impl(VirtIODevice *vdev)
VirtioBusState *qbus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev)));
int n, r, err;
+ memory_region_transaction_begin();
for (n = 0; n < VIRTIO_QUEUE_MAX; n++) {
VirtQueue *vq = &vdev->vq[n];
if (!virtio_queue_get_num(vdev, n)) {
@@ -2596,6 +2597,7 @@ static int
virtio_device_start_ioeventfd_impl(VirtIODevice *vdev)
}
event_notifier_set(&vq->host_notifier);
}
+ memory_region_transaction_commit();
return 0;
assign_error:
@@ -2609,6 +2611,7 @@ assign_error:
r = virtio_bus_set_host_notifier(qbus, n, false);
assert(r >= 0);
}
+ memory_region_transaction_commit();
return err;
}
@@ -2625,6 +2628,7 @@ static void
virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev)
VirtioBusState *qbus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev)));
int n, r;
+ memory_region_transaction_begin();
for (n = 0; n < VIRTIO_QUEUE_MAX; n++) {
VirtQueue *vq = &vdev->vq[n];
@@ -2635,6 +2639,7 @@ static void
virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev)
r = virtio_bus_set_host_notifier(qbus, n, false);
assert(r >= 0);
}
+ memory_region_transaction_commit();
}
void virtio_device_stop_ioeventfd(VirtIODevice *vdev)
--
MST
- [Qemu-devel] [PULL v4 00/29] pc, pci, virtio: features, fixes, cleanups, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 01/29] MAINTAINERS: Add myself as maintainer to X86 machines, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 02/29] vhost-user: add new vhost user messages to support virtio config space, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 04/29] contrib/libvhost-user: enable virtio config space messages, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 03/29] vhost-user-blk: introduce a new vhost-user-blk host device, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 06/29] qemu: add a cleanup callback function to EventNotifier, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 08/29] virtio: improve virtio devices initialization time,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v4 07/29] virtio: postpone the execution of event_notifier_cleanup function, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 05/29] contrib/vhost-user-blk: introduce a vhost-user-blk sample application, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 09/29] pci/shpc: Move function to generic header file, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 10/29] vhost-user: fix multiple queue specification, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 11/29] intel-iommu: Redefine macros to enable supporting 48 bit address width, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 13/29] hw/pci-bridge: fix QEMU crash because of pcie-root-port, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 14/29] ACPI/unit-test: Add a testcase for RAM allocation in numa node, Michael S. Tsirkin, 2018/01/18
- [Qemu-devel] [PULL v4 12/29] intel-iommu: Extend address width to 48 bits, Michael S. Tsirkin, 2018/01/18