From patchwork Thu Apr 30 15:50:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 466620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B2E8A140320 for ; Fri, 1 May 2015 01:53:31 +1000 (AEST) Received: from localhost ([::1]:44660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnqmH-0002Bx-RG for incoming@patchwork.ozlabs.org; Thu, 30 Apr 2015 11:53:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnqjC-0004kg-8r for qemu-devel@nongnu.org; Thu, 30 Apr 2015 11:50:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ynqj9-0000ee-1x for qemu-devel@nongnu.org; Thu, 30 Apr 2015 11:50:18 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:32855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ynqj8-0000eN-Op for qemu-devel@nongnu.org; Thu, 30 Apr 2015 11:50:14 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Apr 2015 16:50:12 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 30 Apr 2015 16:50:11 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4A4C32190061 for ; Thu, 30 Apr 2015 16:49:52 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t3UFo9t562390470 for ; Thu, 30 Apr 2015 15:50:09 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t3UFo9kH006674 for ; Thu, 30 Apr 2015 09:50:09 -0600 Received: from oc1450873852.ibm.com (sig-9-81-109-64.evts.de.ibm.com [9.81.109.64]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t3UFo8gO006649; Thu, 30 Apr 2015 09:50:08 -0600 Message-ID: <55424F30.5080108@de.ibm.com> Date: Thu, 30 Apr 2015 17:50:08 +0200 From: Christian Borntraeger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "Michael S. Tsirkin" References: <20150428152419.67bc77b1.cornelia.huck@de.ibm.com> <20150428160354-mutt-send-email-mst@redhat.com> <20150428201255-mutt-send-email-mst@redhat.com> <20150428203016-mutt-send-email-mst@redhat.com> <554093B3.2080205@de.ibm.com> <20150429105215.0a1122f2.cornelia.huck@de.ibm.com> <20150429103204.GA12976@redhat.com> <5540EE07.6020502@de.ibm.com> <20150429203525-mutt-send-email-mst@redhat.com> <554135E1.8040509@de.ibm.com> <20150429221758-mutt-send-email-mst@redhat.com> In-Reply-To: <20150429221758-mutt-send-email-mst@redhat.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15043015-0041-0000-0000-000004413777 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.107 Cc: Peter Maydell , hangaohuai@huawei.com, "Huangpeng \(Peter\)" , QEMU Developers , Alexander Graf , Shannon Zhao , Shannon Zhao , Cornelia Huck , Paolo Bonzini , Christoffer Dall Subject: Re: [Qemu-devel] [PATCH v4 0/2] virtio: Move host features to backends X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Am 29.04.2015 um 22:19 schrieb Michael S. Tsirkin: [...] >> >> This commit made it work. >> >> commit 7a11370e5e6c26566904bb7f08281093a3002ff2 >> Author: Michael S. Tsirkin >> 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 >> Reviewed-by: Cornelia Huck >> Signed-off-by: Rusty Russell > > 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 Unless there are better ideas, I will respin that as a proper patch. Christian 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;