Bug 736644

Summary: mem lack cause qemu_memalign crash
Product: Red Hat Enterprise Linux 6 Reporter: Suqin Huang <shuang>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: juzhang, michen, mkenneth, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-12 07:14:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Suqin Huang 2011-09-08 10:49:47 UTC
Description of problem:
echo large mem to /proc/sys/vm/nr_hugepage, and then run guest.

Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.188.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. echo large mem to /proc/sys/vm/nr_hugepage
2. run guest

usr/libexec/qemu-kvm -monitor stdio -drive file='/home/Auto/autotest-devel/client/tests/kvm/images/RHEL-Server-6.1-64-virtio.qcow2',index=0,if=none,id=drive-virtio-disk1,media=disk,cache=none,format=qcow2,aio=native -device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,id=virtio-disk1 -device virtio-net-pci,netdev=idCnizDC,mac=00:e6:4a:94:f2:20,id=ndev00idCnizDC,bus=pci.0,addr=0x3 -netdev tap,id=idCnizDC,vhost=on,script='/home/Auto/autotest-devel/client/tests/kvm/scripts/qemu-ifup-switch',downscript='no' -m 4G -smp 2,cores=2,threads=1,sockets=1 -cpu cpu64-rhel6,+sse2,+x2apic -vnc :2 -rtc base=utc,clock=host,driftfix=none -M rhel6.2.0 -boot order=cdn,once=c,menu=off   -usbdevice tablet -no-kvm-pit-reinjection -enable-kvm

3.
  
Actual results:
guest crash

Expected results:
quest quit with mem lack warning

Additional info:

gdb) 
#0  0x00000033f4432945 in raise () from /lib64/libc.so.6
#1  0x00000033f4434125 in abort () from /lib64/libc.so.6
#2  0x0000000000482b50 in qemu_memalign (alignment=2097152, size=8589934592) at osdep.c:112
#3  0x00000000004e9a32 in qemu_ram_alloc_from_ptr (dev=<value optimized out>, name=<value optimized out>, size=8589934592, host=<value optimized out>)
    at /usr/src/debug/qemu-kvm-0.12.1.2/exec.c:2730
#4  0x0000000000451253 in pc_init1 (ram_size=3758096384, boot_device=0x7fff883a1b80 "d", 
    kernel_filename=0x7fff883a45e1 "/home/Auto/autotest-devel/client/tests/kvm/images/rhel61-64/vmlinuz", 
    kernel_cmdline=0x7fff883a4703 "ks=cdrom nicdelay=60 console=ttyS0,115200 console=tty0", 
    initrd_filename=0x7fff883a462d "/home/Auto/autotest-devel/client/tests/kvm/images/rhel61-64/initrd.img", cpu_model=0x7fff883a45bf "cpu64-rhel6,+sse2,+x2apic", 
    pci_enabled=1) at /usr/src/debug/qemu-kvm-0.12.1.2/hw/pc.c:1114
#5  0x000000000040d1ff in main (argc=<value optimized out>, argv=<value optimized out>, envp=<value optimized out>) at /usr/src/debug/qemu-kvm-0.12.1.2/vl.c:6081

Comment 2 Dor Laor 2011-09-12 07:14:36 UTC
This is works as designed. If we're using static huge pages we expect to get enough of them. If you do not have enough (reserved before), just use THP instead.

Comment 3 Suqin Huang 2011-09-12 07:38:59 UTC
Hi Dor,
I think it should quit but not crash

Comment 4 Dor Laor 2011-09-14 21:24:54 UTC
(In reply to comment #3)
> Hi Dor,
> I think it should quit but not crash

You're right but we barely have the bandwidth to change it, raising an exception is not that awkward solution