<div dir="ltr">But wouldn't mmapping some file to the end of guest memory effectively increase the<div>size of physical memory that the guest sees?</div><div><br></div><div>I was thinking more along the following lines: Correct me if I'm wrong at any stage</div>

<div><br></div><div>1. A process inside the guest appears as a process on the host. There is a one to one correspondence.</div><div>2. The host lguest kernel module (page_tables.c) maintains page tables for each guest process. This is the shadow table.</div>

<div>3. When a guest process faults, the guest kernel sets up a new PTE (if legal) and then notifies the host kernel module.</div><div>4. The host kernel module receives this hypercall upon every new page allocation for _any_ guest process and performs</div>

<div>the real allocation of the PTE in the shadow.</div><div><br></div><div>Assuming all of this were true, then wouldn't it suffice to modify the host kernel module's handling of the shadow PTE setting</div><div>

and set it to a page that belongs to some other non-virtualized host process. Would this enable the sharing of a page between</div><div>a regular host process and a virtualized guest process running on the guest kernel?</div>

<div><br></div><div>-Earlence</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 29, 2014 at 1:36 AM, Rusty Russell <span dir="ltr"><<a href="mailto:rusty@rustcorp.com.au" target="_blank">rusty@rustcorp.com.au</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Earlence Fernandes <<a href="mailto:earlenceferns@gmail.com">earlenceferns@gmail.com</a>> writes:<br>


> I think what I'm saying is that how do I shared pages between a host<br>
> process and a guest process, since at the end, both of them are processes<br>
> on the host kernel.<br>
<br>
</div>Yes, it can be done.<br>
<br>
We currently mmap the entire guest memory:<br>
<br>
                        guest_base = map_zeroed_pages(mem / getpagesize()<br>
                                                      + DEVICE_PAGES);<br>
                        guest_limit = mem;<br>
                        guest_max = mem + DEVICE_PAGES*getpagesize();<br>
<br>
You could mmap some other file too (eg. at the end) but make usre you<br>
increase guest_limit, as that is what the kernel uses to prevent the<br>
guest from accessing outside its allowed memory.<br>
<br>
Cheers,<br>
Rusty.<br>
</blockquote></div><br></div>