Hi,

The test case gtod_latency in realtime causes soft lockups on some 
machines. This is because the test hogs the cpus for a long time, 
because it's main loop runs at 
SCHED_FIFO, 99. We have seen soft lockups mainly on LS20 machines 
(x86_64, Opterons). 

The following patch introduces a sleep after some iterations of the 
test. This ensures that the test doesn't hog the cpu completely and 
hence avoids soft lockups.

Testing done:
Compiled with the patch and observed that the soft lockups are gone. 
Also observed that the latencies are not affected. In fact latencies 
improve with this patch on most hardware.

Changelog:
 * Introduce periodic sleeps in the busy loop of gtod_latency to avoid soft 
lockups.

Signed-off-by: Sripathi Kodi <[EMAIL PROTECTED]>
Acked-by: John Stultz <[EMAIL PROTECTED]>

diff -uprN 
ltp_cvs_24nov_org/testcases/realtime/func/gtod_latency/gtod_latency.c 
ltp_cvs_24nov/testcases/realtime/func/gtod_latency/gtod_latency.c
--- ltp_cvs_24nov_org/testcases/realtime/func/gtod_latency/gtod_latency.c       
2008-11-24 21:16:20.000000000 +0530
+++ ltp_cvs_24nov/testcases/realtime/func/gtod_latency/gtod_latency.c   
2008-11-24 21:25:33.000000000 +0530
@@ -216,7 +216,7 @@ struct timespec stop_data[ITERATIONS];
 
 int main(int argc, char *argv[])
 {
-       int i, err;
+       int i, j, k, err;
        unsigned long long delta;
        unsigned long long max, min;
        struct sched_param param;
@@ -262,9 +262,15 @@ int main(int argc, char *argv[])
                latency_trace_enable();
                latency_trace_start();
        }
-       for (i = 0; i < ITERATIONS; i++) {
-               clock_gettime(CLOCK_MONOTONIC,&start_data[i]);
-               clock_gettime(CLOCK_MONOTONIC,&stop_data[i]);
+       /* This loop runs for a long time, hence can cause soft lockups.
+          Calling sleep periodically avoids this. */
+       for (i=0; i<1000; i++) {
+               for (j=0; j < ITERATIONS/1000; j++) {
+                       k = (i * ITERATIONS/1000) + j;
+                       clock_gettime(CLOCK_MONOTONIC,&start_data[k]);
+                       clock_gettime(CLOCK_MONOTONIC,&stop_data[k]);
+               }
+               usleep(1000);
        }
        for (i = 0; i < ITERATIONS; i++) {
                delta = timespec_subtract(&start_data[i], &stop_data[i]);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to