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