kernel - Add two features to improve qemu emulation (64-bit only)
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 13 Jul 2014 00:31:48 +0000 (17:31 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 13 Jul 2014 00:31:48 +0000 (17:31 -0700)
commitb8d5441dd100292b031428ff862426356755d8ea
treed86f0afb9bc9ecba12aada2a7c9faf2139c349f1
parent3a24972feb2f1b72382b28f3a6ee4e65b6760ea5
kernel - Add two features to improve qemu emulation (64-bit only)

* Implement a tunable for machdep.cpu_idle_hlt, allowing it to be
  set in /boot/loader.conf.  For qemu the admin might want to set
  the value to 4 (always use HLT) instead of the default 2.

* Implement a tunable and new sysctl, machdep.pmap_fast_kernel_cpusync,
  which defaults to disabled (0).  Setting this to 1 in /boot/loader.conf
  or at anytime via sysctl tells the kernel to use a one-stage pmap
  invalidation for kernel_pmap updates.  User pmaps are not affected and
  will still use two-stage invalidations.

  One-stage pmap invalidations only have to spin on the originating cpu,
  but all other cpus will not be quiesced when updating a kernel_map pmap
  entry.  This is untested as there might be situations where the kernel
  pmap is updated without an interlock (though most should be interlocked
  already).

  This second sysctl/tunable, if enabled, greatly improves qemu performance
  particularly when the number of qemu cpus is greater than the number of
  real cpus.  It probably improves real hardware system performance as well,
  but is not recommended for production at this time.
sys/platform/pc64/include/pmap.h
sys/platform/pc64/include/pmap_inval.h
sys/platform/pc64/x86_64/machdep.c
sys/platform/pc64/x86_64/pmap.c
sys/platform/pc64/x86_64/pmap_inval.c