Regression: virtio-pci: convert to ioeventfd callbacks
Hi, with the above patch applied:
commit 9f06e71a567ba5ee8b727e65a2d5347fd331d2aa
Author: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200
virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
Peter
Quoted 9 lines · On Mon, 27 Jun 2016 11:44:47 +0200 Peter Lieven <[email protected]> wrote:
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
Hm, I had not played around with blk-mq...
Any chance you could run this in gdb and get some backtraces?
Quoted 9 lines · On Mon, 27 Jun 2016 11:44:47 +0200 Peter Lieven <[email protected]> wrote:
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
OK, I played around a bit with Stefan's block branch rebased upon current master (and the conflict fixed up)... and I can't seem to hit any error with virtio-ccw (will see if I find time to play around with virtio-pci; but unless I've messed up, this should be the same code path). VIRTIO_BLK_F_MQ is correctly negotiated if num_queues > 1, and I can use the disk.
So, two questions:
- Which branch are you using? Any chance of a mis-merge there?
- Can you share the interesting portion of your command line?
Am 27.06.2016 um 17:09 schrieb Cornelia Huck:
Quoted 19 lines
Quoted 9 lines · On Mon, 27 Jun 2016 11:44:47 +0200 Peter Lieven <[email protected]> wrote:
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
OK, I played around a bit with Stefan's block branch rebased upon current master (and the conflict fixed up)... and I can't seem to hit any error with virtio-ccw (will see if I find time to play around with virtio-pci; but unless I've messed up, this should be the same code path).
VIRTIO_BLK_F_MQis correctly negotiated ifnum_queues> 1, and I can use the disk.
Quoted 4 lines
So, two questions:
- Which branch are you using? Any chance of a mis-merge there?
- Can you share the interesting portion of your command line?
Hi Cornelia,
sorry I should have been a little more precise. I am using current master for git.qemu.org.
I tried around and I can only reproduce the regression with iSCSI *and* dataplane enabled. Here is the reproducing commandline for me.
./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -nodefaults -drive if=none,format=raw,file=iscsi://172.21.200.56/iqn.2001-05.com.equallogic:0-8a0906-98f384e0a-7d2004ee0a85767a-00lieven-test/0,cache=none,aio=native,id=disk0 -object iothread,id=iothread0 -device virtio-blk-pci,drive=disk0,iothread=iothread0 -vga vmware -monitor stdio
Have you the possiblity to install Ubuntu 14.04 on an iSCSI target?
Let me know if you need further information. Maybe the regression is an incompatiblity between the iSCSI driver and ioeventfd?
Thanks,
Peter
Quoted 20 lines · Cornelia Huck
Quoted 9 lines · On Mon, 27 Jun 2016 11:44:47 +0200 Peter Lieven <[email protected]> wrote:
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
OK, I played around a bit with Stefan's block branch rebased upon current master (and the conflict fixed up)... and I can't seem to hit any error with virtio-ccw (will see if I find time to play around with virtio-pci; but unless I've messed up, this should be the same code path).
VIRTIO_BLK_F_MQis correctly negotiated ifnum_queues> 1, and I can use the disk.
Quoted 3 lines
So, two questions:
- Which branch are you using? Any chance of a mis-merge there?
- Can you share the interesting portion of your command line?
I notice cleanup is a bit weird:
virtio_queue_set_host_notifier_fd_handler(vq, false, false);
k->ioeventfd_assign(proxy, notifier, n, assign);
event_notifier_cleanup(notifier);I think virtio_queue_set_host_notifier_fd_handler should happen after ioeventfd_assign for symmetry with init?
Signature · 1 line
MST
Quoted 27 lines · On Tue, 28 Jun 2016 08:22:05 +0200 Peter Lieven <[email protected]> wrote:
Am 27.06.2016 um 17:09 schrieb Cornelia Huck:
Quoted 19 lines
Quoted 9 lines · On Mon, 27 Jun 2016 11:44:47 +0200 Peter Lieven <[email protected]> wrote:
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
OK, I played around a bit with Stefan's block branch rebased upon current master (and the conflict fixed up)... and I can't seem to hit any error with virtio-ccw (will see if I find time to play around with virtio-pci; but unless I've messed up, this should be the same code path).
VIRTIO_BLK_F_MQis correctly negotiated ifnum_queues> 1, and I can use the disk.Quoted 4 lines
So, two questions:
- Which branch are you using? Any chance of a mis-merge there?
- Can you share the interesting portion of your command line?Hi Cornelia,
Quoted 7 lines
sorry I should have been a little more precise. I am using current master for git.qemu.org.
I tried around and I can only reproduce the regression with iSCSI *and* dataplane enabled. Here is the reproducing commandline for me.
./x86_64-softmmu/qemu-system-x86_64 -enable-kvm -nodefaults -drive if=none,format=raw,file=iscsi://172.21.200.56/iqn.2001-05.com.equallogic:0-8a0906-98f384e0a-7d2004ee0a85767a-00lieven-test/0,cache=none,aio=native,id=disk0 -object iothread,id=iothread0 -device virtio-blk-pci,drive=disk0,iothread=iothread0 -vga vmware -monitor stdio
Nothing really exciting there, maybe a timing issue triggered by the iscsi backing?
Quoted 2 lines
Have you the possiblity to install Ubuntu 14.04 on an iSCSI target?
No, I don't have any iscsi target available.
Quoted 2 lines
Let me know if you need further information. Maybe the regression is an incompatiblity between the iSCSI driver and ioeventfd?
Running in gdb and looking at the backchains may be helpful. Or checking in a guest dump whether there's any hang there instead. (Does this happen with guests other than Ubuntu 14.04, maybe with a similar kernel level?)
Quoted 8 lines · On Tue, 28 Jun 2016 10:03:21 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
I notice cleanup is a bit weird:
virtio_queue_set_host_notifier_fd_handler(vq, false, false); k->ioeventfd_assign(proxy, notifier, n, assign); event_notifier_cleanup(notifier);I think
virtio_queue_set_host_notifier_fd_handlershould happen afterioeventfd_assignfor symmetry with init?
Looking at the pre-rework code, ccw used the order now in common code, while pci and mmio used the order you suggest.
"Switch the handler back, then unassign the transport's ioeventfd backing" made more sense to me (regardless of symmetry) - but we might lose a notification?
Peter: Can you check whether your problem goes away if you switch the two lines around?
Am 28.06.2016 um 09:42 schrieb Cornelia Huck:
Quoted 14 lines
Quoted 8 lines · On Tue, 28 Jun 2016 10:03:21 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
I notice cleanup is a bit weird:
virtio_queue_set_host_notifier_fd_handler(vq, false, false); k->ioeventfd_assign(proxy, notifier, n, assign); event_notifier_cleanup(notifier);I think
virtio_queue_set_host_notifier_fd_handlershould happen afterioeventfd_assignfor symmetry with init?Looking at the pre-rework code, ccw used the order now in common code, while pci and mmio used the order you suggest.
Quoted 7 lines
"Switch the handler back, then unassign the transport's ioeventfd backing" made more sense to me (regardless of symmetry) - but we might lose a notification?
Peter: Can you check whether your problem goes away if you switch the two lines around?
The problem goes away, but its horribly slow. Maybe the lost notifications you were thinking off.
hw/virtio/virtio-bus.c +1 -1
@@ -176,9 +176,9 @@ static int set_host_notifier_internal(DeviceState *proxy, VirtioBusState *bus,return r; } }else { -virtio_queue_set_host_notifier_fd_handler (vq, false, false); k->ioeventfd_assign (proxy, notifier, n, assign);event_notifier_cleanup (notifier); +virtio_queue_set_host_notifier_fd_handler (vq, false, false); }return r; }
Peter
Quoted 19 lines · On Tue, 28 Jun 2016 09:47:01 +0200 Peter Lieven <[email protected]> wrote:
Am 28.06.2016 um 09:42 schrieb Cornelia Huck:
Quoted 18 lines
Quoted 8 lines · On Tue, 28 Jun 2016 10:03:21 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
I notice cleanup is a bit weird:
virtio_queue_set_host_notifier_fd_handler(vq, false, false); k->ioeventfd_assign(proxy, notifier, n, assign); event_notifier_cleanup(notifier);I think
virtio_queue_set_host_notifier_fd_handlershould happen afterioeventfd_assignfor symmetry with init?Looking at the pre-rework code, ccw used the order now in common code, while pci and mmio used the order you suggest.
"Switch the handler back, then unassign the transport's ioeventfd backing" made more sense to me (regardless of symmetry) - but we might lose a notification?
Quoted 6 lines
Quoted 3 lines
Peter: Can you check whether your problem goes away if you switch the two lines around?
The problem goes away, but its horribly slow. Maybe the lost notifications you were thinking off.
It points into that direction.
hw/virtio/virtio-bus.c static int set_host_notifier_internal(DeviceState *proxy, VirtioBusState *bus, · line 179
Quoted 11 lines
hw/virtio/virtio-bus.c +0
-1@@ -176,9 +176,9 @@ static int set_host_notifier_internal(DeviceState *proxy, VirtioBusState *bus,return r; } }else { -virtio_queue_set_host_notifier_fd_handler (vq, false, false); k->ioeventfd_assign (proxy, notifier, n, assign);
The virtio_queue_...() should go here.
Quoted 8 lines
hw/virtio/virtio-bus.c +1
-0event_notifier_cleanup (notifier); +virtio_queue_set_host_notifier_fd_handler (vq, false, false); }return r; }Peter
Quoted 2 lines · On Tue, 28 Jun 2016 09:47:01 +0200 Peter Lieven <[email protected]> wrote:
The problem goes away, but its horribly slow. Maybe the lost notifications you were thinking off.
I have the following patch (works for me on ccw as well). I'm worried about the slowness you're seeing, though. Is this just with an iscsi backing?
From a62e1518fa9c8a68c27d6997d8ca8fccf6152d1e Mon Sep 17 00:00:00 2001
From: Cornelia Huck <[email protected]>
Date: Tue, 28 Jun 2016 10:04:52 +0200
Subject: [PATCH] virtio: deassign ioeventfd before resetting handler
We should unassign the transport's ioeventfd backing before resetting the handler, or we may use notifications.
--- hw/virtio/virtio-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-bus.c +1 -1
@@ -176,8 +176,8 @@ static int set_host_notifier_internal(DeviceState *proxy, VirtioBusState *bus,return r; } }else { -virtio_queue_set_host_notifier_fd_handler (vq, false, false); k->ioeventfd_assign (proxy, notifier, n, assign); +virtio_queue_set_host_notifier_fd_handler (vq, false, false);event_notifier_cleanup (notifier); }return r;
Signature · 1 line
2.9.0
Am 28.06.2016 um 10:16 schrieb Cornelia Huck:
Quoted 8 lines
Quoted 2 lines · On Tue, 28 Jun 2016 09:47:01 +0200 Peter Lieven <[email protected]> wrote:
The problem goes away, but its horribly slow. Maybe the lost notifications you were thinking off.
I have the following patch (works for me on ccw as well). I'm worried about the slowness you're seeing, though. Is this just with an iscsi backing?
Strange enough now neither my nor your version of the fix work for me anymore...
I can only reproduce with iSCSI. Neither QCOW2, RAW or NBD work.
I think it could have to do with the iSCSI event handler.
Peter
Quoted 13 lines · Peter Lieven
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
Peter
In fact, I notice vhost-net does not work for master, look like we are trying to set host notifier without initialization which seems a bug
Quoted 14 lines · On Wed, 29 Jun 2016 09:41:50 +0800 Jason Wang <[email protected]> wrote:
Quoted 11 lines · Peter Lieven
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
Quoted 7 lines
Quoted 3 lines
Peter
In fact, I notice vhost-net does not work for master, look like we are trying to set host notifier without initialization which seems a bug
Does the patch in <[email protected]> help?
Quoted 16 lines · Cornelia Huck
Quoted 13 lines · On Wed, 29 Jun 2016 09:41:50 +0800 Jason Wang <[email protected]> wrote:
Quoted 11 lines · Peter Lieven
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Peter
In fact, I notice vhost-net does not work for master, look like we are trying to set host notifier without initialization which seems a bug
Does the patch in <[email protected]> help?
It doesn't help.
Thanks
Quoted 22 lines · On Wed, 29 Jun 2016 16:21:07 +0800 Jason Wang <[email protected]> wrote:
Quoted 19 lines · Cornelia Huck
Quoted 16 lines · On Wed, 29 Jun 2016 09:41:50 +0800 Jason Wang <[email protected]> wrote:
Quoted 14 lines · Peter Lieven
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
Peter
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
In fact, I notice vhost-net does not work for master, look like we are trying to set host notifier without initialization which seems a bug
Does the patch in <[email protected]> help?
It doesn't help.
Thanks for checking.
Debugging. This is broken here (virtio-ccw) as well.
Quoted 12 lines · On Wed, 29 Jun 2016 09:41:50 +0800 Jason Wang <[email protected]> wrote:
Quoted 11 lines · Peter Lieven
Hi, with the above patch applied:
commit
9f06e71a567ba5ee8b727e65a2d5347fd331d2aaAuthor: Cornelia Huck <[email protected]> Date: Fri Jun 10 11:04:12 2016 +0200virtio-pci: convert to ioeventfd callbacks
a Ubuntu 14.04 VM freezes at startup when blk-mq is set up - even if there is only one queue.
Quoted 6 lines
Quoted 3 lines
Peter
In fact, I notice vhost-net does not work for master, look like we are trying to set host notifier without initialization which seems a bug
Yes, that's the problem: We switch handlers, but the notifier has not yet been setup (that's different from the dataplane call sequence). I think we need to setup the notifier without touching the handler for that case. I'm working on a patch.