Skip to contentSkip to conversation

gettimeofday() moving backwards

DISCUSSION Paul Richards 2 participants 2 messages Dec 18, 2002 – Dec 19, 2002 1 message not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

Hi,
I am using linux kernel v2.4.20 with ACPI patch dated 2002-12-05.

I have noticed that if my processor changes state (800Mhz up to 1200Mhz say) then gettimeofday() behaves weirdly. It runs smoothly but every now and again (on the order of 10 times a second) it makes a correction. If I have gone from 800Mhz to 1200Mhz then the correction is backwards, otherwise it makes a forward jump..

I presume that this is because the kernel hasn't noticed that the cpu state has changed and hasn't corrected the variables that control how the time is calculated using the tsc.

Is there a patch for this..? It doesn't sound like *too* big a thing.. ie just recalculate a cpl of timing variables when the cpu state changes.. but ofc I don't know the details :)

Signature · 9 lines
Paul Richards



-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi!

Quoted 8 lines

I am using linux kernel v2.4.20 with ACPI patch dated 2002-12-05.

I have noticed that if my processor changes state (800Mhz up to 1200Mhz say) then gettimeofday() behaves weirdly. It runs smoothly but every now and again (on the order of 10 times a second) it makes a correction. If I have gone from 800Mhz to 1200Mhz then the correction is backwards, otherwise it makes a forward jump..

Quoted 7 lines

I presume that this is because the kernel hasn't noticed that the cpu state has changed and hasn't corrected the variables that control how the time is calculated using the tsc.

Is there a patch for this..? It doesn't sound like *too* big a thing.. ie just recalculate a cpl of timing variables when the cpu state changes.. but ofc I don't know the details :)

Its actually pretty hard to do... Because at least at APM cpu can change clock any time. And recalibration of delay loop takes quite long... Still it might be good idea to recalibrate after clock change.

Pavel

Signature · 8 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?


-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/