# clock takes 25 seconds for date to advance 1 second [SOLVED]

## dfelicia

This is really odd.  Machine that's been running Gentoo since 2004.  Recently upgraded to 2008 profile (from 2007.1), and updated everything, including kernel.

Now, after a day or so of uptime, all of a sudden everything in KDE get reaaaallllllyyyy slow.  I've been searching high an low for a cause, and finally found it, sort of.

The clock suddenly (randomly) stops keep time!  If I issue 

```
vmstat 1
```

 it updates once about every 25 seconds.  date command show the same.  ntpd freaks out and dies.

What gives?  Reboot (which takes eons) "fixes" it until it happens the next time.  I'm at a loss for where to start looking to fix this one.  Kernel the most likely culprit?Last edited by dfelicia on Thu Aug 14, 2008 3:42 pm; edited 1 time in total

----------

## pappy_mcfae

Most likely. What kernel version were you running? What version are you running now? Do things still work right with the old kernel, assuming you didn't nuke it already?

Blessed be!

Pappy

----------

## dfelicia

2.6.25-gentoo-r8 (latest stable gentoo-sources).  Previous kernel was 2.6.24.

I did my usual copy .config from previous kernel, make oldconfig, build and install.  Aside from that, I did change from SLAB allocator to SLUB, for no good reason other than I wanted to see if it made any noticeable impact.  Maybe it did?

Recompiled with SLAB and rebooted... will report back if that fixes it, or not, though I'm interested in anyone's insight into what, specifically, could cause this.

----------

## pappy_mcfae

Did you enable fair CPU scheduling? If so, turn it off. If you want, I can review your kernel .config to find out where the problem is.

Blessed be!

Pappy

----------

## dfelicia

I just found this in /var/log/messages:

```

Clocksource tsc unstable (delta = 2811593379 ns)

```

That a clue?

Config for my 2.5.24 kernel, which never exhibited this behavior.

Config for my 2.6.25 kernel, which is exhibiting this behavor

Thanks for your help!

----------

## pappy_mcfae

I've seen that one pop up on my machines, but they are all keeping correct time. At first glance, nothing really jumped out at me saying, "I'm the problem." This is probably going to be a hit and miss affair getting it right.

My suggestion at this point would be to move to kernel 2.6.26, use the older .config and make oldconfig. It could be a kernel bug. I never used that particular kernel version. I gave up on the .25 kernel when .26 came out. If that fixes the problem, then it was a kernel bug. If not, then send the results of lspci -n, and I'll graft your devices onto one of my kernels.

Blessed be!

Pappy

----------

## zeek

See what is available for time keeping on your kernel:

```
 # cat /sys/devices/system/clocksource/clocksource0/available_clocksource

acpi_pm jiffies tsc pit

```

Change it by echo-ing desired timesource:

```

 # echo pit > /sys/devices/system/clocksource/clocksource0/current_clocksource

```

pit is usually quite solid ... but old.  I suggest using hpet if available.

----------

## dfelicia

 *Quote:*   

> See what is available for time keeping on your kernel

 

```

# cat /sys/devices/system/clocksource/clocksource0/available_clocksource 

tsc jiffies

```

Booted 2.6.24 and saw the same.  tsc in use.

Anyway, I went through my kernel config with a fine-toothed comb, and made these significant changes:

Changed SLUB back to SLAB

Added ACPI support (to get the acpi_pm clocksource, in case I wanted to try something other than tsc or jiffies)

Configured NO_HZ (tickless system)

Config before (exhibiting problem): config-2.6.25-gentoo-r7

Config after (so far so good, uptime 48 hours): config-2.6.25-gentoo-r7-new

Fingers crossed that problem doesn't recur.

----------

## dfelicia

Problem never returned.  Wish I knew which kernel param fixed it, but am glad it works.

----------

