From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: mmu notifiers Date: Tue, 15 Jan 2008 19:53:19 +0200 Message-ID: <478CF30F.1010100@qumranet.com> References: <20080109181908.GS6958@v2.random> <47860512.3040607@qumranet.com> <47891A5C.8060907@qumranet.com> <478C62F8.2070702@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Daniel J Blueman , Andrea Arcangeli To: Christoph Lameter Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Christoph Lameter wrote: > On Tue, 15 Jan 2008, Avi Kivity wrote: > > >>> Duh. Impossible. Two instances of Linux cannot share page structs. So how >>> are you doing this? Or is this just an idea? >>> >> I was describing one Linux host running two guest instances. The page structs >> are in the host, so they are shared by mmap(). >> > > Ahh.. Okay I was talking about a guest exporting its memory to another > guest. > That's not very different, if they are on the same host? > > >> kvm userspace is just an ordinary host process, it can mmap() any file it >> likes and then assign that virtual memory range to the guest (as guest >> physical memory). >> > > But then the guest does not have its own page struct to manage the memory. > > Why not? It's just a block of memory as far as the guest is concerned. It's entirely up to it whether to create page structs or not. Example: qemu 1: p = mmap("/dev/shm/blah", size, ... ); ioctl(vm_fd, KVM_CREATE_MEMORY_REGION_USER, { p, size, 0x10000000, ... }); qemu 2: p = mmap("/dev/shm/blah", size, ... ); ioctl(vm_fd, KVM_CREATE_MEMORY_REGION_USER, { p, size, 0x10000000, ... }); Physical address 0x10000000, of both guests, would map to the same page. Of course, ordinary Linux kernels can't do much with memory that is shared with another guest. I've a feeling we need a whiteboard. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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/