From: Gerd Hoffmann <kraxel@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, paul@codesourcery.com
Subject: Re: [Qemu-devel] Monitor command pci_add regressed (qdev)
Date: Fri, 12 Jun 2009 10:52:57 +0200 [thread overview]
Message-ID: <4A321769.5090904@redhat.com> (raw)
In-Reply-To: <87bpowhtmm.fsf@pike.pond.sub.org>
On 06/10/09 19:43, Markus Armbruster wrote:
> gdb --args qemu -monitor stdio tmp.qcow2 -S
> (qemu) pci_add pci_addr=auto storage if=virtio,file=foo.img
> Program received signal SIGSEGV, Segmentation fault.
> Culprit seems to be commit 07e3af9a. qdev_init_bdrv() fails, and
> virtio_blk_init() doesn't check the failure.
>
> I haven't investigated why qdev_init_bdrv() fails (the old code got the
> BlockDriverState just fine). Regardless, there are scenarios where
> qdev_init_bdrv() rightly fails, so virtio_blk_init() needs fixing.
>
> Returning NULL would be easy enough, but its caller
> virtio_blk_init_pci() doesn't check its value, and it is a qdev init()
> callback, which can't fail. How to handle the error? exit(1) would be
> just fine for -drive, but not for a monitor command.
I think the correct long-term fix is to cleanly separate the guest-side
stuff (virtio or whatever else block device) and the host-side
(BlockDriverState) and how the two are linked together.
The BlockDriverState setup can fail for a number of reasons.
The virtio blk setup shouldn't fail. So setting up BlockDriverState
first, when succeeded setup virtio-blk, then link the two should work fine.
Dunno how much work that would be with the current qemu code structure
though. Maybe we should allow device initialization fail for the time
being.
cheers,
Gerd
next prev parent reply other threads:[~2009-06-12 8:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 17:43 [Qemu-devel] Monitor command pci_add regressed (qdev) Markus Armbruster
2009-06-12 8:52 ` Gerd Hoffmann [this message]
2009-06-16 14:24 ` [Qemu-devel] [PATCH] qdev: Fix regression in "pci_add ... storage if=virtio, ..." Markus Armbruster
2009-06-16 20:58 ` Gerd Hoffmann
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=4A321769.5090904@redhat.com \
--to=kraxel@redhat.com \
--cc=armbru@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/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).