tech-kern archive

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

TSC clock going backwards on suspend/resume

Hi -
while the problems leading to the monotonic clock being
accused of going backwards are fixed afaics I've found
a case where the clock really doesn't behave:
With the "TSC" as timecounter source I see a step
backwards always after a suspend/resume cycle. This is
a dual-core box so the calibration code might be
involved. Would someone understanding the TSC code
please have a look at this?
I'll append the patch which I used to detect the problem --
unfortunately a positive leads to a panic due to
some locking problem. Too bad, formerly one could
do kernel printfs to the console at any time...
best regards

Forschungszentrum Juelich GmbH
52425 Juelich

Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
# old_revision [77d74059018fef25e0045ba3376431d15ce0288b]
# patch "sys/kern/kern_tc.c"
#  from [dee01e2e4a4717a30f6cbd731a567b4d3ab8a082]
#    to [b0bf69b04598218be191f35700b7e03946a4e311]
--- sys/kern/kern_tc.c  dee01e2e4a4717a30f6cbd731a567b4d3ab8a082
+++ sys/kern/kern_tc.c  b0bf69b04598218be191f35700b7e03946a4e311
@@ -305,6 +305,8 @@ tc_delta(struct timehands *th)
  * the comment in <sys/timevar.h> for a description of these 12 functions.
+static int xxxbupsecs;
 binuptime(struct bintime *bt)
@@ -318,6 +320,10 @@ binuptime(struct bintime *bt)
                *bt = th->th_offset;
                bintime_addx(bt, th->th_scale * tc_delta(th));
        } while (gen == 0 || gen != th->th_generation);
+       if (bt->sec < xxxbupsecs)
+               printf("binuptime: %qd/%d\n", bt->sec, xxxbupsecs);
+       xxxbupsecs = bt->sec;

Home | Main Index | Thread Index | Old Index