From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qu4K2-00049U-L6 for qemu-devel@nongnu.org; Thu, 18 Aug 2011 11:15:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qu4K1-0003j0-DP for qemu-devel@nongnu.org; Thu, 18 Aug 2011 11:15:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qu4K1-0003in-6A for qemu-devel@nongnu.org; Thu, 18 Aug 2011 11:15:53 -0400 Message-ID: <4E4D2C9F.6040805@redhat.com> Date: Thu, 18 Aug 2011 08:15:43 -0700 From: Avi Kivity MIME-Version: 1.0 References: <20110704094358.GA10960@redhat.com> <4E4B7DE1.3050405@cn.fujitsu.com> <4E4C8577.5000608@cn.fujitsu.com> In-Reply-To: <4E4C8577.5000608@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] pci: add standard bridge device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang Cc: Kevin Wolf , Isaku Yamahata , qemu-devel@nongnu.org, "Michael S. Tsirkin" On 08/17/2011 08:22 PM, Wen Congyang wrote: > At 08/17/2011 04:37 PM, Wen Congyang Write: > > At 07/04/2011 05:43 PM, Michael S. Tsirkin Write: > >> This adds support for a standard pci to pci bridge, > >> enabling support for more than 32 PCI devices in the system. > >> To use, specify the device id as a 'bus' option. > >> Example: > >> -device pci-bridge,id=3Dbridge1 \ > >> -netdev user,id=3Du \ > >> -device ne2k_pci,id=3Dnet2,bus=3Dbridge1,netdev=3Du > >> > >> TODO: device hotplug support. > > > > I try this patch, and found that when I use pci bridge, qemu will co= re dump. > > > > Here is my command line: > > /usr/local2/bin/qemu-system-x86_64 -M pc-0.14 -enable-kvm -m 512 -na= me vm1 -drive file=3D/var/lib/libvirt/images/vm1.img,if=3Dnone,id=3Ddrive= -ide0-0-0,format=3Dqcow2,cache=3Dwritethrough -device ide-drive,bus=3Dide= =2E0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,bootindex=3D1 -vnc 0.0= =2E0.0:1 -device pci-bridge,id=3Dbridge1,bus=3Dpci.0,addr=3D0x08.0x0 -net= dev user,id=3Du -device ne2k_pci,id=3Dnet2,bus=3Dbridge1,netdev=3Du > > > > Here is the backtrace: > > Core was generated by `/usr/local2/bin/qemu-system-x86_64 -M pc-0.14= -enable-kvm -m 512 -name vm1 -dri'. > > Program terminated with signal 11, Segmentation fault. > > #0 0x0000000000438e34 in memory_region_add_subregion_common (mr=3D0= x0, offset=3D49152, subregion=3D0x1de5d58) at /home/wency/source/qemu/mem= ory.c:1152 > > 1152 QTAILQ_FOREACH(other,&mr->subregions, subregions_link) { > > Missing separate debuginfos, use: debuginfo-install SDL-1.2.14-2.el6= =2Ex86_64 celt051-0.5.1.3-0.el6.x86_64 cyrus-sasl-gssapi-2.1.23-8.el6.x86= _64 cyrus-sasl-lib-2.1.23-8.el6.x86_64 cyrus-sasl-md5-2.1.23-8.el6.x86_64= cyrus-sasl-plain-2.1.23-8.el6.x86_64 db4-4.7.25-16.el6.x86_64 glib2-2.22= =2E5-6.el6.x86_64 glibc-2.12-1.25.el6.x86_64 keyutils-libs-1.4-1.el6.x86_= 64 krb5-libs-1.9-9.el6.x86_64 libX11-1.3-2.el6.x86_64 libXau-1.0.5-1.el6.= x86_64 libaio-0.3.107-10.el6.x86_64 libattr-2.4.44-4.el6.x86_64 libcom_er= r-1.41.12-7.el6.x86_64 libcurl-7.19.7-26.el6.x86_64 libgcrypt-1.4.5-5.el6= =2Ex86_64 libgpg-error-1.7-3.el6.x86_64 libidn-1.18-2.el6.x86_64 libjpeg-= 6b-46.el6.x86_64 libpng-1.2.44-1.el6.x86_64 libselinux-2.0.94-5.el6.x86_6= 4 libssh2-1.2.2-7.el6.x86_64 libtasn1-2.3-3.el6.x86_64 libuuid-2.17.2-12.= el6.x86_64 libxcb-1.5-1.el6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64= nspr-4.8.7-1.el6.x86_64 nss-3.12.9-9.el6.x86_64 nss-softokn-freebl-3.12.= 9-3.el6.x86_64 nss-util-3.12.9-1.el6.x86_64 openld > > ap > > -2.4.23-15.el6.x86_64 openssl-1.0.0-10.el6.x86_64 pixman-0.18.4-1.el= 6_0.1.x86_64 spice-server-0.8.0-1.el6.x86_64 zlib-1.2.3-25.el6.x86_64 > > (gdb) bt > > #0 0x0000000000438e34 in memory_region_add_subregion_common (mr=3D0= x0, offset=3D49152, subregion=3D0x1de5d58) at /home/wency/source/qemu/mem= ory.c:1152 > > #1 0x0000000000439090 in memory_region_add_subregion_overlap (mr=3D= 0x0, offset=3D49152, subregion=3D0x1de5d58, priority=3D1) at /home/wency/= source/qemu/memory.c:1194 > > #2 0x00000000005c55fe in pci_update_mappings (d=3D0x1de5900) at /ho= me/wency/source/qemu/hw/pci.c:1063 > > #3 0x00000000005c5982 in pci_default_write_config (d=3D0x1de5900, a= ddr=3D4, val=3D0, l=3D2) at /home/wency/source/qemu/hw/pci.c:1121 > > #4 0x00000000005cbfbf in pci_host_config_write_common (pci_dev=3D0x= 1de5900, addr=3D4, limit=3D256, val=3D1, len=3D2) at /home/wency/source/q= emu/hw/pci_host.c:54 > > #5 0x00000000005cc0d1 in pci_data_write (s=3D0x1da2b90, addr=3D2147= 549188, val=3D1, len=3D2) at /home/wency/source/qemu/hw/pci_host.c:75 > > #6 0x00000000005cc2b1 in pci_host_data_write (handler=3D0x1da2b60, = addr=3D3324, val=3D1, len=3D2) at /home/wency/source/qemu/hw/pci_host.c:1= 25 > > #7 0x000000000042c884 in ioport_simple_writew (opaque=3D0x1da2b60, = addr=3D3324, value=3D1) at /home/wency/source/qemu/rwhandler.c:50 > > #8 0x0000000000499e85 in ioport_write (index=3D1, address=3D3324, d= ata=3D1) at ioport.c:81 > > #9 0x000000000049a8e1 in cpu_outw (addr=3D3324, val=3D1) at ioport.= c:280 > > #10 0x0000000000433c5d in kvm_handle_io (port=3D3324, data=3D0x7f0b3= 0f86000, direction=3D1, size=3D2, count=3D1) at /home/wency/source/qemu/k= vm-all.c:837 > > #11 0x00000000004341c8 in kvm_cpu_exec (env=3D0x1b7fc70) at /home/we= ncy/source/qemu/kvm-all.c:976 > > #12 0x000000000040da99 in cpu_exec_all () at /home/wency/source/qemu= /cpus.c:1102 > > #13 0x00000000005b60c4 in main_loop () at /home/wency/source/qemu/vl= =2Ec:1392 > > #14 0x00000000005baa49 in main (argc=3D20, argv=3D0x7ffffa6b5a38, en= vp=3D0x7ffffa6b5ae0) at /home/wency/source/qemu/vl.c:3356 > > > > If I do not attach any device on bus bridge1, qemu can work nice. > > > > Thanks > > Wen Congyang > > > > The following patch can fix this problem, but I'm not sure whether it i= s right. It's correct but insufficient, the filtering code (pci_bridge_filter)=20 needs to be updated to use the memory API. Basically it gets simpler and correcter. --=20 I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.