git: hammer2 - Merge Mihai Carabas's VKERNEL/VMM GSOC project into the main tree

Matthew Dillon dillon at crater.dragonflybsd.org
Fri Sep 20 16:45:29 PDT 2013


commit a86ce0cd3432dae6b7c762eb728684f7b101bc5f
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Fri Sep 20 16:15:43 2013 -0700

    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.

Summary of changes:
 include/sysexits.h                                 |    1 +
 lib/libkvm/kvm_minidump_x86_64.c                   |    2 +-
 lib/libkvm/kvm_x86_64.c                            |   10 +-
 sys/conf/files                                     |    1 +
 sys/config/MYKERNEL64                              |    1 +
 sys/cpu/i386/include/frame.h                       |    1 +
 sys/cpu/x86_64/include/frame.h                     |    1 +
 sys/cpu/x86_64/include/pmap.h                      |   43 +-
 sys/cpu/x86_64/include/specialreg.h                |    9 +
 sys/cpu/x86_64/misc/db_disasm.c                    |   52 +-
 sys/kern/init_sysent.c                             |    2 +
 sys/kern/kern_exec.c                               |    1 +
 sys/kern/kern_exit.c                               |    5 +
 sys/kern/kern_proc.c                               |    8 +-
 sys/kern/kern_prot.c                               |    1 -
 sys/kern/kern_slaballoc.c                          |    1 +
 sys/kern/kern_umtx.c                               |   15 +
 sys/kern/lwkt_ipiq.c                               |   21 +
 sys/kern/lwkt_thread.c                             |    4 +
 sys/kern/sys_vmm.c                                 |  180 +++
 sys/kern/syscalls.c                                |    2 +
 sys/kern/syscalls.master                           |    2 +
 sys/kern/uipc_syscalls.c                           |    1 +
 sys/kern/vfs_helper.c                              |    1 +
 sys/kern/vfs_vm.c                                  |    1 +
 sys/platform/pc32/i386/pmap.c                      |   11 +
 sys/platform/pc32/include/pmap.h                   |    5 +
 .../include/pmap_inval.h => pc32/include/vmm.h}    |   62 +-
 sys/platform/pc64/conf/files                       |   18 +
 sys/platform/pc64/include/md_var.h                 |    2 +
 sys/platform/pc64/include/pmap.h                   |   41 +
 .../include/pmap_inval.h => pc64/include/vmm.h}    |   48 +-
 sys/platform/pc64/vmm/ept.c                        |  345 +++++
 sys/platform/pc64/vmm/ept.h                        |  120 ++
 sys/platform/pc64/vmm/svm.c                        |  156 ++
 sys/platform/pc64/vmm/svm.h                        |   90 ++
 sys/platform/pc64/vmm/vmm.c                        |  195 +++
 .../include/pmap_inval.h => pc64/vmm/vmm.h}        |   81 +-
 sys/platform/pc64/vmm/vmm_utils.c                  |  166 +++
 .../include/pmap_inval.h => pc64/vmm/vmm_utils.h}  |   51 +-
 sys/platform/pc64/vmm/vmx.c                        | 1569 ++++++++++++++++++++
 sys/platform/pc64/vmm/vmx.h                        |  333 +++++
 sys/platform/pc64/vmm/vmx_genassym.c               |   72 +
 sys/platform/pc64/vmm/vmx_instr.h                  |  164 ++
 sys/platform/pc64/vmm/vmx_trap.s                   |  200 +++
 sys/platform/pc64/vmm/vmx_vmcs.h                   |  215 +++
 sys/platform/pc64/x86_64/db_interface.c            |    6 +-
 sys/platform/pc64/x86_64/genassym.c                |    2 +
 sys/platform/pc64/x86_64/machdep.c                 |    5 +-
 sys/platform/pc64/x86_64/minidump_machdep.c        |   22 +-
 sys/platform/pc64/x86_64/mp_machdep.c              |   13 +-
 sys/platform/pc64/x86_64/pmap.c                    |  531 +++++--
 sys/platform/pc64/x86_64/pmap_inval.c              |    2 +
 sys/platform/pc64/x86_64/support.s                 |   22 +-
 sys/platform/pc64/x86_64/tls.c                     |    7 +
 sys/platform/pc64/x86_64/trap.c                    |   17 +
 sys/platform/pc64/x86_64/uwrapper.c                |   55 +
 sys/platform/pc64/x86_64/vm_machdep.c              |   11 +-
 sys/platform/vkernel/i386/db_interface.c           |    6 +-
 sys/platform/vkernel/include/pmap.h                |    5 +
 .../include/pmap_inval.h => vkernel/include/vmm.h} |   62 +-
 sys/platform/vkernel/platform/init.c               |    6 +-
 sys/platform/vkernel/platform/pmap.c               |   58 +-
 sys/platform/vkernel/platform/pmap_inval.c         |   18 +-
 sys/platform/vkernel64/include/pmap.h              |    8 +
 sys/platform/vkernel64/include/pmap_inval.h        |    7 +
 .../vkernel64/include/{pmap_inval.h => vmm.h}      |   62 +-
 sys/platform/vkernel64/include/vmparam.h           |    6 +-
 sys/platform/vkernel64/platform/cothread.c         |   17 +-
 sys/platform/vkernel64/platform/init.c             |  200 ++-
 sys/platform/vkernel64/platform/ipl_funcs.c        |    3 +
 sys/platform/vkernel64/platform/machintr.c         |   15 +-
 sys/platform/vkernel64/platform/pmap.c             |  238 ++-
 sys/platform/vkernel64/platform/pmap_inval.c       |  231 ++-
 sys/platform/vkernel64/x86_64/db_interface.c       |    6 +-
 sys/platform/vkernel64/x86_64/genassym.c           |    5 +
 sys/platform/vkernel64/x86_64/global.s             |    3 +
 sys/platform/vkernel64/x86_64/mp.c                 |   29 +-
 sys/platform/vkernel64/x86_64/swtch.s              |   45 +-
 sys/platform/vkernel64/x86_64/trap.c               |   13 +-
 sys/sys/proc.h                                     |    2 +
 sys/sys/syscall-hide.h                             |    2 +
 sys/sys/syscall.h                                  |    4 +-
 sys/sys/syscall.mk                                 |    4 +-
 sys/sys/sysproto.h                                 |   16 +
 sys/sys/sysunion.h                                 |    2 +
 sys/sys/thread.h                                   |    2 +-
 sys/sys/vkernel.h                                  |   18 +-
 .../vkernel64/include/pmap_inval.h => sys/vmm.h}   |   54 +-
 sys/sys/wait.h                                     |    2 +-
 sys/vfs/procfs/procfs_mem.c                        |   13 +
 sys/vm/device_pager.c                              |    1 +
 sys/vm/phys_pager.c                                |    1 +
 sys/vm/pmap.h                                      |    1 +
 sys/vm/vm_fault.c                                  |   31 +-
 sys/vm/vm_glue.c                                   |    9 +
 sys/vm/vm_map.c                                    |    6 +
 sys/vm/vm_mmap.c                                   |    1 +
 sys/vm/vm_object.c                                 |    2 +
 sys/vm/vm_page.h                                   |  135 --
 sys/vm/vm_page2.h                                  |  136 ++
 sys/vm/vm_vmspace.c                                |   83 +-
 sys/vm/vm_zeroidle.c                               |    1 +
 sys/vm/vm_zone.c                                   |    1 +
 test/vmm/Makefile                                  |   12 +
 test/vmm/vmm_test.c                                |  111 ++
 106 files changed, 5865 insertions(+), 831 deletions(-)
 create mode 120000 sys/config/MYKERNEL64
 create mode 100644 sys/kern/sys_vmm.c
 copy sys/platform/{vkernel64/include/pmap_inval.h => pc32/include/vmm.h} (53%)
 copy sys/platform/{vkernel64/include/pmap_inval.h => pc64/include/vmm.h} (53%)
 create mode 100644 sys/platform/pc64/vmm/ept.c
 create mode 100644 sys/platform/pc64/vmm/ept.h
 create mode 100644 sys/platform/pc64/vmm/svm.c
 create mode 100644 sys/platform/pc64/vmm/svm.h
 create mode 100644 sys/platform/pc64/vmm/vmm.c
 copy sys/platform/{vkernel64/include/pmap_inval.h => pc64/vmm/vmm.h} (53%)
 create mode 100644 sys/platform/pc64/vmm/vmm_utils.c
 copy sys/platform/{vkernel64/include/pmap_inval.h => pc64/vmm/vmm_utils.h} (53%)
 create mode 100644 sys/platform/pc64/vmm/vmx.c
 create mode 100644 sys/platform/pc64/vmm/vmx.h
 create mode 100644 sys/platform/pc64/vmm/vmx_genassym.c
 create mode 100644 sys/platform/pc64/vmm/vmx_instr.h
 create mode 100644 sys/platform/pc64/vmm/vmx_trap.s
 create mode 100644 sys/platform/pc64/vmm/vmx_vmcs.h
 create mode 100644 sys/platform/pc64/x86_64/uwrapper.c
 copy sys/platform/{vkernel64/include/pmap_inval.h => vkernel/include/vmm.h} (53%)
 copy sys/platform/vkernel64/include/{pmap_inval.h => vmm.h} (53%)
 copy sys/{platform/vkernel64/include/pmap_inval.h => sys/vmm.h} (53%)
 create mode 100644 test/vmm/Makefile
 create mode 100644 test/vmm/vmm_test.c

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/a86ce0cd3432dae6b7c762eb728684f7b101bc5f


-- 
DragonFly BSD source repository



More information about the Commits mailing list