From owner-freebsd-questions@FreeBSD.ORG Thu Oct 2 10:18:27 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC12116A4BF; Thu, 2 Oct 2003 10:18:27 -0700 (PDT) Received: from firecrest.mail.pas.earthlink.net (firecrest.mail.pas.earthlink.net [207.217.121.247]) by mx1.FreeBSD.org (Postfix) with ESMTP id 247F043FDF; Thu, 2 Oct 2003 10:18:27 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfi2e.dialup.mindspring.com ([165.247.200.78] helo=mindspring.com) by firecrest.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1A575o-0006J6-00; Thu, 02 Oct 2003 10:18:21 -0700 Message-ID: <3F7C5DAE.CC3C3518@mindspring.com> Date: Thu, 02 Oct 2003 10:17:34 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Bruce M Simpson References: <3F7AA0D8.1080801@kma.eu.org> <20031001114155.GA12991@saboteur.dek.spc.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a46b5750f76495a6d87d32e6f758e4c9d22601a10902912494350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org cc: Grumble cc: freebsd-ia32@freebsd.org cc: freebsd-questions@freebsd.org Subject: Re: Why is PCE not set in CR4? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2003 17:18:28 -0000 Bruce M Simpson wrote: > On Wed, Oct 01, 2003 at 11:39:36AM +0200, Grumble wrote: > > >>However, I am not allowed to use the RDPMC instruction from ring 3 > > >>because the PCE (Performance-monitoring Counters Enable) bit is not set. > > > > > >You can do it with /dev/perfmon. man 4 perfmon. > > > > I have read the perfmon documentation and source code. For several > > reasons, I do not think it is totally adequate in my situation. [ ... ] > > This is an extension to the i386_vm86() syscall which will let you turn > PCE on and off if you're the superuser. I like this a lot better. To answer the inevitable question of "why": PCE counters are a scarce resource, and the kernel needs to run interference on their allocation and deallocation by user space applications, to avoid collisions between applications; this is the same reason we have AGP and sound card device drivers in the kernel. I'm not sure if restricting this to root users is exactly necessary, but it can't hurt, given that there is a performance denial of service possible otherwise. -- Terry