[GSOC] Implement hardware nested page table support for vkernels

Mihai Carabas mihai.carabas at gmail.com
Mon Sep 2 06:26:39 PDT 2013

> Nothing tested yet with EPT. Hope tomorrow to do some tests to see what
> errors EPT would throw me :).
 I managed to run a little test program with EPT activated and my VMM
module resolving EPT page-faults.

In the meantime I had a long chat with Dillon and made an assesment of what
should I need in order to close up the GSoC project.
This week I've been refactoring my VMM module to fulfil the things EPT
needs. First of all we need only the FIRST thread of the VKERNEL to init
the EPT space (pagetable). So I created the notion of "master" thread which
does the initialization of the address-space and slaves which takes from
the master the EPT pagetable pointer only.

Going further with the assesment, because the VKERNEL has a different
pagetable (GUEST pagetable) than the HOST (EPT pagetable) all the functions
accessing the user-space from the kernel needs to be modified (won't work
in this form). To maintain compatibility I created a wrapper for those
functions and added pointers to specific implementation for each one
(copyin, copyout, copyinstr, fuword, etc) in the struct pmap (the original
ones were renamed in std_copyin, std_copyout, etc). This was done only for
pc64/x86_64 (for the others remained untouched). The wrappers are not
inline functions because some dependencies were broken between *.h files
 and the solution was to create a secondary header (systm2.h) where to add
the inline functions. I had to touch too many .c files and I give up at
inline wrappers for the moment.

I implemented the copyin/copyout for the EPT pagetables through manual
walking of GUEST pagetable and vm_fault_page in EPT pagetable. All the
other functions are calling the copyin/coyout (like the VKERNEL currently
does). I've tested these implementations with a simple program that does
printf (-> copyin call).

I've also modified the VPTE_* bits to be fully compatible with the standard
X86 PG_* bits. In the vkernel pmap code we should take in consideration the
invalidating functions that does the madvice syscall (this would have to be
replace with inv* calls).

Right now I'm polishing the modified code in order to push it (no commit is
done yet).

In the next week I hope I will finish the vkernel work: refactoring the
vkernel bootstraping with the new model in mind (master and slaves), modify
the pmap code of the VKERNEL (those inval* functions) and modify the
pagetable creation for the new processes. Also I will have to make an
assesment of the copyin/copyout of the VKERNEL functions to see if there is
something to be modified in there. There is still much work to do.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20130902/2d971fbd/attachment-0001.html>

More information about the Kernel mailing list