lkml.org 
[lkml]   [2006]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: 2.6.16-rc6-rt7
    From
    Date
    On Fri, 2006-03-17 at 16:36 -0700, Tom Rini wrote:
    > On Thu, Mar 16, 2006 at 10:56:08AM +0100, Ingo Molnar wrote:
    >
    > > i have released the 2.6.16-rc6-rt7 tree, which can be downloaded from
    > > the usual place:
    > >
    > > http://redhat.com/~mingo/realtime-preempt/
    >
    > I was wondering, is it normal for the nanosleep02 and alarm02 LTP tests
    > to fail? For sometime I've seen these tests fail from time to time with
    > the -RT patch but not the regular kernel.

    The nanosleep02 failure is incorrect due to rounding errors in the test
    code.

    Requested time to sleep is 5.000009999 seconds (5s 9999ns)

    Program flow is:

    unsigned long req, rem, before, after, elapsed;

    gettimeofday(&otime);
    nanosleep(&timereq, &timerem); <- Interrupted by a signal
    gettimeofday(&ntime);

    req = timereq.tv_sec * 1000 + timereq.tv_nsec / 1000000;
    rem = timerem.tv_sec * 1000 + timerem.tv_nsec / 1000000;
    before = otime.tv_sec * 1000 + otime.tv_usec/1000;
    after = ntime.tv_sec * 1000 + ntime.tv_usec/1000;
    elapsed = after - before;

    if (rem - (req -elapsed) > 250)
    fail;

    The error message is:
    nanosleep02 1 FAIL : Remaining sleep time 3999 msec doesn't match with the expected 4000 msec time

    rem: 3999 ms
    req - elasped: 4000 ms

    The unsigned long subtraction results in a value > 250, where the real
    result is < 0.

    Looking at the real values with usec resolution gives:

    req: 5000009 usec
    rem: 3999740 usec
    elapsed: 1000452 usec
    req - elapsed: 3999557 usec

    rem - (req -elapsed) = 183 usec

    Truncating the real values by the division used in the test code results
    in:

    req_ms = 5000010 / 1000 = 5000 ms
    rem_ms = 3999470 / 1000 = 3999 ms
    elapsed_ms = 1000452 / 1000 = 1000ms
    req_ms - elapsed_ms = 4000ms

    This never happens on vanilla, as the nanosleep is rounded to the next
    jiffie. -rt has high resolution timers which are delivered accurate, so
    the rounding errors of the testcode surface.

    tglx


    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-03-18 11:39    [W:0.022 / U:1.484 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site