From: Christian Borntraeger <borntraeger@de.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
hangaohuai@huawei.com,
"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Alexander Graf <agraf@suse.de>,
Shannon Zhao <shannon.zhao@linaro.org>,
Shannon Zhao <zhaoshenglong@huawei.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Christoffer Dall <christoffer.dall@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v4 0/2] virtio: Move host features to backends
Date: Thu, 30 Apr 2015 17:50:08 +0200 [thread overview]
Message-ID: <55424F30.5080108@de.ibm.com> (raw)
In-Reply-To: <20150429221758-mutt-send-email-mst@redhat.com>
Am 29.04.2015 um 22:19 schrieb Michael S. Tsirkin:
[...]
>>
>> This commit made it work.
>>
>> commit 7a11370e5e6c26566904bb7f08281093a3002ff2
>> Author: Michael S. Tsirkin <mst@redhat.com>
>> Date: Wed Oct 15 10:22:30 2014 +1030
>>
>> virtio_blk: enable VQs early
>>
>> virtio spec requires drivers to set DRIVER_OK before using VQs.
>> This is set automatically after probe returns, virtio block violated this
>> rule by calling add_disk, which causes the VQ to be used directly within
>> probe.
>>
>> To fix, call virtio_device_ready before using VQs.
>>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>
> I guess this means s390 code somehow lost kicks that happened before
> DRIVER_OK. Without event index you would typically get another one on
> the next request.
The problem is that feature updates are not a synchronous op for this
transport. This transport syncs the guest feature bits (those from finalize)
on the set_status call. Before that qemu thinks that features are zero, which
means QEMU will not write the event index thus the 2nd kick will be lost.
This quick hack makes the problem go away with older kernels
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index 15b2c0f..25abb10 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -85,6 +85,14 @@ static int s390_virtio_hcall_notify(const uint64_t *args)
if (mem > ram_size) {
VirtIOS390Device *dev = s390_virtio_bus_find_vring(s390_bus, mem, &i);
if (dev) {
+ /*
+ * older kernels will use the virtqueue before setting DRIVER_OK.
+ * In this case the feature bits are not yet up to date, meaning
+ * that several funny things can happen, e.g. the guest thinks
+ * EVENT_IDX is on and QEMU thinks its off. Force a feature sync.
+ */
+ if (dev->vdev->status != VIRTIO_CONFIG_S_DRIVER_OK)
+ s390_virtio_device_update_status(dev);
virtio_queue_notify(dev->vdev, i);
} else {
r = -EINVAL;
Unless there are better ideas, I will respin that as a proper patch.
Christian
next prev parent reply other threads:[~2015-04-30 15:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 11:51 [Qemu-devel] [PATCH v4 0/2] virtio: Move host features to backends shannon.zhao
2015-04-28 11:51 ` [Qemu-devel] [PATCH v4 1/2] virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net shannon.zhao
2015-04-28 11:51 ` [Qemu-devel] [PATCH v4 2/2] virtio-scsi: Move DEFINE_VIRTIO_SCSI_FEATURES to virtio-scsi shannon.zhao
2015-04-28 12:48 ` [Qemu-devel] [PATCH v4 0/2] virtio: Move host features to backends Michael S. Tsirkin
2015-04-28 12:52 ` Peter Maydell
2015-04-28 13:05 ` Michael S. Tsirkin
2015-04-28 13:20 ` Cornelia Huck
2015-04-28 14:03 ` Michael S. Tsirkin
2015-04-28 13:06 ` Peter Maydell
2015-04-28 13:13 ` Michael S. Tsirkin
2015-04-28 13:16 ` Peter Maydell
2015-04-28 13:24 ` Cornelia Huck
2015-04-28 14:35 ` Michael S. Tsirkin
2015-04-28 18:14 ` Michael S. Tsirkin
2015-04-28 18:32 ` Michael S. Tsirkin
2015-04-28 18:35 ` Michael S. Tsirkin
2015-04-29 8:17 ` Christian Borntraeger
2015-04-29 8:52 ` Cornelia Huck
2015-04-29 10:32 ` Michael S. Tsirkin
2015-04-29 14:33 ` Cornelia Huck
2015-04-29 18:32 ` Michael S. Tsirkin
2015-04-29 14:43 ` Christian Borntraeger
2015-04-29 18:35 ` Michael S. Tsirkin
2015-04-29 19:49 ` Christian Borntraeger
2015-04-29 20:19 ` Michael S. Tsirkin
2015-04-30 15:50 ` Christian Borntraeger [this message]
2015-04-28 18:34 ` Peter Maydell
2015-04-28 18:38 ` Michael S. Tsirkin
2015-04-29 9:55 ` Shannon Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55424F30.5080108@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=agraf@suse.de \
--cc=christoffer.dall@linaro.org \
--cc=cornelia.huck@de.ibm.com \
--cc=hangaohuai@huawei.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhao@linaro.org \
--cc=zhaoshenglong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).