From owner-freebsd-current@FreeBSD.ORG Sun Jun 15 19:03:06 2008 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 572F31065676; Sun, 15 Jun 2008 19:03:06 +0000 (UTC) (envelope-from stas@ht-systems.ru) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id C51B38FC1E; Sun, 15 Jun 2008 19:03:05 +0000 (UTC) (envelope-from stas@ht-systems.ru) Received: from [78.110.49.49] (helo=quasar.ht-systems.ru) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1K7xVE-0000K5-Gf; Sun, 15 Jun 2008 23:03:00 +0400 Received: by quasar.ht-systems.ru (Postfix, from userid 1024) id AF62773004; Sun, 15 Jun 2008 23:02:57 +0400 (MSD) Date: Sun, 15 Jun 2008 23:02:50 +0400 From: Stanislav Sedov To: Coleman Kane Message-Id: <20080615230250.7f3efae4.stas@FreeBSD.org> In-Reply-To: <1212758604.1904.33.camel@localhost> References: <20080606020927.8d6675e1.stas@FreeBSD.org> <10261.1212703949@critter.freebsd.dk> <20080606025533.8322ee08.stas@FreeBSD.org> <1212758604.1904.33.camel@localhost> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Sun__15_Jun_2008_23_02_50_+0400_jpaBycw1DPl7kgr7" Cc: Rui Paulo , Poul-Henning Kamp , kib@FreeBSD.org, current@FreeBSD.org, Peter Jeremy Subject: Re: cpuctl(formely devcpu) patch test request X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jun 2008 19:03:06 -0000 --Signature=_Sun__15_Jun_2008_23_02_50_+0400_jpaBycw1DPl7kgr7 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, 06 Jun 2008 09:23:24 -0400 Coleman Kane mentioned: > What about using the API in priv(9) or similar, such as is done in the > mlock(2)/munlock(2) code in sys/vm/vm_mmap.c ? >=20 This is really a good idea. I've added a bunch of priv checks to cpuctl code, namely PRIV_CPUCTL_RDMSR, PRIV_CPUCTL_WRMSR and PRIV_CPUCTL_UPDATE. Names are self-describing. CPUID ioctl doesn't need that check as this operation are entirely safe and doesn't disclose any sensitive information. In fact it might be even performed from userland if one will find a way to bind the process to a specific cpu. On Fri, 6 Jun 2008 09:14:13 +1000 Peter Jeremy mentioned: > ENOSYS generally means "system call not implemented". You need a response > implying that the requested operation isn't supported on the hardware. > IMHO, ENODEV comes closest to that. > Yeah, it seems that ENODEV is a better choice. =20 > I also agree with phk@ that serious thought needs to be given to the > foot-shooting capability offered by this patch before it is implemented. > Maybe add a sysctl to enable the write (at least) functionality - eg > hw.cpuctl.wrmsr_enable and hw.cpuctl.update_enable (both defaulting to > disabled). This at least adds a safety catch. I'm not sure if RDMSR > is dangerous - if so, possibly there should be an enable for it as well. I don't think that extra anti foot-shooting checks are needed: you can't easily fire up your system via ioctl(2) interface. At least, a little programming exercise is required. What's regarding microcode updates -=20 there's a lot of checks if the microcode image valid in update utility, also the cpu itself checks the microcode CRC before applying update. The latest version of the patch against recent HEAD is available at ftp://ftp.SpringDaemons.com/dustheap/cpuctl.3.diff Thanks! --=20 Stanislav Sedov ST4096-RIPE --Signature=_Sun__15_Jun_2008_23_02_50_+0400_jpaBycw1DPl7kgr7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkhVZ2EACgkQK/VZk+smlYHjAACfcVw+LZK8WtfQhMJoGrzLCnd5 HT8AnjsqoNRcw98ywRTZYi+PaNiF74t9 =+C50 -----END PGP SIGNATURE----- --Signature=_Sun__15_Jun_2008_23_02_50_+0400_jpaBycw1DPl7kgr7--