|
Pablo Greco |
e6a3ae |
From 93a7832d5dfd83f170119e7130f3968fe37fa8e6 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
e6a3ae |
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Date: Fri, 13 Sep 2019 14:16:25 +0100
|
|
Pablo Greco |
e6a3ae |
Subject: [PATCH 08/22] virtio-blk: Cancel the pending BH when the dataplane is
|
|
Pablo Greco |
e6a3ae |
reset
|
|
Pablo Greco |
e6a3ae |
MIME-Version: 1.0
|
|
Pablo Greco |
e6a3ae |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
e6a3ae |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
RH-Author: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: <20190913141625.12521-2-philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Patchwork-id: 90453
|
|
Pablo Greco |
e6a3ae |
O-Subject: [RHEL-7.7.z qemu-kvm-rhev + RHEL-8.1.0 qemu-kvm + RHEL-AV-8.1.0 qemu-kvm PATCH v2 1/1] virtio-blk: Cancel the pending BH when the dataplane is reset
|
|
Pablo Greco |
e6a3ae |
Bugzilla: 1708459
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
When 'system_reset' is called, the main loop clear the memory
|
|
Pablo Greco |
e6a3ae |
region cache before the BH has a chance to execute. Later when
|
|
Pablo Greco |
e6a3ae |
the deferred function is called, some assumptions that were
|
|
Pablo Greco |
e6a3ae |
made when scheduling them are no longer true when they actually
|
|
Pablo Greco |
e6a3ae |
execute.
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
This is what happens using a virtio-blk device (fresh RHEL7.8 install):
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
$ (sleep 12.3; echo system_reset; sleep 12.3; echo system_reset; sleep 1; echo q) \
|
|
Pablo Greco |
e6a3ae |
| qemu-system-x86_64 -m 4G -smp 8 -boot menu=on \
|
|
Pablo Greco |
e6a3ae |
-device virtio-blk-pci,id=image1,drive=drive_image1 \
|
|
Pablo Greco |
e6a3ae |
-drive file=/var/lib/libvirt/images/rhel78.qcow2,if=none,id=drive_image1,format=qcow2,cache=none \
|
|
Pablo Greco |
e6a3ae |
-device virtio-net-pci,netdev=net0,id=nic0,mac=52:54:00:c4:e7:84 \
|
|
Pablo Greco |
e6a3ae |
-netdev tap,id=net0,script=/bin/true,downscript=/bin/true,vhost=on \
|
|
Pablo Greco |
e6a3ae |
-monitor stdio -serial null -nographic
|
|
Pablo Greco |
e6a3ae |
(qemu) system_reset
|
|
Pablo Greco |
e6a3ae |
(qemu) system_reset
|
|
Pablo Greco |
e6a3ae |
(qemu) qemu-system-x86_64: hw/virtio/virtio.c:225: vring_get_region_caches: Assertion `caches != NULL' failed.
|
|
Pablo Greco |
e6a3ae |
Aborted
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
(gdb) bt
|
|
Pablo Greco |
e6a3ae |
Thread 1 (Thread 0x7f109c17b680 (LWP 10939)):
|
|
Pablo Greco |
e6a3ae |
#0 0x00005604083296d1 in vring_get_region_caches (vq=0x56040a24bdd0) at hw/virtio/virtio.c:227
|
|
Pablo Greco |
e6a3ae |
#1 0x000056040832972b in vring_avail_flags (vq=0x56040a24bdd0) at hw/virtio/virtio.c:235
|
|
Pablo Greco |
e6a3ae |
#2 0x000056040832d13d in virtio_should_notify (vdev=0x56040a240630, vq=0x56040a24bdd0) at hw/virtio/virtio.c:1648
|
|
Pablo Greco |
e6a3ae |
#3 0x000056040832d1f8 in virtio_notify_irqfd (vdev=0x56040a240630, vq=0x56040a24bdd0) at hw/virtio/virtio.c:1662
|
|
Pablo Greco |
e6a3ae |
#4 0x00005604082d213d in notify_guest_bh (opaque=0x56040a243ec0) at hw/block/dataplane/virtio-blk.c:75
|
|
Pablo Greco |
e6a3ae |
#5 0x000056040883dc35 in aio_bh_call (bh=0x56040a243f10) at util/async.c:90
|
|
Pablo Greco |
e6a3ae |
#6 0x000056040883dccd in aio_bh_poll (ctx=0x560409161980) at util/async.c:118
|
|
Pablo Greco |
e6a3ae |
#7 0x0000560408842af7 in aio_dispatch (ctx=0x560409161980) at util/aio-posix.c:460
|
|
Pablo Greco |
e6a3ae |
#8 0x000056040883e068 in aio_ctx_dispatch (source=0x560409161980, callback=0x0, user_data=0x0) at util/async.c:261
|
|
Pablo Greco |
e6a3ae |
#9 0x00007f10a8fca06d in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
|
|
Pablo Greco |
e6a3ae |
#10 0x0000560408841445 in glib_pollfds_poll () at util/main-loop.c:215
|
|
Pablo Greco |
e6a3ae |
#11 0x00005604088414bf in os_host_main_loop_wait (timeout=0) at util/main-loop.c:238
|
|
Pablo Greco |
e6a3ae |
#12 0x00005604088415c4 in main_loop_wait (nonblocking=0) at util/main-loop.c:514
|
|
Pablo Greco |
e6a3ae |
#13 0x0000560408416b1e in main_loop () at vl.c:1923
|
|
Pablo Greco |
e6a3ae |
#14 0x000056040841e0e8 in main (argc=20, argv=0x7ffc2c3f9c58, envp=0x7ffc2c3f9d00) at vl.c:4578
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Fix this by cancelling the BH when the virtio dataplane is stopped.
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
[This is version of the patch was modified as discussed with Philippe on
|
|
Pablo Greco |
e6a3ae |
the mailing list thread.
|
|
Pablo Greco |
e6a3ae |
--Stefan]
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Reported-by: Yihuang Yu <yihyu@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Fixes: https://bugs.launchpad.net/qemu/+bug/1839428
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-Id: <20190816171503.24761-1-philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Pablo Greco |
e6a3ae |
(cherry picked from commit ebb6ff25cd888a52a64a9adc3692541c6d1d9a42)
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
Pablo Greco |
e6a3ae |
---
|
|
Pablo Greco |
e6a3ae |
hw/block/dataplane/virtio-blk.c | 3 +++
|
|
Pablo Greco |
e6a3ae |
1 file changed, 3 insertions(+)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
|
|
Pablo Greco |
e6a3ae |
index 101f32c..23e4022 100644
|
|
Pablo Greco |
e6a3ae |
--- a/hw/block/dataplane/virtio-blk.c
|
|
Pablo Greco |
e6a3ae |
+++ b/hw/block/dataplane/virtio-blk.c
|
|
Pablo Greco |
e6a3ae |
@@ -292,6 +292,9 @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev)
|
|
Pablo Greco |
e6a3ae |
virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
+ qemu_bh_cancel(s->bh);
|
|
Pablo Greco |
e6a3ae |
+ notify_guest_bh(s); /* final chance to notify guest */
|
|
Pablo Greco |
e6a3ae |
+
|
|
Pablo Greco |
e6a3ae |
/* Clean up guest notifier (irq) */
|
|
Pablo Greco |
e6a3ae |
k->set_guest_notifiers(qbus->parent, nvqs, false);
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
--
|
|
Pablo Greco |
e6a3ae |
1.8.3.1
|
|
Pablo Greco |
e6a3ae |
|