qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Monitor command pci_add regressed (qdev)


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] Monitor command pci_add regressed (qdev)
Date: Fri, 12 Jun 2009 10:52:57 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]