From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmJjL-0004gC-Jt for qemu-devel@nongnu.org; Tue, 20 Sep 2016 08:01:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmJjH-0006xf-1K for qemu-devel@nongnu.org; Tue, 20 Sep 2016 08:00:54 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55478 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmJjG-0006x9-QP for qemu-devel@nongnu.org; Tue, 20 Sep 2016 08:00:50 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8KBwEQ3049282 for ; Tue, 20 Sep 2016 08:00:50 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 25jua87jk0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 20 Sep 2016 08:00:50 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Sep 2016 13:00:48 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 273091B0804B for ; Tue, 20 Sep 2016 13:02:36 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8KC0i6n25427986 for ; Tue, 20 Sep 2016 12:00:44 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u8KC0iM9004806 for ; Tue, 20 Sep 2016 08:00:44 -0400 Date: Tue, 20 Sep 2016 14:00:43 +0200 From: Cornelia Huck In-Reply-To: <20160920112657.39cf44ab@bahia> References: <1460467534-29147-1-git-send-email-stefanha@redhat.com> <20160919180740.6a21408e.cornelia.huck@de.ibm.com> <20160919205057-mutt-send-email-mst@kernel.org> <983e6ea4-c0fd-fad1-9027-c913c2faf796@redhat.com> <20160920112657.39cf44ab@bahia> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20160920140043.660afdd0.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH v3 00/10] virtio: avoid exit() when device enters invalid states List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: Laszlo Ersek , "Michael S. Tsirkin" , Fam Zheng , qemu-devel@nongnu.org, Stefan Hajnoczi , Prasad Pandit On Tue, 20 Sep 2016 11:26:57 +0200 Greg Kurz wrote: > Stefan's series still applies on the current head, except the virtio_config.h > patch which isn't needed anymore. I went through the patches, series generally looks good to me. > > And indeed there are a bunch of places where QEMU exits: Most of which should be converted to virtio_error(), except... > > [greg@bahia qemu-virtio]$ git grep 'exit(1)' hw/virtio hw/*/virtio* > hw/block/virtio-blk.c: exit(1); > hw/block/virtio-blk.c: exit(1); > hw/block/virtio-blk.c: exit(1); > hw/net/virtio-net.c: exit(1); > hw/net/virtio-net.c: exit(1); > hw/net/virtio-net.c: exit(1); > hw/net/virtio-net.c: exit(1); > hw/net/virtio-net.c: exit(1); > hw/scsi/virtio-scsi-dataplane.c: exit(1); ...this one, which tests for a host misconfiguration, and... > hw/scsi/virtio-scsi.c: exit(1); > hw/scsi/virtio-scsi.c: exit(1); ...this one, which is a migration stream problem. > hw/scsi/virtio-scsi.c: exit(1); > hw/virtio/virtio.c: exit(1); > hw/virtio/virtio.c: exit(1); > hw/virtio/virtio.c: exit(1); > hw/virtio/virtio.c: exit(1); > > And also even more places with assert() or BUG_ON(), some of which are > guest errors actually. Yes. Let's tackle them piece-by-piece. > > For example, in virtio-9p, we have: > > static void handle_9p_output(VirtIODevice *vdev, VirtQueue *vq) > { > ... > len = iov_to_buf(elem->out_sg, elem->out_num, 0, > &out, sizeof out); > BUG_ON(len != sizeof out); > ... > } > > The condition may only be true if the guest sent less than the expected > 9P message header which is 7-byte long. > > I have a patch for this based on Stefan's series BTW. Cool.