qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Li, Tianyou" <tianyou.li@intel.com>
Cc: Artyom Tarasenko <atar4qemu@gmail.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Persistent Main Memory in QEmu
Date: Thu, 21 Apr 2016 11:51:47 +0100	[thread overview]
Message-ID: <20160421105146.GC2268@work-vm> (raw)
In-Reply-To: <1A93516D63C74545A87B6EF0983F2B1F052EB4FB@SHSMSX103.ccr.corp.intel.com>

* Li, Tianyou (tianyou.li@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 <atar4qemu@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:atar4qemu@gmail.com]
> Sent: Tuesday, April 19, 2016 4:20 AM
> To: Li, Tianyou <tianyou.li@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.li@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 / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2016-04-21 10:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18  3:50 [Qemu-devel] Persistent Main Memory in QEmu Li, Tianyou
2016-04-18 20:19 ` Artyom Tarasenko
2016-04-19  2:52   ` Li, Tianyou
2016-04-21 10:47   ` Li, Tianyou
2016-04-21 10:51     ` Dr. David Alan Gilbert [this message]
2016-04-22  3:09       ` Li, Tianyou
2016-04-22 15:35       ` Li, Tianyou
2016-04-22 15:50         ` Artyom Tarasenko
2016-04-22 15:52           ` Li, Tianyou
2016-04-20  8:36 ` Dr. David Alan Gilbert
2016-04-21  0:59   ` Li, Tianyou
2016-04-21  8:06     ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160421105146.GC2268@work-vm \
    --to=dgilbert@redhat.com \
    --cc=atar4qemu@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tianyou.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).