]> Git Repo - qemu.git/commitdiff
vhost-user: fix duplicated notifier MR init
authorXueming Li <[email protected]>
Fri, 8 Oct 2021 08:02:15 +0000 (16:02 +0800)
committerMichael S. Tsirkin <[email protected]>
Wed, 20 Oct 2021 08:37:55 +0000 (04:37 -0400)
In case of device resume after suspend, VQ notifier MR still valid.
Duplicated registrations explode memory block list and slow down device
resume.

Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers")
Cc: [email protected]
Cc: [email protected]
Cc: Yuwei Zhang <[email protected]>
Signed-off-by: Xueming Li <[email protected]>
Message-Id: <20211008080215[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/virtio/vhost-user.c

index 2c8556237fbe924798c6f69ef03e693016cb8337..bf6e50223cb49d27fa428e442f3aa9c4948e79dd 100644 (file)
@@ -1526,8 +1526,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,
 
     name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]",
                            user, queue_idx);
-    memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
-                                      page_size, addr);
+    if (!n->mr.ram) /* Don't init again after suspend. */
+        memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name,
+                                          page_size, addr);
     g_free(name);
 
     if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) {
This page took 0.028747 seconds and 4 git commands to generate.