Red Hat Bugzilla – Bug 1282335
The default size unit of memory-backend-ram is different from "-m"
Last modified: 2016-03-28 05:51:33 EDT
Description of problem:
The default size unit of memory-backend-ram is Bytes, while the default size unit of "-m" is MB.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. start a qemu-kvm process:
/usr/libexec/qemu-kvm -smp 1 -m 1024,slots=4,maxmem=8G \
-object memory-backend-ram,id=mem1,size=1024 -numa node,nodeid=0,memdev=mem1
Qemu-kvm process start failed, print:
qemu-kvm: total memory for NUMA nodes (0x400) should equal RAM size (0x40000000)
The default size unit of memory-backend-ram should be same as '-m'. Qemu process start succeed.
We accept sizes in many places, but the interpretation of an
unsuffixed number varies. HMP commands commonly interpret as
Mebibytes. qemu-img interprets as bytes. Command line commonly
interprets as bytes, but there are exceptions, and -m is one: it
interprets as Mebibytes for backward compatibility, see
The inconsistency is unfortunate, but it's clearly intentional, and it
cannot be fixed now, because it's ABI. Closing NOTABUG.
I recommend to always use a suffix, like
$ /usr/libexec/qemu-kvm -smp 1 -m 1024M,slots=4,maxmem=8G \
-object memory-backend-ram,id=mem1,size=1024M -numa node,nodeid=0,memdev=mem1