RE: pci-stub error and MSI-X for KVM guest

Fischer, Anna
2010-01-05T10:26:57Z

[-- Attachment #1: Type: text/plain, Size: 4093 bytes --]

> Subject: Re: pci-stub error and MSI-X for KVM guest
>
> * Fischer, Anna (anna.fischer@hp.com) wrote:
> > > Ouch. Can you do "debuginfo-install qemu-system-x86" to get the
> debug
> > > packages, then attach gdb to the QEMU process so that when you do
> lspci
> > > -v
> > > in the guest (assuming this is QEMU segfaulting) you'll get a
> backtrace?
> >
> > I don't know how I can tell virt-manager through the GUI to enable
> debug mode, e.g. call virt-manager with '-s'. From the command line I
> can attach gdb like this, but when running virt-manager from the GUI
> then I cannot connect to localhost:1234. However, the issues only arise
> when starting virt-manager from the GUI. I can't find the configuration
> option to somehow tell that I want it to be launched with '-s'?
>
> Just looking for a backtrace of the qemu-kvm process itself. So after
> you launch it via virt-manager, gdb /usr/bin/qemu-kvm $(pidof qemu-kvm)
> should be sufficient.

So, when setting a breakpoint for the exit() call I'm getting a bit closer to figuring where it kills my guest.

Breakpoint 1, exit (status=1) at exit.c:99
99 {
Current language: auto
The current source language is "auto; currently c".
(gdb) bt
#0 exit (status=1) at exit.c:99
#1 0x0000000000470c6e in assigned_dev_pci_read_config (d=0x259c6f0, address=64, len=4)
at /usr/src/debug/qemu-kvm-0.11.0/hw/device-assignment.c:349
#2 0x000000000042419d in handle_io (vcpu=<value optimized out>)
at /usr/src/debug/qemu-kvm-0.11.0/qemu-kvm.c:784
#3 kvm_run (vcpu=<value optimized out>) at /usr/src/debug/qemu-kvm-0.11.0/qemu-kvm.c:1017
#4 0x0000000000424273 in kvm_cpu_exec (env=0x3f)
at /usr/src/debug/qemu-kvm-0.11.0/qemu-kvm.c:1686
#5 0x0000000000425856 in kvm_main_loop_cpu (env=0x255a150)
at /usr/src/debug/qemu-kvm-0.11.0/qemu-kvm.c:1868
#6 ap_main_loop (env=0x255a150) at /usr/src/debug/qemu-kvm-0.11.0/qemu-kvm.c:1905
#7 0x00000035aac06a3a in start_thread (arg=<value optimized out>) at pthread_create.c:297
#8 0x00000035aa0ddf3d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9 0x0000000000000000 in ?? ()
(gdb) p assigned_dev_pci_read_config::address
$1 = 64
(gdb) p assigned_dev_pci_read_config::val
$2 = 0
(gdb) p assigned_dev_pci_read_config::len
$3 = 4
(gdb) p assigned_dev_pci_read_config::ret
$4 = <value optimized out>
(gdb) p assigned_dev_pci_read_config::fd
$5 = 13
(gdb) p assigned_dev_pci_read_config::pci_dev
$6 = (AssignedDevice *) 0x259c6f0
(gdb) p assigned_dev_pci_read_config::pci_dev->real_device
$7 = {bus = 0 '\000', dev = 0 '\000', func = 0 '\000', irq = 0, region_number = 7, regions = {{
type = 512, valid = 1, base_addr = 4077142016, size = 16384, resource_fd = 15}, {type = 0,
valid = 0, base_addr = 0, size = 0, resource_fd = 0}, {type = 0, valid = 0, base_addr = 0,
size = 0, resource_fd = 0}, {type = 512, valid = 1, base_addr = 4077273088, size = 16384,
resource_fd = 16}, {type = 0, valid = 0, base_addr = 0, size = 0, resource_fd = 0}, {
type = 0, valid = 0, base_addr = 0, size = 0, resource_fd = 0}, {type = 0, valid = 0,
base_addr = 0, size = 0, resource_fd = 0}}, config_fd = 13}
(gdb) p assigned_dev_pci_read_config::d
$8 = (PCIDevice *) 0x259c6f0

So the function assigned_dev_pci_read_config fails to read the PCI configuration of the device and then the exit(1) call kills my guest. I don't know enough about the internals of KVM PCI device assignment and furthermore I don't quite know why this works when starting virt-manager from the command line and not when starting it from the GUI.

>From the dmesg logs I would still guess that the problem is that pci-stub is not initialized properly, and perhaps this is also why the PCI read fails here? pci-stub tells me in the logs "enabling device" but I don't see any messages about enabling/assigning interrupts as I do when running from the command line.

Let me know if you need any further information.

Attached a list of virt packages I run under Fedora Core 12.

Thanks,
Anna

[-- Attachment #2: packages.log --]
[-- Type: application/octet-stream, Size: 1904 bytes --]

Installed Packages
fence-virtd.x86_64 0.1.3-1.fc12 @updates
fence-virtd-libvirt.x86_64 0.1.3-1.fc12 @updates
libvirt.x86_64 0.7.1-15.fc12 @fedora
libvirt-cim.x86_64 0.5.7-1.fc12 @fedora
libvirt-client.x86_64 0.7.1-15.fc12 @fedora
libvirt-devel.x86_64 0.7.1-15.fc12 @fedora
libvirt-java.noarch 0.3.0-1.fc12 @fedora
libvirt-java-devel.noarch 0.3.0-1.fc12 @fedora
libvirt-java-javadoc.noarch 0.3.0-1.fc12 @fedora
libvirt-python.x86_64 0.7.1-15.fc12 @fedora
libvirt-qpid.x86_64 0.2.17-3.fc12 @updates
ocaml-libvirt.x86_64 0.6.1.0-6.fc12 @fedora
ocaml-libvirt-devel.x86_64 0.6.1.0-6.fc12 @fedora
python-virtinst.noarch 0.500.0-5.fc12 @fedora
ruby-libvirt.x86_64 0.1.0-5.fc12 @fedora
virt-manager.noarch 0.8.0-7.fc12 @fedora
virt-viewer.x86_64 0.2.0-1.fc12 @fedora
virtaal.noarch 0.5.0-1.fc12 @updates
virtuoso-opensource.x86_64 5.0.12-1.fc12 @fedora
virtuoso-opensource-apps.x86_64 5.0.12-1.fc12 @fedora
virtuoso-opensource-conductor.noarch 5.0.12-1.fc12 @fedora
virtuoso-opensource-doc.noarch 5.0.12-1.fc12 @fedora
virtuoso-opensource-utils.x86_64 5.0.12-1.fc12 @fedora