From patchwork Tue Feb 28 17:59:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 143521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1D1F1B6FA5 for ; Wed, 29 Feb 2012 04:59:27 +1100 (EST) Received: from localhost ([::1]:54026 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2RKe-0006lj-KN for incoming@patchwork.ozlabs.org; Tue, 28 Feb 2012 12:59:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2RKW-0006ij-9G for qemu-devel@nongnu.org; Tue, 28 Feb 2012 12:59:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2RKQ-0003c0-RH for qemu-devel@nongnu.org; Tue, 28 Feb 2012 12:59:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2RKQ-0003bg-I4 for qemu-devel@nongnu.org; Tue, 28 Feb 2012 12:59:10 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1SHx6sb017660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 28 Feb 2012 12:59:06 -0500 Received: from redhat.com (dhcp-4-60.tlv.redhat.com [10.35.4.60]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id q1SHx4Ww024500; Tue, 28 Feb 2012 12:59:05 -0500 Date: Tue, 28 Feb 2012 19:59:14 +0200 From: "Michael S. Tsirkin" To: Avi Kivity Message-ID: <20120228175914.GA28479@redhat.com> References: <4F4CC7C6.9070609@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4F4CC7C6.9070609@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-devel , Anthony Liguori Subject: Re: [Qemu-devel] [PULL] Memory core space reduction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Tue, Feb 28, 2012 at 02:25:42PM +0200, Avi Kivity wrote: > [repost with pull info, brain not yet back up to speed] > > This is the current memory queue (posted as two separate series before > my vacation). When applied, the overhead of 16 bytes/page is reduced to > basically nil. > > Please pull from: > > git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/core > This seems to make things worse for me: I used to see a crash with kvm when using a 64 bit BAR, now it crashes very early, and without kvm as well: #0 0x00007ffff5fc4155 in malloc_consolidate () from /lib64/libc.so.6 #1 0x00007ffff5fc71c2 in _int_malloc () from /lib64/libc.so.6 #2 0x00007ffff5fc85ed in malloc () from /lib64/libc.so.6 #3 0x00007ffff7e00496 in malloc_and_trace (n_bytes=8392) at /home/mst/scm/qemu/vl.c:2156 #4 0x00007ffff73e834e in ?? () from /lib64/libglib-2.0.so.0 #5 0x00007ffff73e8708 in g_malloc0 () from /lib64/libglib-2.0.so.0 #6 0x00007ffff7e88d52 in subpage_init (section=0x7fffffffd9a0) at /home/mst/scm/qemu/exec.c:3483 #7 register_subpage (section=0x7fffffffd9a0) at /home/mst/scm/qemu/exec.c:2643 #8 0x00007ffff7e88fa6 in cpu_register_physical_memory_log (section=, readonly=) at /home/mst/scm/qemu/exec.c:2680 #9 0x00007ffff7eb2d68 in address_space_update_topology_pass (as=0x7ffff8ae4b80, old_view=..., new_view=..., adding= true) at /home/mst/scm/qemu/memory.c:679 #10 0x00007ffff7eb4c66 in address_space_update_topology (as=0x7ffff8ae4b80) at /home/mst/scm/qemu/memory.c:708 #11 0x00007ffff7eb5444 in memory_region_update_topology (mr=) at /home/mst/scm/qemu/memory.c:729 #12 0x00007ffff7dc98d7 in bmdma_setup_bar (dev=0x7ffff8d52500) at /home/mst/scm/qemu/hw/ide/piix.c:97 #13 pci_piix_ide_initfn (dev=0x7ffff8d52500) at /home/mst/scm/qemu/hw/ide/piix.c:157 #14 0x00007ffff7dd998e in pci_qdev_init (qdev=0x7ffff8d52500) at /home/mst/scm/qemu/hw/pci.c:1492 #15 0x00007ffff7e277ba in qdev_init (dev=0x7ffff8d52500) at /home/mst/scm/qemu/hw/qdev.c:150 #16 0x00007ffff7e2789d in qdev_init_nofail (dev=0x7ffff8d52500) at /home/mst/scm/qemu/hw/qdev.c:243 #17 0x00007ffff7dd8d88 in pci_create_simple_multifunction (bus=, devfn=, multifunction=, name=) at /home/mst/scm/qemu/hw/pci.c:1552 #18 0x00007ffff7dc9c2f in pci_piix3_ide_init (bus=, hd_table=0x7fffffffdfd0, devfn=) at /home/mst/scm/qemu/hw/ide/piix.c:224 #19 0x00007ffff7eeafb7 in pc_init1 (system_memory=0x7ffff8d0e6c0, system_io=0x7ffff8b61d40, ram_size=1073741824, boot_device=0x7fffffffe320 "cad", kernel_filename=, kernel_cmdline=, initrd_filename=0x0, cpu_model=0x0, pci_enabled=1, kvmclock_enabled=1) at /home/mst/scm/qemu/hw/pc_piix.c:257 #20 0x00007ffff7eeb368 in pc_init_pci (ram_size=1073741824, boot_device=0x7fffffffe320 "cad", kernel_filename=0x0, kernel_cmdline=0x7ffff7f669e5 "", initrd_filename=0x0, cpu_model=) at /home/mst/scm/qemu/hw/pc_piix.c:319 #21 0x00007ffff7e01fb8 in main (argc=, argv=, envp=) at /home/mst/scm/qemu/vl.c:3397 How to reproduce: qemu-system-x86_64 -m 1G -drive file=/home/mst/rhel6.qcow2 -netdev user,id=bar -net nic,netdev=bar,model=e1000,macaddr=52:54:00:12:34:57 -redir tcp:8022::22 -device pci-bridge,id=bog,chassis_nr=1 -netdev tap,id=foo,ifname=msttap0,script=/home/mst/ifup,downscript=no,vhost=on -nographic The code for this can be found here: git://github.com/mstsirkin/qemu.git pci If I set a 32 bit region - no issue, the last patch to trigger this is: bridge: make BAR 64 bit This crashes kvm. Donnu why. Signed-off-by: Michael S. Tsirkin Signed-off-by: Avi Kivity diff --git a/hw/pci_bridge_dev.c b/hw/pci_bridge_dev.c index 9a4102a..60d9528 100644 --- a/hw/pci_bridge_dev.c +++ b/hw/pci_bridge_dev.c @@ -66,7 +66,8 @@ static int pci_bridge_dev_initfn(PCIDevice *dev) } /* TODO: spec recommends using 64 bit prefetcheable BAR. * Check whether that works well. */ - pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &bridge_dev->bar); + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | + PCI_BASE_ADDRESS_MEM_TYPE_64, &bridge_dev->bar); dev->config[PCI_INTERRUPT_PIN] = 0x1; return 0; slotid_error: