Go to file
maxv 5ab8a4e764 Make the machdep.svs_enabled sysctl writable, and add the kernel code
needed to disable SVS at runtime.

We set 'svs_enabled' to false, and hotpatch the kernel entry/exit points
to eliminate the context switch code.

We need to make sure there is no remote CPU that is executing the code we
are hotpatching. So we use two barriers:

 * After the first one each CPU is guaranteed to be executing in
   svs_disable_cpu with interrupts disabled (this way it can't leave this
   place).

 * After the second one it is guaranteed that SVS is disabled, so we flush
   the cache, enable interrupts and continue execution normally.

Between the two barriers, cpu0 will disable SVS (svs_enabled=false and
hotpatch), and each CPU will restore the generic syscall entry point.

Three notes:

 * We should call svs_pgg_update(true) afterwards, to put back PG_G on
   the kernel pages (for better performance). This will be done in another
   commit.

 * The fact that we disable interrupts does not prevent us from receiving
   an NMI, and it would be problematic. So we need to add some code to
   verify that PMCs are disabled before hotpatching. This will be done
   in another commit.

 * In svs_disable() we expect each CPU to be online. We need to add a
   check to make sure they indeed are.

The sysctl allows only a 1->0 transition. There is no point in doing 0->1
transitions anyway, and it would be complicated to implement because we
need to re-synchronize the CPU user page tables with the current ones (we
lost track of them in the last 1->0 transition).
2018-02-22 10:42:10 +00:00
bin Typos. 2018-02-08 09:05:16 +00:00
common Complete previous by complteley removing the _DIAGASSERT from memmove - 2018-02-12 11:14:15 +00:00
compat fix a comment. 2018-02-06 10:00:00 +00:00
crypto Backout my over-eager backout - we need this for sparc64 building netbsd32 2018-02-20 13:14:02 +00:00
dist/pf fix two issues found by GCC 6.4: 2018-02-04 08:44:36 +00:00
distrib bump image size for gcc 6 bloaty mc bloat face. 2018-02-22 07:21:10 +00:00
doc Note ddb.dumpstack sysctl 2018-02-17 00:53:53 +00:00
etc Actually install dhcpd6 rc script. Organize CONFIGFILES 2018-02-17 03:02:04 +00:00
external re-port the patch from https://gcc.gnu.org/bugzilla/attachment.cgi?id=15492. 2018-02-22 07:24:19 +00:00
extsrc
games Typos. 2018-02-08 09:05:16 +00:00
include Mark in string.h: memccpy(3) and strdup(3) as _POSIX_C_SOURCE >= 2001 2018-02-20 02:35:24 +00:00
lib Remove extra "an" 2018-02-22 08:33:43 +00:00
libexec Wrap PowerPC #pragma goop in #if __GNUC_PREREQ__(6,0). 2018-02-11 18:58:44 +00:00
regress Don't test call gates, they are not supported anymore. 2017-08-30 15:46:19 +00:00
rescue Extra flags for static PIE 2017-10-08 15:02:33 +00:00
sbin Revert functional changes in previous, at expense of strict KNF conformance. 2018-02-14 17:43:09 +00:00
share Add Microchip EMC1501. 2018-02-22 10:12:54 +00:00
sys Make the machdep.svs_enabled sysctl writable, and add the kernel code 2018-02-22 10:42:10 +00:00
tests make it compile again for those who don't have LOCAL_PEERCRED 2018-02-17 20:16:18 +00:00
tools Fix .endif comment for TOOLS_BUILDRUMP 2018-02-18 01:06:24 +00:00
usr.bin Avoid calling sysconf for every file loaded. 2018-02-22 01:59:28 +00:00
usr.sbin Sort some lists. Use EXIT STATUS instead of RETURN VALUES. 2018-02-14 10:13:25 +00:00
build.sh Remove port-acorn26 2018-01-24 09:04:40 +00:00
BUILDING regen 2018-02-16 10:05:22 +00:00
Makefile Include somewhat misleadingly named do-x11 into BUILDTARGETS even with 2017-12-06 19:34:00 +00:00
Makefile.inc
UPDATING note that openssl and GCC may upset your builds. 2018-02-13 04:36:00 +00:00