tech-kern archive

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

on "monotonic clock gone backwards"



Hi -
the monotonic clock doesn't go backwards. I've instrumented
binuptime() on my box and didn't get a hit.
The reason for negative process run times is that at one point
the LWP's l_stime is played with behind the monotonic clock's back,
in kern_time.c:settime1(). This can lead to "now - stime"
being negative in kern_synch.c:updatertime() which can
make LWP->l_rtime negative if the time step is big enough.
The appended patch solves this for me, I just need to check
whether other statistics os interval timers are affected.
best regards
Matthias





-------------------------------------------------------------------
-------------------------------------------------------------------
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 [d798ef9279d73f00c8db6becae7bdc986126646e]
#
# patch "sys/kern/kern_time.c"
#  from [efe327f0f3885f013480bb0a6b94194c44a9a424]
#    to [826ba7ea6307571156ab15bdef85e079e5ff8719]
#
============================================================
--- sys/kern/kern_time.c        efe327f0f3885f013480bb0a6b94194c44a9a424
+++ sys/kern/kern_time.c        826ba7ea6307571156ab15bdef85e079e5ff8719
@@ -132,8 +132,10 @@ settime1(struct proc *p, const struct ti
 settime1(struct proc *p, const struct timespec *ts, bool check_kauth)
 {
        struct timespec delta, now;
+#if 0
        struct bintime btdelta;
        lwp_t *l;
+#endif
        int s;
 
        /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
@@ -159,6 +161,7 @@ settime1(struct proc *p, const struct ti
 
        timespecadd(&boottime, &delta, &boottime);
 
+#if 0
        /*
         * XXXSMP: There is a short race between setting the time above
         * and adjusting LWP's run times.  Fixing this properly means
@@ -172,6 +175,7 @@ settime1(struct proc *p, const struct ti
                lwp_unlock(l);
        }
        mutex_exit(proc_lock);
+#endif
        resettodr();
        splx(s);
 


Home | Main Index | Thread Index | Old Index