* Li, Tianyou (tianyou...@intel.com) wrote: > Hi Artyom, Dave & others, > > An update: I have tried to use -mem-path option to make a file-backed memory. > I have tried to write a particular physical address in guest Linux OS with > specific value to verify the persistency characteristics. The result is not > as we expected. Below is more details. > > > 1. guest os launch: qemu-system-x86_64 -monitor stdio -machine pc -enable-kvm > -smp 1 -m 8G -mem-path ${RAM_FILE} -device e1000,netdev=user.0 -netdev > user,id=user.0,hostfwd=tcp::5555-:22 > ${SRC_DIR}/../images/snapshot/arch-snapshot1.img > 2. install fmem kernel module in guest linux, the code is here (quick & dirty > workaround for mem_write, please ignore): https://github.com/TianyouLi/fmem > 3. run printf "worldhello" | dd of=/dev/fmem bs=1 count=10 seek=6294967296 > conv=notrunc > 4. run dd if=/dev/fmem bs=1 count=10 seek=6294967296 of=out > 5. cat out -------> here the result is "worldhello" > 6. poweroff ---> guest shutdown > 7. re-launch guest use #1 > 8. run #4, get memory content of same address > 9. the result is not as expected, all zero there > > > I am looking into the code in numa.c of function > allocate_system_memory_nonnuma, which do init memory region and call > qemu_ram_mmap in mmap-alloc.c. Seems the mmap with fd has been setup > correctly so that memory data read/write should be flushed to file and > survive next time of boot. I am not quite clear why step #9 failed to get the > value we previous set in step #4. There could be the test methodology problem > or can be my in-correct understanding of qemu feature. Could you please > elaborate more details or give me some hints? Thanks.
I wonder if QEMU or the guest (BIOS? Kernel?) is zeroing the memory ? For normal memory I'd expect it to zero it. Dave > > > Regards, > Tianyou > > -----Original Message----- > From: Li, Tianyou > Sent: Tuesday, April 19, 2016 10:53 AM > To: Artyom Tarasenko <atar4q...@gmail.com> > Cc: qemu-devel@nongnu.org > Subject: RE: [Qemu-devel] Persistent Main Memory in QEmu > > Hi Artyom, > > Thanks for your pointer! I have tried the -mem-path option, and right now > looking into the code to see if the content of the file will be used during > the guest Linux running next time. Will let you know the result. > > Stefan's post is definitely helpful, thanks for letting me know. Could you > please let me know if you have more QEmu memory management documentation > about internals? I have googled around, but more likely to hear from your > advice. Thanks. > > Regards, > Tianyou > > -----Original Message----- > From: Artyom Tarasenko [mailto:atar4q...@gmail.com] > Sent: Tuesday, April 19, 2016 4:20 AM > To: Li, Tianyou <tianyou...@intel.com> > Cc: qemu-devel@nongnu.org > Subject: Re: [Qemu-devel] Persistent Main Memory in QEmu > > Hi Tianyou, > > On Mon, Apr 18, 2016 at 5:50 AM, Li, Tianyou <tianyou...@intel.com> wrote: > > Currently we are trying to implement below functionalities in QEmu: > > main memory in guest can be logically viewed as persistent and its > > content can be survived through reboot or shutdown/powerup. > > > > I have looked into the QEmu memory management code include memory.c, > > exec.c and other related source, unfortunately I do not have the > > chance to get clue of how to make QEmu main memory persistent. I found > > that pmemsave could dump physical memory of guest, but I could not > > find how to restore the dump file before VM startup to execution. > > > > > > > > Could anyone provide some hints to me? Thanks in advance! > > Is the option "-mem-path=/path/to/mem-file" what you are looking for? > > Stefan wrote a nice post about QEMU RAM internals: > http://blog.vmsplice.net/2016/01/qemu-internals-how-guest-physical-ram.html > > Regards, > Artyom > > > -- > Regards, > Artyom Tarasenko > > SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK