From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: Sharing a page of memory between the guest and host Date: Wed, 05 Mar 2008 20:09:33 -0600 Message-ID: <47CF525D.5010500@codemonkey.ws> References: <47CF27B2.8080509@cs.ualberta.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Cam Macdonell Return-path: In-Reply-To: <47CF27B2.8080509@cs.ualberta.ca> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Cam Macdonell wrote: > Hello, > > Is it possible to share a memory (a page perhaps) between the host and > guest? Yes, the host always has access to all of the guests memory. All of the virtio drivers depend on this fact. With KVM, the userspace (in this case, QEMU), just tells the kernel about a virtual address region and the kernel uses that region of virtual memory for the guest's physical memory. Whatever you (as userspace) maps into that region is totally up to you. > More precisely, could a host and guest share a memory-mapped > file? It will be a lot easier once we have MMU notifiers upstream. You'll be able to simply mmap(MAP_FIXED) a file into the guest's physical address space even while it's running. For now, you have to setup these mappings before the VM starts. > If one were crazy enough to want to do this, where should they > look first? > If you look at the -mem-file implementation in the latest git, you'll see that all the guest's memory can be an mmap()'d file. Regards, Anthony Liguori > Thanks, > Cam > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > kvm-devel mailing list > kvm-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/kvm-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/