[GSOC] Implement hardware nested page table support for vkernels

Mihai Carabas mihai.carabas at gmail.com
Mon Sep 9 10:39:09 PDT 2013

> 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.
I manage to refactor the whole bootstrap process of a VMM process.
Basically now if someone wants to run as a VMM guest, will call
vmm_guest_ctl(VMM_RUN) and will come back executing the code after this
call in VMM mode, preserving all the attributes (registers, current stack,

Also I've modified the vkernel bootstrap process in order to create a real
pagetable and guard all the vmspace_* calls. The switch between vkernel and
user processes is done through the vmspace_ctl(VMSPACE_CTL_RUN) call but
this call is guarded accordingly and doesn't replace the vmspace at all. It
only sets the new CR3 for the user process in place.

I've also added a hook in madvice syscall, in the MADV_INVAL branch to not
do anything if the call is from the VMM thread. For an TLB invalidation,
it's sufficient to take a VMEXIT --> the VMEXIT is done when the madvice
syscall is made. We can't execute invplg from VMM thread because we are
running at user privilege. In the vkernel64/pmap_inval.c, I've also added a
hook so that the invalidation functions to be executed on each CPU that has
the pmap active (like the real kernel does).

I've also been loosing my time with some wierd bugs (writing at an address
from real kernel and when reading from the vkernel the value was 0 - due to
the fact I wasn't manually walking ok the pagetables - a typo:( - pte vs

Right now the vkernel boots up until "Mounting root from ufs:vkd0s0a". I
will keep debugging it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/kernel/attachments/20130909/ec781db9/attachment.html>

More information about the Kernel mailing list