|
|
9ae3a8 |
From f1ae5247cd1de4374905421e105d371aea6d7c75 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 5 Mar 2014 14:15:03 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 01/16] dataplane: Fix startup race.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1394028903-5087-1-git-send-email-stefanha@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 58018
|
|
|
9ae3a8 |
O-Subject: [RHEL7 qemu-kvm PATCH] dataplane: Fix startup race.
|
|
|
9ae3a8 |
Bugzilla: 1069541
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Cornelia Huck <cornelia.huck@de.ibm.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1069541
|
|
|
9ae3a8 |
Upstream: 8caf907f07688972e5e7cd11526079b1665d6dba
|
|
|
9ae3a8 |
BREW: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7144761
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Avoid trying to setup dataplane again if dataplane setup is already in
|
|
|
9ae3a8 |
progress. This may happen if an eventfd is triggered during setup.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
I saw this occasionally with an experimental s390 irqfd implementation:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
virtio_blk_handle_output
|
|
|
9ae3a8 |
-> virtio_blk_data_plane_start
|
|
|
9ae3a8 |
-> virtio_ccw_set_host_notifier
|
|
|
9ae3a8 |
...
|
|
|
9ae3a8 |
-> virtio_queue_set_host_notifier_fd_handler
|
|
|
9ae3a8 |
-> virtio_queue_host_notifier_read
|
|
|
9ae3a8 |
-> virtio_queue_notify_vq
|
|
|
9ae3a8 |
-> virtio_blk_handle_output
|
|
|
9ae3a8 |
-> virtio_blk_data_plane_start
|
|
|
9ae3a8 |
-> vring_setup
|
|
|
9ae3a8 |
-> hostmem_init
|
|
|
9ae3a8 |
-> memory_listener_register
|
|
|
9ae3a8 |
-> BOOM
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
As virtio-ccw tries to follow what virtio-pci does, it might be triggerable
|
|
|
9ae3a8 |
for other platforms as well.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 8caf907f07688972e5e7cd11526079b1665d6dba)
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
[----] : patches are identical
|
|
|
9ae3a8 |
[####] : number of functional differences between upstream/downstream patch
|
|
|
9ae3a8 |
[down] : patch is downstream-only
|
|
|
9ae3a8 |
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
001/1:[----] [-C] 'dataplane: Fix startup race.'
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
hw/block/dataplane/virtio-blk.c | 9 +++++++++
|
|
|
9ae3a8 |
1 file changed, 9 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/block/dataplane/virtio-blk.c | 9 +++++++++
|
|
|
9ae3a8 |
1 files changed, 9 insertions(+), 0 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
|
|
|
9ae3a8 |
index 411becc..0b002ba 100644
|
|
|
9ae3a8 |
--- a/hw/block/dataplane/virtio-blk.c
|
|
|
9ae3a8 |
+++ b/hw/block/dataplane/virtio-blk.c
|
|
|
9ae3a8 |
@@ -42,6 +42,7 @@ typedef struct {
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
struct VirtIOBlockDataPlane {
|
|
|
9ae3a8 |
bool started;
|
|
|
9ae3a8 |
+ bool starting;
|
|
|
9ae3a8 |
bool stopping;
|
|
|
9ae3a8 |
QEMUBH *start_bh;
|
|
|
9ae3a8 |
QemuThread thread;
|
|
|
9ae3a8 |
@@ -464,8 +465,15 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ if (s->starting) {
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ s->starting = true;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
vq = virtio_get_queue(s->vdev, 0);
|
|
|
9ae3a8 |
if (!vring_setup(&s->vring, s->vdev, 0)) {
|
|
|
9ae3a8 |
+ s->starting = false;
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -495,6 +503,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
|
|
|
9ae3a8 |
s->io_notifier = *ioq_get_notifier(&s->ioqueue);
|
|
|
9ae3a8 |
aio_set_event_notifier(s->ctx, &s->io_notifier, handle_io, flush_io);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ s->starting = false;
|
|
|
9ae3a8 |
s->started = true;
|
|
|
9ae3a8 |
trace_virtio_blk_data_plane_start(s);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|