"Cannot allocate memory" when boots a VM > 1026GB memory with -accel kvm
Host environment
- Operating system: Debian 11.2
- OS/kernel version: Linux debian11 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux
- Architecture: x86
- QEMU flavor: qemu-system-x86_64
- QEMU version: 6.2.0
- QEMU command line:
qemu-system-x86_64 -m 1027G -accel kvm -vnc :1
Emulated/Virtualized environment
- Operating system: not relavant to this problem
- OS/kernel version: not relavant to this problem
- Architecture: x86
Description of problem
I can boot an empty VM using command qemu-system-x86_64 -m 1026G -accel kvm -vnc :1 or qemu-system-x86_64 -m 8T -vnc :1
But when I use qemu-system-x86_64 -m 1027G -accel kvm -vnc :1, it will not boot:
root@debian11:~# qemu-system-x86_64 -m 1027G -accel kvm -vnc :1
qemu-system-x86_64: kvm_set_user_memory_region: KVM_SET_USER_MEMORY_REGION failed, slot=1, start=0x100000000, size=0x10000000000: Cannot allocate memory
kvm_set_phys_mem: error registering slot: Cannot allocate memory
Aborted
Which means, with -accel kvm, it only can boot a VM which memory <= 1026G, but without these args, it can boot whatever you want.
Steps to reproduce
- sysctl vm.overcommit_memory=1 # enable overcommit first
- qemu-system-x86_64 -m 1027G -accel kvm -vnc :1
Additional information
The qemu I use is compiled from the latest source, not the package provided by debian.
Hardware is PowerEdge R630 with E5-2630 v4 * 2, 128G physical RAM.
Edited by Harry Lee