Bug 1258339

Summary: qemu-kvm boot up failed with "can't use already busy memdev"
Product: Red Hat Enterprise Linux 7 Reporter: ShupingCui <scui>
Component: qemu-kvm-rhevAssignee: Eduardo Habkost <ehabkost>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: ehabkost, imammedo, juzhang, knoel, michen, shuang, virt-maint, xfu, xutian, yuhuang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-31 18:39:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ShupingCui 2015-08-31 06:37:08 UTC
Description of problem:
qemu-kvm boot up failed with "can't use already busy memdev"

Version-Release number of selected component (if applicable):
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-2.3.0-21.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. boot up vm with one numa node
/bin/qemu-kvm \
    -S  \
    -name 'virt-tests-vm1'  \
    -sandbox off  \
    -machine pc  \
    -nodefaults  \
    -vga cirrus  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20150831-132748-EY9Ue1UE,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -chardev socket,id=qmp_id_catch_monitor,path=/tmp/monitor-catch_monitor-20150831-132748-EY9Ue1UE,server,nowait \
    -mon chardev=qmp_id_catch_monitor,mode=control \
    -device pvpanic,ioport=0x505,id=idm5gMcB  \
    -chardev socket,id=serial_id_serial0,path=/tmp/serial-serial0-20150831-132748-EY9Ue1UE,server,nowait \
    -device isa-serial,chardev=serial_id_serial0  \
    -chardev socket,id=seabioslog_id_20150831-132748-EY9Ue1UE,path=/tmp/seabios-20150831-132748-EY9Ue1UE,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20150831-132748-EY9Ue1UE,iobase=0x402 \
    -device ich9-usb-uhci1,id=usb1,bus=pci.0,addr=03 \
    -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=/mnt/nfs_images/RHEL-Server-7.2-64-virtio.qcow2 \
    -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=04 \
    -device virtio-net-pci,mac=9a:c1:c2:c3:c4:c5,id=idkgc4ST,vectors=4,netdev=idFlR5jA,bus=pci.0,addr=05  \
    -netdev tap,id=idFlR5jA \
    -m 4096,slots=4,maxmem=32G \
    -object memory-backend-ram,size=4096M,host-nodes=0,policy=bind,id=mem-mem0 \
    -device pc-dimm,id=dimm-mem0,memdev=mem-mem0 \
    -smp 4,maxcpus=4,cores=2,threads=1,sockets=2  \
    -numa node,memdev=mem-mem0 \
    -cpu 'SandyBridge',+kvm_pv_unhalt \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1  \
    -vnc :0  \
    -rtc base=utc,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -enable-kvm \
    -monitor stdio

2.
3.

Actual results:
(qemu) qemu-kvm: -device pc-dimm,id=dimm-mem0,memdev=mem-mem0: can't use already busy memdev: mem-mem0


Expected results:
boot up successfully

Additional info:
boot up successfully with "-numa node", no memdev option.

Comment 2 Eduardo Habkost 2015-08-31 18:39:43 UTC
You are trying to use the same mem-dev for two different memory regions:
* The first 4GB, that's non-hotplug memory living in the first (only) NUMA node (-numa node,memdev=mem-mem0)
* Extra hotplugged memory beyond the first non-hotplug 4GB (-object pc-dimm)

You can't do that. If you want the guest to have just 4GB non-hotplug memory, simply don't use -object pc-dimm. If you want the guest to have 8GB (4GB non-hotplug and 4GB hotplug), you need two memory backend objects, 4GB each.