From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34059 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PHD31-0004R0-Ak for qemu-devel@nongnu.org; Sat, 13 Nov 2010 05:09:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PHD30-0006Ha-4D for qemu-devel@nongnu.org; Sat, 13 Nov 2010 05:09:27 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:33504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PHD2z-0006HS-MR for qemu-devel@nongnu.org; Sat, 13 Nov 2010 05:09:26 -0500 Message-ID: <4CDE63CD.8050505@web.de> Date: Sat, 13 Nov 2010 11:09:17 +0100 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] virtio-blk broken after system reset References: <4CDDB96F.7090301@web.de> <4CDE4396.8070708@web.de> <4CDE6200.4060600@msgid.tls.msk.ru> In-Reply-To: <4CDE6200.4060600@msgid.tls.msk.ru> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigB27CF8B2214BC2A68FC6EE94" Sender: jan.kiszka@web.de List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: Stefan Hajnoczi , Kevin O'Connor , qemu-devel , Gleb Natapov , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB27CF8B2214BC2A68FC6EE94 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am 13.11.2010 11:01, Michael Tokarev wrote: > 13.11.2010 10:51, Jan Kiszka wrote: >> Am 13.11.2010 08:49, Stefan Hajnoczi wrote: >>> On Fri, Nov 12, 2010 at 10:02 PM, Jan Kiszka wrot= e: >>>> Hi, >>>> >>>> both after hard and guest-initiated reset, something is seriously br= oken >>>> with virtio block devices. If I reset my Linux guest while still in >>>> grub, the bios will simply fail to read from the disk after the rebo= ot. If I >>>> reset after Linux touched the device, qemu terminates: >>>> >>>> Breakpoint 1, 0x00007ffff4b945b0 in _exit () from /lib64/libc.so.6 >>>> (gdb) bt >>>> #0 0x00007ffff4b945b0 in _exit () from /lib64/libc.so.6 >>>> #1 0x00007ffff4b2948d in __run_exit_handlers () from /lib64/libc.so= =2E6 >>>> #2 0x00007ffff4b29535 in exit () from /lib64/libc.so.6 >>>> #3 0x0000000000568da3 in virtqueue_num_heads (vq=3D0x17040e0, idx=3D= 0) at /data/qemu/hw/virtio.c:258 >>>> #4 0x0000000000569511 in virtqueue_pop (vq=3D0x17040e0, elem=3D0x17= cea58) at /data/qemu/hw/virtio.c:388 >>>> #5 0x0000000000419e31 in virtio_blk_get_request (s=3D0x1704010) at = /data/qemu/hw/virtio-blk.c:132 >>>> #6 virtio_blk_handle_output (vdev=3D0x1704010, vq=3D) at /data/qemu/hw/virtio-blk.c:369 >>>> > [] >> And what about the guest-triggerable qemu exit above? >=20 > There are _lots_ of guest-triggerable qemu exits out there. >=20 > static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx) > { > uint16_t num_heads =3D vring_avail_idx(vq) - idx; >=20 > /* Check it isn't doing very strange things with descriptor numbers= =2E */ > if (num_heads > vq->vring.num) { > fprintf(stderr, "Guest moved used index from %u to %u", > idx, vring_avail_idx(vq)); > exit(1); > } >=20 > return num_heads; > } >=20 > This is done when guest behaves insanely (or qemu thinks it does). > On a real hw similar behavour most likely will lead to a system > lockup, qemu just exits. There is also real hw out there that goes into an error state if it's misprogrammed. I think we have to remove all those premature exits. They also prevent handing the device inside the guest to an untrusted driver (relevant once we have IOMMU emulation). >=20 > Why it is trying to print things to stderr is a different > matter, it should be using a proper error-reporting routine, > but this is a different story. Jep. Even worse: the above message is not dumped to the console as the stream isn't flushed on exit. Jan --------------enigB27CF8B2214BC2A68FC6EE94 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAkzeY9IACgkQitSsb3rl5xRYLACeKxwsBkNPt+tXjoYjNJCy5DQ6 H0kAoILmUxZKJaIKbZvOsTXaB79jJiFM =YQmp -----END PGP SIGNATURE----- --------------enigB27CF8B2214BC2A68FC6EE94--