hammer2 - Merge Mihai Carabas's VKERNEL/VMM GSOC project into the main tree
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 20 Sep 2013 23:15:43 +0000 (16:15 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 20 Sep 2013 23:15:43 +0000 (16:15 -0700)
commita86ce0cd3432dae6b7c762eb728684f7b101bc5f
tree9c7e08249f11339c13da681cbc835f2c939b0c42
parenta977bf879651837d1fcee810ad28506cb5334300
hammer2 - Merge Mihai Carabas's VKERNEL/VMM GSOC project into the main tree

* This merge contains work primarily by Mihai Carabas, with some misc
  fixes also by Matthew Dillon.

* Special note on GSOC core

  This is, needless to say, a huge amount of work compressed down into a
  few paragraphs of comments.  Adds the pc64/vmm subdirectory and tons
  of stuff to support hardware virtualization in guest-user mode, plus
  the ability for programs (vkernels) running in this mode to make normal
  system calls to the host.

* Add system call infrastructure for VMM mode operations in kern/sys_vmm.c
  which vectors through a structure to machine-specific implementations.

  vmm_guest_ctl_args()
  vmm_guest_sync_addr_args()

  vmm_guest_ctl_args() - bootstrap VMM and EPT modes.  Copydown the original
  user stack for EPT (since EPT 'physical' addresses cannot reach that far
  into the backing store represented by the process's original VM space).
  Also installs the GUEST_CR3 for the guest using parameters supplied by
  the guest.

  vmm_guest_sync_addr_args() - A host helper function that the vkernel can
  use to invalidate page tables on multiple real cpus.  This is a lot more
  efficient than having the vkernel try to do it itself with IPI signals
  via cpusync*().

* Add Intel VMX support to the host infrastructure.  Again, tons of work
  compressed down into a one paragraph commit message.  Intel VMX support
  added.  AMD SVM support is not part of this GSOC and not yet supported
  by DragonFly.

* Remove PG_* defines for PTE's and related mmu operations.  Replace with
  a table lookup so the same pmap code can be used for normal page tables
  and also EPT tables.

* Also include X86_PG_V defines specific to normal page tables for a few
  situations outside the pmap code.

* Adjust DDB to disassemble SVM related (intel) instructions.

* Add infrastructure to exit1() to deal related structures.

* Optimize pfind() and pfindn() to remove the global token when looking
  up the current process's PID (Matt)

* Add support for EPT (double layer page tables).  This primarily required
  adjusting the pmap code to use a table lookup to get the PG_* bits.

  Add an indirect vector for copyin, copyout, and other user address space
  copy operations to support manual walks when EPT is in use.

  A multitude of system calls which manually looked up user addresses via
  the vm_map now need a VMM layer call to translate EPT.

* Remove the MP lock from trapsignal() use cases in trap().

* (Matt) Add pthread_yield()s in most spin loops to help situations where
  the vkernel is running on more cpu's than the host has, and to help with
  scheduler edge cases on the host.

* (Matt) Add a pmap_fault_page_quick() infrastructure that vm_fault_page()
  uses to try to shortcut operations and avoid locks.  Implement it for
  pc64.  This function checks whether the page is already faulted in as
  requested by looking up the PTE.  If not it returns NULL and the full
  blown vm_fault_page() code continues running.

* (Matt) Remove the MP lock from most the vkernel's trap() code

* (Matt) Use a shared spinlock when possible for certain critical paths
  related to the copyin/copyout path.
106 files changed:
include/sysexits.h
lib/libkvm/kvm_minidump_x86_64.c
lib/libkvm/kvm_x86_64.c
sys/conf/files
sys/config/MYKERNEL64 [new symlink]
sys/cpu/i386/include/frame.h
sys/cpu/x86_64/include/frame.h
sys/cpu/x86_64/include/pmap.h
sys/cpu/x86_64/include/specialreg.h
sys/cpu/x86_64/misc/db_disasm.c
sys/kern/init_sysent.c
sys/kern/kern_exec.c
sys/kern/kern_exit.c
sys/kern/kern_proc.c
sys/kern/kern_prot.c
sys/kern/kern_slaballoc.c
sys/kern/kern_umtx.c
sys/kern/lwkt_ipiq.c
sys/kern/lwkt_thread.c
sys/kern/sys_vmm.c [new file with mode: 0644]
sys/kern/syscalls.c
sys/kern/syscalls.master
sys/kern/uipc_syscalls.c
sys/kern/vfs_helper.c
sys/kern/vfs_vm.c
sys/platform/pc32/i386/pmap.c
sys/platform/pc32/include/pmap.h
sys/platform/pc32/include/vmm.h [copied from sys/platform/vkernel64/include/pmap_inval.h with 53% similarity]
sys/platform/pc64/conf/files
sys/platform/pc64/include/md_var.h
sys/platform/pc64/include/pmap.h
sys/platform/pc64/include/vmm.h [copied from sys/platform/vkernel64/include/pmap_inval.h with 53% similarity]
sys/platform/pc64/vmm/ept.c [new file with mode: 0644]
sys/platform/pc64/vmm/ept.h [new file with mode: 0644]
sys/platform/pc64/vmm/svm.c [new file with mode: 0644]
sys/platform/pc64/vmm/svm.h [new file with mode: 0644]
sys/platform/pc64/vmm/vmm.c [new file with mode: 0644]
sys/platform/pc64/vmm/vmm.h [copied from sys/platform/vkernel64/include/pmap_inval.h with 53% similarity]
sys/platform/pc64/vmm/vmm_utils.c [new file with mode: 0644]
sys/platform/pc64/vmm/vmm_utils.h [copied from sys/platform/vkernel64/include/pmap_inval.h with 53% similarity]
sys/platform/pc64/vmm/vmx.c [new file with mode: 0644]
sys/platform/pc64/vmm/vmx.h [new file with mode: 0644]
sys/platform/pc64/vmm/vmx_genassym.c [new file with mode: 0644]
sys/platform/pc64/vmm/vmx_instr.h [new file with mode: 0644]
sys/platform/pc64/vmm/vmx_trap.s [new file with mode: 0644]
sys/platform/pc64/vmm/vmx_vmcs.h [new file with mode: 0644]
sys/platform/pc64/x86_64/db_interface.c
sys/platform/pc64/x86_64/genassym.c
sys/platform/pc64/x86_64/machdep.c
sys/platform/pc64/x86_64/minidump_machdep.c
sys/platform/pc64/x86_64/mp_machdep.c
sys/platform/pc64/x86_64/pmap.c
sys/platform/pc64/x86_64/pmap_inval.c
sys/platform/pc64/x86_64/support.s
sys/platform/pc64/x86_64/tls.c
sys/platform/pc64/x86_64/trap.c
sys/platform/pc64/x86_64/uwrapper.c [new file with mode: 0644]
sys/platform/pc64/x86_64/vm_machdep.c
sys/platform/vkernel/i386/db_interface.c
sys/platform/vkernel/include/pmap.h
sys/platform/vkernel/include/vmm.h [copied from sys/platform/vkernel64/include/pmap_inval.h with 53% similarity]
sys/platform/vkernel/platform/init.c
sys/platform/vkernel/platform/pmap.c
sys/platform/vkernel/platform/pmap_inval.c
sys/platform/vkernel64/include/pmap.h
sys/platform/vkernel64/include/pmap_inval.h
sys/platform/vkernel64/include/vmm.h [copied from sys/platform/vkernel64/include/pmap_inval.h with 53% similarity]
sys/platform/vkernel64/include/vmparam.h
sys/platform/vkernel64/platform/cothread.c
sys/platform/vkernel64/platform/init.c
sys/platform/vkernel64/platform/ipl_funcs.c
sys/platform/vkernel64/platform/machintr.c
sys/platform/vkernel64/platform/pmap.c
sys/platform/vkernel64/platform/pmap_inval.c
sys/platform/vkernel64/x86_64/db_interface.c
sys/platform/vkernel64/x86_64/genassym.c
sys/platform/vkernel64/x86_64/global.s
sys/platform/vkernel64/x86_64/mp.c
sys/platform/vkernel64/x86_64/swtch.s
sys/platform/vkernel64/x86_64/trap.c
sys/sys/proc.h
sys/sys/syscall-hide.h
sys/sys/syscall.h
sys/sys/syscall.mk
sys/sys/sysproto.h
sys/sys/sysunion.h
sys/sys/thread.h
sys/sys/vkernel.h
sys/sys/vmm.h [copied from sys/platform/vkernel64/include/pmap_inval.h with 53% similarity]
sys/sys/wait.h
sys/vfs/procfs/procfs_mem.c
sys/vm/device_pager.c
sys/vm/phys_pager.c
sys/vm/pmap.h
sys/vm/vm_fault.c
sys/vm/vm_glue.c
sys/vm/vm_map.c
sys/vm/vm_mmap.c
sys/vm/vm_object.c
sys/vm/vm_page.h
sys/vm/vm_page2.h
sys/vm/vm_vmspace.c
sys/vm/vm_zeroidle.c
sys/vm/vm_zone.c
test/vmm/Makefile [new file with mode: 0644]
test/vmm/vmm_test.c [new file with mode: 0644]