[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] Error when creating VM with persistent memory



Hi Michal,
Thank you for the reply.
I was having issues compiling qemu code on fedora29. So instead of dropping prealloc in virsh, tried adding prealloc=yes in qemu command line. prealloc=yes works. It does not lead to using more system memory when using DAX.
+Dan
Here are the steps:

ndctl create-namespace -t pmem -m fsdax --align=4k -s 400G

mkfs.ext4 /dev/pmem0

mount -o dax /dev/pmem0 /mnt/pmem0

dd if=/dev/zero of=/mnt/pmem0/file1 bs=4k count=104857600

[root system-name]# dd if=/dev/zero of=/mnt/pmem0/file1 bs=4k count=104857600

dd: error writing '/mnt/pmem0/file1': No space left on device

101313980+0 records in

101313979+0 records out

414982057984 bytes (415 GB, 386 GiB) copied, 946.495 s, 438 MB/s


Slightly smaller file is created than asked. 

[root system-name]# du -sh

387G    .


sample qemu command line which works:

qemu-system-x86_64 \

-name test \

-drive file=/var/lib/libvirt/images/test-ad.qcow2,format=qcow2,index=0,media=disk \ -m 2G,slots=4,maxmem=428G \ -smp 2 \ -machine pc,accel=kvm,nvdimm=on \ -enable-kvm \ -object memory-backend-file,id=pmem1,prealloc=yes,share=on,mem-path=/mnt/pmem0/file1,size=386G,align=4K \ -device nvdimm,memdev=pmem1,id=nv1 \ -daemonize

 

So prealloc option works. 

But still passing /mnt/pmem0/file1 in virsh as the nvdimm fails to start the VM. Errors out saying cannot allocate that much memory. 



On Wed, Aug 28, 2019 at 6:49 PM Michal Privoznik <mprivozn redhat com> wrote:
On 8/27/19 9:58 AM, Seema Pandit wrote:
> error: internal error: qemu unexpectedly closed the monitor: ftruncate:
> Invalid argument 2019-08-22T04:16:08.744402Z qemu-system-x86_64: -object
> memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/dev/dax1.0,size=403726925824:
> unable to map backing store for guest RAM: Cannot allocate memory

I wonder if dropping 'prealloc' would help. This error message comes
from phase before 'prealloc' is processed. You can try the following
patch:


diff --git i/src/qemu/qemu_command.c w/src/qemu/qemu_command.c
index 373ebd6d1a..c375955eab 100644
--- i/src/qemu/qemu_command.c
+++ w/src/qemu/qemu_command.c
@@ -3468,7 +3468,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
         }

         if (virJSONValueObjectAdd(props,
-                                  "B:prealloc", prealloc,
+                                  "B:prealloc", prealloc ? false : false,
                                   "s:mem-path", memPath,
                                   NULL) < 0)
             goto cleanup;

Michal

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]