Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is PCE not set in CR4?



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