From owner-svn-src-head@FreeBSD.ORG Wed Dec 17 19:59:49 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEA241065673; Wed, 17 Dec 2008 19:59:49 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 670328FC12; Wed, 17 Dec 2008 19:59:49 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 419B3FEF2; Thu, 18 Dec 2008 08:59:48 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BgzYeQCTPnzb; Thu, 18 Dec 2008 08:59:44 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Thu, 18 Dec 2008 08:59:44 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 88FE911430; Thu, 18 Dec 2008 08:59:43 +1300 (NZDT) Date: Wed, 17 Dec 2008 11:59:43 -0800 From: Andrew Thompson To: Ivan Voras Message-ID: <20081217195943.GB45764@citylink.fud.org.nz> References: <200812171957.mBHJvCO2013765@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200812171957.mBHJvCO2013765@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186252 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2008 19:59:50 -0000 On Wed, Dec 17, 2008 at 07:57:12PM +0000, Ivan Voras wrote: > Author: ivoras > Date: Wed Dec 17 19:57:12 2008 > New Revision: 186252 > URL: http://svn.freebsd.org/changeset/base/186252 > > Log: > 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. > > Modified: > head/sys/kern/subr_param.c Sorry for chiming in late but should the sysctl be a string? 1,2,3 arent all that useful. Andrew