[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/47] vhost-user: fix duplicated notifier MR init
From: |
Michael Roth |
Subject: |
[PATCH 08/47] vhost-user: fix duplicated notifier MR init |
Date: |
Tue, 14 Dec 2021 18:00:46 -0600 |
From: Xueming Li <xuemingl@nvidia.com>
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: tiwei.bie@intel.com
Cc: qemu-stable@nongnu.org
Cc: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit a1ed9ef1de87c3e86ff68589604298ec90875a14)
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
hw/virtio/vhost-user.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index aec6cc1990..7b35c5d71d 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1469,8 +1469,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)) {
--
2.25.1
- [PATCH 42/47] hw/block/fdc: Extract blk_create_empty_drive(), (continued)
- [PATCH 42/47] hw/block/fdc: Extract blk_create_empty_drive(), Michael Roth, 2021/12/14
- [PATCH 43/47] hw/block/fdc: Kludge missing floppy drive to fix CVE-2021-20196, Michael Roth, 2021/12/14
- [PATCH 44/47] tests/qtest/fdc-test: Add a regression test for CVE-2021-20196, Michael Roth, 2021/12/14
- [PATCH 45/47] virtio-blk: Fix clean up of host notifiers for single MR transaction., Michael Roth, 2021/12/14
- [PATCH 46/47] net: vmxnet3: validate configuration values during activate (CVE-2021-20203), Michael Roth, 2021/12/14
- [PATCH 47/47] e1000: fix tx re-entrancy problem, Michael Roth, 2021/12/14
- [PATCH 04/47] qemu-nbd: Change default cache mode to writeback, Michael Roth, 2021/12/14
- [PATCH 05/47] hmp: Unbreak "change vnc", Michael Roth, 2021/12/14
- [PATCH 06/47] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event, Michael Roth, 2021/12/14
- [PATCH 07/47] uas: add stream number sanity checks., Michael Roth, 2021/12/14
- [PATCH 08/47] vhost-user: fix duplicated notifier MR init,
Michael Roth <=
- Re: [PATCH 00/47] Patch Round-up for stable 6.1.1, freeze on 2021-12-21, Daniel P . Berrangé, 2021/12/15
- Re: [PATCH 00/47] Patch Round-up for stable 6.1.1, freeze on 2021-12-21, Michael Roth, 2021/12/20