Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Oct 2003 10:17:34 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Bruce M Simpson <bms@spc.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Why is PCE not set in CR4?
Message-ID:  <3F7C5DAE.CC3C3518@mindspring.com>
References:  <3F7AA0D8.1080801@kma.eu.org> <20031001114155.GA12991@saboteur.dek.spc.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F7C5DAE.CC3C3518>