Clocksource/0: Time went backwards
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/146924
So I'm pretty sure this only happens with the broken xenified kernels built on the forward-ported suse xenified patches.
the xen debian wiki has some tips http://wiki.debian.org/Xen#A.27clocksource.2BAC8-0.3ATimewentbackwards.27 The clocksource setting can also be given as a kernel parameter as clocksource=jiffies.
the xensource bugzilla may have the answer. http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1098#c8
ok, so the guy from the xen list says:
------ Comment #8 From Atsushi SAKAI 2007-11-01 20:34 [reply] ------- You should replace the function from opensuse kernel to linux 2.6.23 opensuse code does not consider sync to hypervisor. ====opensuse 2.6.22 xen3-patch-2.6.18 === +static cycle_t xen_clocksource_read(void) +{ + int cpu = get_cpu(); + struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu); + cycle_t ret; + + get_time_values_from_xen(cpu); + + ret = shadow->system_timestamp + get_nsec_offset(shadow); + + put_cpu(); + +#ifdef CONFIG_SMP + for (;;) { + static cycle_t last_ret; +#ifndef CONFIG_64BIT + cycle_t last = cmpxchg64(&last_ret, 0, 0); +#else + cycle_t last = last_ret; +#define cmpxchg64 cmpxchg +#endif + + if ((s64)(ret - last) < 0) { + if (last - ret > permitted_clock_jitter + && printk_ratelimit()) + printk(KERN_WARNING "clocksource/%d: " + "Time went backwards: " + "delta=%Ld shadow=%Lu offset=%Lu\n", + cpu, ret - last, + shadow->system_timestamp, + get_nsec_offset(shadow)); + ret = last; + } + if (cmpxchg64(&last_ret, last, ret) == last) + break; + } +#endif + + return ret; +} ==> to Linux 2.6.23 xen_clocksource_read. static cycle_t xen_clocksource_read(void) { struct shadow_time_info *shadow = &get_cpu_var(shadow_time); cycle_t ret; unsigned version; do { version = get_time_values_from_xen(); barrier(); ret = shadow->system_timestamp + get_nsec_offset(shadow); barrier(); } while (version != __get_cpu_var(xen_vcpu)->time.version); put_cpu_var(shadow_time); return ret; }
I did
looks like the brokenness described above is in /arch/x86/kernel/time_32-xen.c so probably 32 only so don't worry. will change something else. trying to change ./arch/x86/xen/time.c instead, though it is rather different.
apt-get install build-essential fakeroot
apt-get build-dep linux-2.6 apt-get sourcelinux-image-2.6.26-1-xen-amd64 cd linux-2.6-2.6.26 fakeroot debian/rules debian/build debian/stamps fakeroot make -f debian/rules.gen setup_amd64_none_amd64
cd debian/build/build_amd64_none_amd64/
...apply my patch...
cd ../../../ fakeroot make -f debian/rules.gen binary-arch_amd64_none_amd64
...
I used http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-official to show me how to build a debian kernel.