Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 362197 - app-emulation/qemu{,-kvm} uses fixed PCI slots for certain hardware
Summary: app-emulation/qemu{,-kvm} uses fixed PCI slots for certain hardware
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal major with 1 vote (vote)
Assignee: Virtualization Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-05 18:23 UTC by Aljoscha Vollmerhaus
Modified: 2012-01-28 21:12 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
XML file for the VM in question (w2k8r2.xml,2.30 KB, application/xml)
2011-04-05 19:53 UTC, Aljoscha Vollmerhaus
Details
XML file for the VM in question (w2k8r2.xml,2.30 KB, application/xml)
2011-04-05 19:59 UTC, Aljoscha Vollmerhaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aljoscha Vollmerhaus 2011-04-05 18:23:36 UTC
When i try to start a VM with both a virtio block device and a virtio network device, i get this error message:

Error starting domain: internal error process exited while connecting to monitor: char device redirected to /dev/pts/0
qemu-system-x86_64: -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:60:70:68,bus=pci.0,addr=0x3: PCI: slot 3 function 0 not available for virtio-net-pci, in use by virtio-blk-pci
qemu-system-x86_64: -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:60:70:68,bus=pci.0,addr=0x3: Device 'virtio-net-pci' could not be initialized


Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 45, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/engine.py", line 959, in asyncfunc
    vm.startup()
  File "/usr/share/virt-manager/virtManager/domain.py", line 1114, in startup
    self._backend.create()
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 362, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error process exited while connecting to monitor: char device redirected to /dev/pts/0
qemu-system-x86_64: -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:60:70:68,bus=pci.0,addr=0x3: PCI: slot 3 function 0 not available for virtio-net-pci, in use by virtio-blk-pci
qemu-system-x86_64: -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:60:70:68,bus=pci.0,addr=0x3: Device 'virtio-net-pci' could not be initialized

and the guest doesn´t start. 

Reproducible: Always

Steps to Reproduce:
1.Create VM
2.Add both virtio-net and virtio-blk devices
3.Try to start the VM
Actual Results:  
Got the aforementioned error message, guest doesn´t get started

Expected Results:  
Start the VM, hopefully with working network and block devices

vhost ~ # emerge --info
Portage 2.1.9.42 (default/linux/amd64/10.0/no-multilib, gcc-4.4.5, glibc-2.11.3-r0, 2.6.34-gentoo-r12 x86_64)
=================================================================
System uname: Linux-2.6.34-gentoo-r12-x86_64-Intel-R-_Xeon-R-_CPU_E5420_@_2.50GHz-with-gentoo-1.12.14
Timestamp of tree: Tue, 05 Apr 2011 13:15:01 +0000
app-shells/bash:     4.1_p9
dev-lang/python:     2.6.6-r2, 2.7.1-r1, 3.1.3-r1
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.14-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.65-r1
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe "
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -pipe "
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ "
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://eis/gentoo-portage"
USE="amd64 bash-completion berkdb bzip2 cli cracklib crypt cxx dri fam fortran gdbm gnutls iconv mmx modules mudflap ncurses nls nptl nptlonly openmp pam pcre perl pppd python readline session sse sse2 ssl ssse3 sysfs tcpd threads unicode xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-04-05 19:22:10 UTC
Can you attach the (anonymised if necessary) xml fiel for the domain? It might not be as simple as it appears :/
Comment 2 Aljoscha Vollmerhaus 2011-04-05 19:51:33 UTC
Hi Diego,

i´ll attach the XML for the VM.

I have successfully installed the guest OS with the virtio block device, after that i tried to add the virtio-net device which led to the error.
Comment 3 Aljoscha Vollmerhaus 2011-04-05 19:53:28 UTC
Created attachment 268621 [details]
XML file for the VM in question
Comment 4 Aljoscha Vollmerhaus 2011-04-05 19:59:13 UTC
Created attachment 268625 [details]
XML file for the VM in question

Posted the wrong XML beforehand. This is the correct one.
Comment 5 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-04-05 20:03:19 UTC
Terrific, this looks definitely like an upstream bug, but not sure if it's virt-manager's or libvirt's properly..

As a workaround, add

      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>

within the definition of the block/disk device.
Comment 6 Aljoscha Vollmerhaus 2011-04-06 21:41:28 UTC
Hm, editing the XML with "virsh edit vmname" doesn´t help. Everytime i modify the XML, it seems to get reverted the moment i leave the editor.

Trying to start the VM still gives me the error message.
Comment 7 Aljoscha Vollmerhaus 2011-04-07 08:33:40 UTC
Okay, i got around this by changing the slot number within the definition of the virtio-net device from 3 to 5.

Network device within the VM is working fine.
Comment 8 Doug Goldstein (RETIRED) gentoo-dev 2011-05-04 20:58:30 UTC
Just saw the same issue with libvirt-0.8.7-r1 and qemu-kvm-0.13.0-r2. So more than likely its an issue with qemu-kvm instead of libvirt.
Comment 9 Doug Goldstein (RETIRED) gentoo-dev 2011-05-04 21:20:36 UTC
Looks like PCI slot 3 is where it ALWAYS wants to put the virtio SCSI controller inside the guest so no other device can live there.
Comment 10 Doug Goldstein (RETIRED) gentoo-dev 2011-05-06 20:52:19 UTC
Yep, there's a bunch of reserved PCI slots in KVM. This is a limitation of KVM and the slots that are reserved vary from pc-0.12 to pc-0.13, which explains why previously you didn't have the error and now you do.

The patchset to fix this can be seen: http://article.gmane.org/gmane.comp.emulators.kvm.devel/71594

It will likely make it out in qemu-kvm-0.15.0
Comment 11 John W. Newman 2011-06-03 04:11:16 UTC
I can confirm this has been happening for a while with libvirt, even still with  2.6.38 + latest everything.

The workaround of editing the xml and upping the offset works fine, so no rush. I just have to do it ~30 times.. sed time i guess..

"It will likely make it out in qemu-kvm-0.15.0" ...  Did you mean 0.14.1-r1, http://packages.gentoo.org/package/app-emulation/qemu-kvm

If not, what's the ballpark timeline for .14 and .15 ?  Really the concept of the patch looks very simple and low risk, I would throw that in without much hesitation..  =) 

Thanks.
Comment 12 Aleister 2011-08-14 00:23:54 UTC
seems fixed in qemu-kvm-0.15.0
Comment 13 Doug Goldstein (RETIRED) gentoo-dev 2012-01-28 21:12:29 UTC
(In reply to comment #12)
> seems fixed in qemu-kvm-0.15.0

Indeed it is.