[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/13] vhost: fix memslot limit check
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 06/13] vhost: fix memslot limit check |
Date: |
Thu, 1 Mar 2018 18:46:02 +0200 |
From: Jay Zhou <address@hidden>
Since used_memslots will be updated to the actual value after
registering memory listener for the first time, move the
memslots limit checking to the right place.
Reviewed-by: Igor Mammedov <address@hidden>
Signed-off-by: Jay Zhou <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/vhost.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 4a44e6e..4a583a3 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1106,13 +1106,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
goto fail;
}
- if (used_memslots > hdev->vhost_ops->vhost_backend_memslots_limit(hdev)) {
- error_report("vhost backend memory slots limit is less"
- " than current number of present memory slots");
- r = -1;
- goto fail;
- }
-
r = hdev->vhost_ops->vhost_set_owner(hdev);
if (r < 0) {
VHOST_OPS_DEBUG("vhost_set_owner failed");
@@ -1192,6 +1185,18 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
hdev->started = false;
memory_listener_register(&hdev->memory_listener, &address_space_memory);
QLIST_INSERT_HEAD(&vhost_devices, hdev, entry);
+
+ if (used_memslots > hdev->vhost_ops->vhost_backend_memslots_limit(hdev)) {
+ error_report("vhost backend memory slots limit is less"
+ " than current number of present memory slots");
+ r = -1;
+ if (busyloop_timeout) {
+ goto fail_busyloop;
+ } else {
+ goto fail;
+ }
+ }
+
return 0;
fail_busyloop:
--
MST
- [Qemu-devel] [PULL 00/13] virtio, vhost, pci, pc: features, fixes and cleanups, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 03/13] intel-iommu: Accept 64-bit writes to FEADDR, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 01/13] vhost-user: fix memory leak, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 02/13] virtio-pci: trivial fixes in error message, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 04/13] docs: document virtio-balloon stats, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 09/13] docs/vmcoreinfo: detail unsupported host format behaviour, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 05/13] docs: pcie: Spell out machine type needs for PCIe features, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 06/13] vhost: fix memslot limit check,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 11/13] cryptodev: add vhost support, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 10/13] cryptodev: add vhost-user as a new cryptodev backend, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 07/13] vhost: avoid to start/stop virtqueue which is not ready, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 08/13] vhost: fix incorrect check in vhost_verify_ring_mappings, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 13/13] cryptodev-vhost-user: set the key length, Michael S. Tsirkin, 2018/03/01
- [Qemu-devel] [PULL 12/13] cryptodev-vhost-user: add crypto session handler, Michael S. Tsirkin, 2018/03/01
- Re: [Qemu-devel] [PULL 00/13] virtio, vhost, pci, pc: features, fixes and cleanups, no-reply, 2018/03/01
- Re: [Qemu-devel] [PULL 00/13] virtio, vhost, pci, pc: features, fixes and cleanups, no-reply, 2018/03/01
- Re: [Qemu-devel] [PULL 00/13] virtio, vhost, pci, pc: features, fixes and cleanups, Peter Maydell, 2018/03/02