freebsd-dev/sys
Ivan Voras 3dc309114a Introduce a sysctl kern.vm_guest that reflects what the kernel knows about
it running under a virtual environment. This also introduces a globally
accessible variable vm_guest that can be used where appropriate in the
kernel to inspect this environment.

To make it easier for the long run, an enum VM_GUEST is also introduced,
which could possibly be factored out in a header somewhere (but the
question is where - vm/vm_param.h? sys/param.h?) so it eventually becomes
a part of the standard KPI. In any case, it's a start.

The purpose of all this isn't to absolutely detect that the OS is running
under a virtual environment (cf. "redpill") but to allow the parts of the
kernel and the userland that care about this particular aspect and can do
something useful depending on it to have a standardised interface. Reducing
kern.hz is one example but there are other things that could be done like
avoiding context switches, not using CPU instructions that are known to be
slow in emulation, possibly different strategies in VM (memory) allocation,
CPU scheduling, etc.

It isn't clear if the JAILS/VIMAGE functionality should also be exposed
by this particular mechanism (probably not since they're not "full"
virtual hardware environments). Sometime in the future another sysctl and
a variable could be introduced to reflect if the kernel supports any kind
of virtual hosting (e.g. VMWare VMI, Xen dom0).

Reviewed by:	silence from src-commiters@, virtualization@, kmacy@
Approved by:	gnn (mentor)
Security:	Obscurity doesn't help.
2008-12-17 19:57:12 +00:00
..
amd64 Make gpart the default partitioning class on all platforms. 2008-12-17 17:43:22 +00:00
arm Make gpart the default partitioning class on all platforms. 2008-12-17 17:43:22 +00:00
boot Use full 64bit arithmetic when converting file offsets to block numbers - fixes 2008-12-17 18:12:01 +00:00
bsm Merge OpenBSM 1.1 alpha 2 from the OpenBSM vendor branch to head, both 2008-12-02 23:26:43 +00:00
cam Revert r186186 for now; it breaks stuff. 2008-12-17 10:49:03 +00:00
cddl Put the MIPS support back in after it was removed in r185029. 2008-12-04 16:31:08 +00:00
compat Remove two remnant uses of AT_DEBUG. 2008-12-17 13:13:35 +00:00
conf Adapt parts of the sparc64 Open Firmware bus enumeration code (in particular, 2008-12-15 15:31:10 +00:00
contrib This main goals of this project are: 2008-12-15 06:10:57 +00:00
crypto Avoid 256 integer divisions per rc4_init() call. Replace it with using 2008-12-16 13:58:37 +00:00
ddb Collect N identical (or near identical) mkdumpheader() implementations into 2008-10-01 22:08:53 +00:00
dev Improve error handling at ata_ahci_chipinit(). 2008-12-17 19:17:58 +00:00
fs According to phk@, VOP_STRATEGY should never, _ever_, return 2008-12-16 21:13:11 +00:00
gdb Commit SYSINIT() ;-adding patch missed in previous pass. 2008-03-16 13:02:04 +00:00
geom Implement g_vfs_orphan(). Without it, the filesystem never closes 2008-12-16 17:04:52 +00:00
gnu According to phk@, VOP_STRATEGY should never, _ever_, return 2008-12-16 21:13:11 +00:00
i386 Make gpart the default partitioning class on all platforms. 2008-12-17 17:43:22 +00:00
ia64 AT_DEBUG and AT_BRK were OBE like 10 years ago, so retire them. 2008-12-17 06:56:58 +00:00
isa Allow device hints to wire the unit numbers of devices. 2008-11-18 21:01:54 +00:00
kern Introduce a sysctl kern.vm_guest that reflects what the kernel knows about 2008-12-17 19:57:12 +00:00
kgssapi Call svc_freereq() before returning from the service proc. 2008-11-12 15:31:05 +00:00
libkern Add simple locking for the in-kernel iconv code. Translation operations 2008-12-05 21:19:24 +00:00
mips Make gpart the default partitioning class on all platforms. 2008-12-17 17:43:22 +00:00
modules This main goals of this project are: 2008-12-15 06:10:57 +00:00
net Remove the rt argument from nd6_storelladdr() because 2008-12-17 10:27:34 +00:00
net80211 fix comment 2008-12-16 01:17:36 +00:00
netatalk Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netgraph Unroll two loops of SHA1Update(). 60 bytes of static memory is not a price. 2008-12-16 19:15:31 +00:00
netinet Another step assimilating IPv[46] PCB code: 2008-12-17 13:00:18 +00:00
netinet6 Another step assimilating IPv[46] PCB code: 2008-12-17 13:00:18 +00:00
netipsec Another step assimilating IPv[46] PCB code - directly use 2008-12-15 21:50:54 +00:00
netipx Add missing "goto set_head" for SO_IPX_CHECKSUM; otherwise we fall through 2008-12-11 10:29:35 +00:00
netnatm Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netncp Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
netsmb Implement device cloning for /dev/nsmb, the netsmb control pseudo-device. 2008-11-03 14:23:15 +00:00
nfs Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT. 2008-03-25 09:39:02 +00:00
nfs4client Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessary 2008-10-28 13:44:11 +00:00
nfsclient Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
nfsserver Handle VFS_VGET() failing with an error other than EOPNOTSUPP in addition 2008-12-16 04:34:09 +00:00
nlm Don't call svc_freereq() before svc_freeargs(). 2008-11-12 15:30:30 +00:00
opencrypto Don't hang if encrypting/decrypting using struct iovecs where one of the 2008-10-30 16:11:07 +00:00
pc98 Make gpart the default partitioning class on all platforms. 2008-12-17 17:43:22 +00:00
pccard
pci It seems that RealTek PCIe controllers require an explicit Tx poll 2008-12-17 08:18:11 +00:00
powerpc Fix E500 cache invalidation routines. 2008-12-17 15:54:25 +00:00
rpc Add a missing call to mtx_destroy(). 2008-11-12 12:21:18 +00:00
security Merge OpenBSM 1.1 alpha 2 from the OpenBSM vendor branch to head, both 2008-12-02 23:26:43 +00:00
sparc64 Make gpart the default partitioning class on all platforms. 2008-12-17 17:43:22 +00:00
sun4v Make gpart the default partitioning class on all platforms. 2008-12-17 17:43:22 +00:00
sys Remove sysctl debug.elf_trace and the trace field in auxargs. They go 2008-12-17 16:54:29 +00:00
tools Remove some unused and broken code that attempted to not invoke locking 2008-11-03 19:57:40 +00:00
ufs According to phk@, VOP_STRATEGY should never, _ever_, return 2008-12-16 21:13:11 +00:00
vm Instead of forcing vn_start_write() to reset mp back to NULL for the 2008-11-16 21:57:54 +00:00
xdr Use the remote address for access control, not the local address. This fixes 2008-11-13 14:36:52 +00:00
xen Integrate 185578 from dfr 2008-12-04 07:59:05 +00:00
Makefile Improve the glimpse target: don't index .svn and compile directories. 2008-08-15 14:11:30 +00:00