|
|
8b1478 |
From 64aa185d19f4e4afacd2501831049d6e615b5a84 Mon Sep 17 00:00:00 2001
|
|
|
8b1478 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
8b1478 |
Date: Tue, 16 Jul 2019 13:22:15 +0200
|
|
|
8b1478 |
Subject: [PATCH 22/23] virtio-scsi: restart DMA after iothread
|
|
|
8b1478 |
|
|
|
8b1478 |
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
8b1478 |
Message-id: <20190716132215.18503-4-stefanha@redhat.com>
|
|
|
8b1478 |
Patchwork-id: 89535
|
|
|
8b1478 |
O-Subject: [RHEL-7.8 RHEL-7.7.z qemu-kvm-rhev PATCH 3/3] virtio-scsi: restart DMA after iothread
|
|
|
8b1478 |
Bugzilla: 1673546
|
|
|
8b1478 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
8b1478 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
8b1478 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
8b1478 |
|
|
|
8b1478 |
When the 'cont' command resumes guest execution the vm change state
|
|
|
8b1478 |
handlers are invoked. Unfortunately there is no explicit ordering
|
|
|
8b1478 |
between classic qemu_add_vm_change_state_handler() callbacks. When two
|
|
|
8b1478 |
layers of code both use vm change state handlers, we don't control which
|
|
|
8b1478 |
handler runs first.
|
|
|
8b1478 |
|
|
|
8b1478 |
virtio-scsi with iothreads hits a deadlock when a failed SCSI command is
|
|
|
8b1478 |
restarted and completes before the iothread is re-initialized.
|
|
|
8b1478 |
|
|
|
8b1478 |
This patch uses the new qdev_add_vm_change_state_handler() API to
|
|
|
8b1478 |
guarantee that virtio-scsi's virtio change state handler executes before
|
|
|
8b1478 |
the SCSI bus children. This way DMA is restarted after the iothread has
|
|
|
8b1478 |
re-initialized.
|
|
|
8b1478 |
|
|
|
8b1478 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
8b1478 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
8b1478 |
(cherry picked from commit 1a8c091c4ea5db3126514e3f7df678c9ee328802)
|
|
|
8b1478 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
8b1478 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
8b1478 |
---
|
|
|
8b1478 |
hw/scsi/scsi-bus.c | 4 ++--
|
|
|
8b1478 |
hw/virtio/virtio.c | 4 ++--
|
|
|
8b1478 |
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
8b1478 |
|
|
|
8b1478 |
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
|
|
|
8b1478 |
index 5905f6b..ee4c449 100644
|
|
|
8b1478 |
--- a/hw/scsi/scsi-bus.c
|
|
|
8b1478 |
+++ b/hw/scsi/scsi-bus.c
|
|
|
8b1478 |
@@ -206,8 +206,8 @@ static void scsi_qdev_realize(DeviceState *qdev, Error **errp)
|
|
|
8b1478 |
error_propagate(errp, local_err);
|
|
|
8b1478 |
return;
|
|
|
8b1478 |
}
|
|
|
8b1478 |
- dev->vmsentry = qemu_add_vm_change_state_handler(scsi_dma_restart_cb,
|
|
|
8b1478 |
- dev);
|
|
|
8b1478 |
+ dev->vmsentry = qdev_add_vm_change_state_handler(DEVICE(dev),
|
|
|
8b1478 |
+ scsi_dma_restart_cb, dev);
|
|
|
8b1478 |
}
|
|
|
8b1478 |
|
|
|
8b1478 |
static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
|
|
|
8b1478 |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
|
8b1478 |
index 3492b20..08a4332 100644
|
|
|
8b1478 |
--- a/hw/virtio/virtio.c
|
|
|
8b1478 |
+++ b/hw/virtio/virtio.c
|
|
|
8b1478 |
@@ -2306,8 +2306,8 @@ void virtio_init(VirtIODevice *vdev, const char *name,
|
|
|
8b1478 |
} else {
|
|
|
8b1478 |
vdev->config = NULL;
|
|
|
8b1478 |
}
|
|
|
8b1478 |
- vdev->vmstate = qemu_add_vm_change_state_handler(virtio_vmstate_change,
|
|
|
8b1478 |
- vdev);
|
|
|
8b1478 |
+ vdev->vmstate = qdev_add_vm_change_state_handler(DEVICE(vdev),
|
|
|
8b1478 |
+ virtio_vmstate_change, vdev);
|
|
|
8b1478 |
vdev->device_endian = virtio_default_endian();
|
|
|
8b1478 |
vdev->use_guest_notifier_mask = true;
|
|
|
8b1478 |
}
|
|
|
8b1478 |
--
|
|
|
8b1478 |
1.8.3.1
|
|
|
8b1478 |
|