Re: [discuss] Re: [Perfctr-devel] Re: Enabling RDPMC in user space by default

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

 



Andi,

On Wed, Nov 30, 2005 at 05:23:15PM +0100, Andi Kleen wrote:
> > to count elapsed cycles while executing a ring 0 and ring 3. The watchdog
> > works by polling on the counter and after a certain delta is reached it
> > triggers an NMI interrupt which, in turn, causes a kernel crash and the
> > (bug) report. Is that the correct behavior?
> 
> The watchdog is driven by the performance counter (this means
> it has varying frequency, but that's not a big issue for the watchdog) 
> 
> It underflows every second in the fastest case or very slowly
> (if the machine is idle). Every time it underflows it checks if 
> the per CPU timer has been ticking, and if it hasn't for some time
> it triggers an oops.

How is the checking for underflows done? Polling?

> 
> The obvious solution would be to set an underflow interrupt at 2^46 or so
> and then reset the counters. For that you would need to count down though.
> 
> > 
> > Also are you sure that the PERFCTR0/PERFSEL0 are not affected when going
> > into lower power state? I know by experience that one IA-64, for instance,
> > the counters are seriously affected.
> 
> They stop ticking in idle. Yes, that's ok if you just want to measure
> cycles because there are no cycles in idle.
> 
Ok that makes sense.

> It's not ok for timing (wall clock time) purposes, but it's also not
> intended for that. If you want time use gettimeofday
> 
I agree.

> They will also clock slower if the CPU is in a P state (runs with lower
> frequency), but for measurements that's also wanted and expected I believe.
> e.g with RDTSC on Intel right now if you are in a lower P state you will
> get wrong results.
> 
> Basically it's a good cycle timer for instruction measurements and
> nothing more.

Yes, it requires pinning and also that nothing else can run
on the processor. This is very restrictive and I wonder if
this is really useable?

> Not ticking in idle actually helps with that because it makes
> it totally clear to everybody that it's not a wall clock :)
> 
Yes, except that this is silently done. There needs to be a
STRONG warning about this somewhere.

> > As Ray mentioned, it all depends on what the user/sysdamin is after.
> > Some people maybe okay with disbaling NMI in favor of more counters.
> > Obviously others people are not.
> 
> I cannot stop them from hacking the kernel, but I don't think
> I will make it easy for them to do this in a stock kernel
> (or at least not until they provide an reliable alternative watchdog
> time source) 
> 

-- 

-Stephane
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux