Re: problem with rdtsc on Pentium M
From: KVP (spamtrap_at_crayne.org)
Date: 10/19/04
- Next message: KVP: "Re: question about system memory space mapping"
- Previous message: David J. Craig: "Re: Needed: x86 Assembler Guru in SE Florida"
- In reply to: Grumble: "Re: problem with rdtsc on Pentium M"
- Next in thread: John Doe: "Re: problem with rdtsc on Pentium M"
- Reply: John Doe: "Re: problem with rdtsc on Pentium M"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 19 Oct 2004 11:33:03 +0000 (UTC)
Grumble <devnull@kma.eu.org> wrote:
> Patrick Klos wrote:
> > You're using a Pentium M - that's the problem. Intel, in their
> > sometimes infinite senselessness, decided that when the processor
> > is halted (as in the idle loop), this version of the processor
> > will STOP the TSC counter as well. What did they save? A few
> > nanowatts?!? Anyway, we ran into this problem a few years ago.
> > Because WE NEED RDTSC to continuously work, we opted to create
> > our own "idle thread", which we set to low priority and put into
> > a "while (!time_to_exit) {}" loop so the system never actually
> > got to the system's idle process. It's a kludge, but it works.
> Does this mean the CPU never goes into its lower power modes?
> You ran into the problem a few years ago? I thought Intel
> introduced the Pentium M micro-architecture 18 months ago?
The specifications allowed this since the introduction of the tsc.
It counts actual cpu cycles and not time. Intel told developers not
to use the tsc for timing, only for profiling.
The solution above won't work on all systems, because for example some
PII laptops from ibm used similar techniques. Ibm decided to alter a few
settings automatically depending on the power state of the computer. Two
examples are the system bus clock frequency (which also alters the cpu
speed), and the tft backlight power (which lowers the brightness when the
system gets unplugged). The result is that some poor quality software,
that depends on the tsc always gets out of syncron when the user docks or
undocks the computer. (a classical problem is the power failiure, where the
laptop's job would be to switch automatically to battery power instead of
an application crash)
My advice would be to always use external reference timers. There are two
such timers on a standard x86 pc. One is the programmable interval timer
(used by every major os), and the other one is the real time clock (this
one is a bit unstable if used too frequently).
Viktor
- Next message: KVP: "Re: question about system memory space mapping"
- Previous message: David J. Craig: "Re: Needed: x86 Assembler Guru in SE Florida"
- In reply to: Grumble: "Re: problem with rdtsc on Pentium M"
- Next in thread: John Doe: "Re: problem with rdtsc on Pentium M"
- Reply: John Doe: "Re: problem with rdtsc on Pentium M"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|