From: Kevin Wolf <kwolf@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
Gleb Natapov <gleb@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Michael Tokarev <mjt@tls.msk.ru>,
qemu-devel <qemu-devel@nongnu.org>,
Kevin O'Connor <kevin@koconnor.net>
Subject: Re: [Qemu-devel] virtio-blk broken after system reset
Date: Mon, 15 Nov 2010 11:42:41 +0100 [thread overview]
Message-ID: <4CE10EA1.2080702@redhat.com> (raw)
In-Reply-To: <4CDE63CD.8050505@web.de>
Am 13.11.2010 11:09, schrieb Jan Kiszka:
> 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 <jan.kiszka@web.de> wrote:
>>>>> Hi,
>>>>>
>>>>> both after hard and guest-initiated reset, something is seriously broken
>>>>> 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 reboot. 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.6
>>>>> #2 0x00007ffff4b29535 in exit () from /lib64/libc.so.6
>>>>> #3 0x0000000000568da3 in virtqueue_num_heads (vq=0x17040e0, idx=0) at /data/qemu/hw/virtio.c:258
>>>>> #4 0x0000000000569511 in virtqueue_pop (vq=0x17040e0, elem=0x17cea58) at /data/qemu/hw/virtio.c:388
>>>>> #5 0x0000000000419e31 in virtio_blk_get_request (s=0x1704010) at /data/qemu/hw/virtio-blk.c:132
>>>>> #6 virtio_blk_handle_output (vdev=0x1704010, vq=<value optimized out>) at /data/qemu/hw/virtio-blk.c:369
>>>>>
>> []
>>> And what about the guest-triggerable qemu exit above?
>>
>> There are _lots_ of guest-triggerable qemu exits out there.
>>
>> static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx)
>> {
>> uint16_t num_heads = vring_avail_idx(vq) - idx;
>>
>> /* Check it isn't doing very strange things with descriptor numbers. */
>> if (num_heads > vq->vring.num) {
>> fprintf(stderr, "Guest moved used index from %u to %u",
>> idx, vring_avail_idx(vq));
>> exit(1);
>> }
>>
>> return num_heads;
>> }
>>
>> 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).
I agree, those exits are bugs. There are a lot of them in virtio code.
At some point, someone should go through the whole virtio code and fix
them all.
Kevin
next prev parent reply other threads:[~2010-11-15 10:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 22:02 [Qemu-devel] virtio-blk broken after system reset Jan Kiszka
2010-11-13 7:49 ` Stefan Hajnoczi
2010-11-13 7:51 ` Jan Kiszka
2010-11-13 10:01 ` Michael Tokarev
2010-11-13 10:09 ` Jan Kiszka
2010-11-13 10:54 ` Stefan Hajnoczi
2010-11-13 11:08 ` Jan Kiszka
2010-11-15 10:42 ` Kevin Wolf [this message]
2010-11-15 21:16 ` Anthony Liguori
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=4CE10EA1.2080702@redhat.com \
--to=kwolf@redhat.com \
--cc=gleb@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kevin@koconnor.net \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@linux.vnet.ibm.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).