qemu abort when configure ivshmem size >=32M with kvm-3.6
Hi all,
We can't start VM when we configure ivshmem with its size >= 32M. Its reports: kvm_set_phys_mem: error registering slot: File exists Aborted (core dumped)
Qemu command:
#qemu-system-x86_64 -name suse10sp1 -enable-kvm -m 4096 -smp 4,sockets=1, \
cores=4,threads=1 -drive file=/home/sles10_sp1_64_2U,if=none,id=drive-ide0-0-0, \
format=raw,cache=none,aio=native -device ide-hd,bus=ide.0,unit=0, \
drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -vnc :10 \
-device ivshmem,id=ivshmem0,shm=vm-ivshmem,size=32m,role=master
We have made several tests, and the results are:
1.
Guest OS: suse10sp1
KVM version: 3.6
QEMU version:2.1.0
ivshmem size: 4M/8M/16M
result: OK
2.
Guest OS: sles10sp1
KVM version: 3.6
QEMU version: 2.1.0
ivshmem size: 32M/64M
result: fail
3.
Guest OS: sles10sp1
KVM version: *3.15*
QEMU version: 2.1.0
ivshmem size: 4M/8M/16M/32M/64M
result: OK
After a hard work, we found in kvm source, the commit b940413f5 can fix this problem.
KVM: Fix user memslot overlap check
Prior to memory slot sorting this loop compared all of the user memory slots for overlap with new entries. With memory slot sorting, we're just checking some number of entries in the array that may or may not be user slots. Instead, walk all the slots with kvm_for_each_memslot, which has the added benefit of terminating early when we hit the first empty slot, and skip comparison to private slots.
Since our project using kvm-3.6, we want to backport this patch to kvm-3.6. But if there are any potential problems to backport this patch?
Actually we also tested other Guest OS, such as suse11sp2, suse11sp3, they are all OK with configuring ivshmem >= 32M, so is it a bug of guest OS?
Any help will be appreciated.;)
Thanks,
zhanghailiang