freebsd-skq/sys
John Baldwin 726f4773ec Enable EFER_NXE properly on APs.
EFER_NXE is set in the EFER MSR by initializecpu() and must be set on all
CPUs in the system.  When PG_NX support was added to PAE on i386, the
block to enable EFER_NXE was placed in a section of initializecpu() that
only runs if 'cpu == CPU_686'.  During early boot, locore does an
initial pass to set cpu that sets it to CPU_686 on all CPUs later than
a Pentium.  Later, printcpuinfo() adjusts the 'cpu' variable on
PII and later CPUs to one of CPU_PII, CPU_PIII, or CPU_P4.  However,
printcpuinfo() is called after initializecpu() on the BSP, so the BSP
would enable EFER_NXE and pg_nx.  The APs execute initializecpu() much
later after printcpuinfo() has run.  The end result on a modern CPU was
that cpu was set to CPU_PIII when the APs invoked initializecpu(), so
they did not enable EFER_NXE.  As a result, the APs would fault when
trying to access any pages marked with PG_NX set.

When booting a 2 CPU PAE kernel in bhyve this manifested as a hang before
single user mode.  The attempt to execute /bin/init tried to copy out
the exec strings (argv, etc.) to a non-executable mapping while running
on the AP.  The instruction kept faulting due to invalid bits in the PTE
in an infinite loop.

Fix this by moving the code to enable EFER_NXE out of the switch statement
on 'cpu' and always doing it if 'amd_feature' supports AMDID_NX.

MFC after:	2 weeks
2016-10-26 18:47:47 +00:00
..
amd64 The argument validation in r296956 was not enough to close all possible 2016-10-25 17:13:46 +00:00
arm Use the new fdt_intr.h constants in the Allwinner NMI driver. 2016-10-26 16:03:26 +00:00
arm64 Pull the common FDT interrupt values into a new header rather than be magic 2016-10-26 15:18:08 +00:00
boot LIBSTAND goes last, so put it last here too. 2016-10-26 05:26:59 +00:00
bsm
cam Make pass driver better support CAM_CDB_POINTER flag. 2016-10-17 15:02:17 +00:00
cddl Fix panic after ZVOL renamed to name invalid for DEVFS. 2016-10-24 12:24:24 +00:00
compat Tidy up ia32_sysvec sv_flags setting 2016-10-20 20:29:54 +00:00
conf Import the Cortex String memcpy and memmove into the kernel. On ThunderX 2016-10-25 14:04:35 +00:00
contrib krping: Allow the underlying ib_device to handle DMA mappings. 2016-10-24 20:53:44 +00:00
crypto Fix C++ includability of crypto headers with static array sizes 2016-10-18 23:20:49 +00:00
ddb Determine the operand/address size of %cs in a new function 2016-09-25 16:30:29 +00:00
dev Pull the common FDT interrupt values into a new header rather than be magic 2016-10-26 15:18:08 +00:00
fs A problem w.r.t. interoperation between the FreeBSD NFSv4.1 server with 2016-10-20 23:53:16 +00:00
gdb
geom gmirror: Add a subroutine to free synchronization BIOs. 2016-10-20 23:08:40 +00:00
gnu Revert and redo r306083. 2016-09-22 15:17:36 +00:00
i386 Enable EFER_NXE properly on APs. 2016-10-26 18:47:47 +00:00
isa
kern Include <stdarg.h> instead of <machine/stdarg.h> when compiled as 2016-10-24 18:03:04 +00:00
kgssapi
libkern
mips Correct definition of 'struct sigcontext' on MIPS. 2016-10-26 17:37:08 +00:00
modules jedec_ts: a driver for thermal sensors on memory modules 2016-10-22 08:00:46 +00:00
net hyperv/hn: Fix RX filter settings. 2016-10-24 05:10:35 +00:00
net80211 [net80211] Add a variant on ieee80211_get_rx_params() that returns a pointer. 2016-10-23 08:21:35 +00:00
netgraph Avoid panic from ng_uncallout when unpluggin ethernet cable with active 2016-08-08 19:31:01 +00:00
netinet Remove an extraneous call to soisconnected() in syncache_socket(), 2016-10-26 15:19:18 +00:00
netinet6 Make ICMPv6 hard error handling for TCP consistent with the ICMPv4 2016-10-21 10:32:57 +00:00
netipsec Remove the 4.3BSD compatible macro m_copy(), use m_copym() instead. 2016-09-15 07:41:48 +00:00
netnatm
netpfil Fix ipfw table lookup handler to return entry value, but not its index. 2016-10-19 11:51:17 +00:00
netsmb
nfs Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
nfsclient
nfsserver
nlm When sleeping waiting for either local or remote advisory lock, 2016-06-26 20:08:42 +00:00
ofed Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4 2016-09-30 08:23:06 +00:00
opencrypto Add support for the fpu_kern(9) KPI on arm64. It hooks into the existing 2016-10-20 09:22:10 +00:00
pc98 Fix building on i386 and arm. But 'public domain' headers on the files 2016-10-13 06:56:23 +00:00
powerpc Add a bunch of new default options to MPC85XX* configs 2016-10-24 04:21:06 +00:00
riscv rtwn(4), urtwn(4): merge common code, add support for 11ac devices. 2016-10-17 20:38:24 +00:00
rpc Hide the boottime and bootimebin globals, provide the getboottime(9) 2016-07-27 11:08:59 +00:00
security Don't check aq64_minfree which is unsigned for negative values. 2016-09-08 19:47:57 +00:00
sparc64 Fix building on i386 and arm. But 'public domain' headers on the files 2016-10-13 06:56:23 +00:00
sys Define max_align_t for C11. 2016-10-21 23:50:02 +00:00
teken
tests
tools Consider CROSS_BINUTILS_PREFIX environment variable so we use correct 2016-08-10 13:49:17 +00:00
ufs Include <sys/types.h> explicitly instead of depending on that 2016-10-24 18:12:57 +00:00
vm Simplify keg_drain() a bit by using LIST_FOREACH_SAFE. 2016-10-20 23:10:27 +00:00
x86 Follow-up to r307866: 2016-10-24 20:47:46 +00:00
xdr
xen xen/vchan: change license of header from Lesser GPL v2.1 to BSD 2016-09-30 13:41:24 +00:00
Makefile