* [Qemu-devel] [PATCH] vhost: fix miration during device start
@ 2010-07-16 14:11 Michael S. Tsirkin
2010-07-16 14:23 ` [Qemu-devel] " Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-07-16 14:11 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
We need to know ring layout to allocate log buffer.
So init rings first.
Also fixes a theoretical memory-leak-on-error.
https://bugzilla.redhat.com/show_bug.cgi?id=615228
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
diff --git a/hw/vhost.c b/hw/vhost.c
index d37a66e..25cb9f5 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -659,6 +659,16 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
r = -errno;
goto fail;
}
+ for (i = 0; i < hdev->nvqs; ++i) {
+ r = vhost_virtqueue_init(hdev,
+ vdev,
+ hdev->vqs + i,
+ i);
+ if (r < 0) {
+ goto fail_vq;
+ }
+ }
+
if (hdev->log_enabled) {
hdev->log_size = vhost_get_log_size(hdev);
hdev->log = hdev->log_size ?
@@ -671,15 +681,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
}
}
- for (i = 0; i < hdev->nvqs; ++i) {
- r = vhost_virtqueue_init(hdev,
- vdev,
- hdev->vqs + i,
- i);
- if (r < 0) {
- goto fail_vq;
- }
- }
hdev->started = true;
return 0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] Re: [PATCH] vhost: fix miration during device start
2010-07-16 14:11 [Qemu-devel] [PATCH] vhost: fix miration during device start Michael S. Tsirkin
@ 2010-07-16 14:23 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2010-07-16 14:23 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-devel
On 07/16/10 16:11, Michael S. Tsirkin wrote:
> We need to know ring layout to allocate log buffer.
> So init rings first.
>
> Also fixes a theoretical memory-leak-on-error.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=615228
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
Fixes the bug for me.
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
cheers,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-16 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-16 14:11 [Qemu-devel] [PATCH] vhost: fix miration during device start Michael S. Tsirkin
2010-07-16 14:23 ` [Qemu-devel] " Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).