qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [PULL] Memory core space reduction
Date: Tue, 28 Feb 2012 19:59:14 +0200	[thread overview]
Message-ID: <20120228175914.GA28479@redhat.com> (raw)
In-Reply-To: <4F4CC7C6.9070609@redhat.com>

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=<value optimized out>, 
    readonly=<value optimized out>) 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=<value optimized out>) 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=<value optimized out>, devfn=<value optimized out>, 
    multifunction=<value optimized out>, name=<value optimized out>) at /home/mst/scm/qemu/hw/pci.c:1552
#18 0x00007ffff7dc9c2f in pci_piix3_ide_init (bus=<value optimized out>, hd_table=0x7fffffffdfd0, 
    devfn=<value optimized out>) 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=<value optimized out>, kernel_cmdline=<value optimized out>, 
    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=<value optimized out>)
    at /home/mst/scm/qemu/hw/pc_piix.c:319
#21 0x00007ffff7e01fb8 in main (argc=<value optimized out>, argv=<value optimized out>, envp=<value optimized out>)
    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 <mst@redhat.com>

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:


-- 
MST

  parent reply	other threads:[~2012-02-28 17:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 12:25 [Qemu-devel] [PULL] Memory core space reduction Avi Kivity
2012-02-28 12:26 ` Avi Kivity
2012-02-28 17:59 ` Michael S. Tsirkin [this message]
2012-02-28 18:13   ` Anthony Liguori
2012-02-28 18:15     ` Avi Kivity
2012-02-28 18:31       ` Anthony Liguori
2012-02-28 18:56       ` Anthony Liguori
2012-02-28 19:14       ` Anthony Liguori
2012-02-28 19:17         ` Avi Kivity
2012-02-28 19:20           ` Anthony Liguori
2012-02-28 22:58             ` Michael S. Tsirkin
2012-02-29 10:09               ` Avi Kivity
2012-02-29 10:23                 ` Michael S. Tsirkin
2012-02-29 10:53                   ` Avi Kivity
2012-02-29 11:25                     ` Michael S. Tsirkin
2012-02-29 11:31                       ` Avi Kivity
2012-02-29 11:45                         ` Avi Kivity
2012-02-29 14:15                           ` Michael S. Tsirkin
2012-02-29 11:27                     ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2012-02-28 12:24 Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120228175914.GA28479@redhat.com \
    --to=mst@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).