Hi,

first of all, happy new year and all the best wishes for 2011 to all of you.

I was also able to reproduce the sporadic failures of mutex_test_posix. I 
suspect the root of it in the scheduling interactions between the delegate 
threads and the main() thread -- it appears that occasionally the delegate 
thread is not activated in time and thus fails to lock the mutex. This, in 
turn, causes the main() thread to lock the mutex early.

I've played a bit with the thread priorities of main() and the delegate. 
However, even with the delegates having a higher priority than main(), the 
failure still showed up. The only way I could prevent the "too early" error 
from happening was to change the test's source could as in the following diff:

diff --git a/tests/automated/mutex/sw/mutex_test_posix.c b/tests/automated/mutex
index 8385469..e066872 100644
--- a/tests/automated/mutex/sw/mutex_test_posix.c
+++ b/tests/automated/mutex/sw/mutex_test_posix.c
@@ -50,7 +50,7 @@ int main( int argc, char *argv[] )
                unsigned long ticks = cyg_current_time();
                //printf("current time = %ld ticks\n",ticks); // XXX remove
                pthread_mutex_unlock(&mutex);
-               while(cyg_current_time() - ticks < 10); // wait for 0.1 seconds
+               cyg_thread_delay(10);
                pthread_mutex_lock(&mutex);
                ticks = cyg_current_time() - ticks;
                //printf("delta t = %ld ticks\n", ticks); // XXX remove

After this change I wasn't able to reproduce the error, but that doesn't mean 
it's gone. Also, even without the delay(), the first mutex_unlock() should 
cause the delegate to be scheduled if it has a higher priority.

Any ideas what could be causing this?

Best regards
- Enno

> -----Ursprüngliche Nachricht-----
> Von: reconos-devel-boun...@lists.reconos.de [mailto:reconos-devel-
> boun...@lists.reconos.de] Im Auftrag von Ariane Keller
> Gesendet: Donnerstag, 6. Januar 2011 13:12
> An: Discussions for ReconOS development
> Betreff: Re: [reconos-devel] ML605 automated tests
> 
> Hi all
> 
> On Dec 14, 2010, at 4:17 PM, Markus wrote:
> 
> > Hi *,
> >
> > I performed the automated tests on the ML605. 64 of 65 tests succeeded,
> but one test failed (mutex_test_posix).
[...]
> > It would be interesting to know, if anyone can reproduce this failure.
> 
> I finally managed to do the tests.  The exec_mutex_posix test also failed in
> my setup.
> My statistics are:
> Success: 6 runs
> 1 failure: 4 runs
> 
> failure:
> mutex lock and release by hwthread: too early
> (occurrence: once but at different stages)
> 
> All the other tests were ok.
> 
> Cheers,
> Ariane
> 
_______________________________________________
Reconos-devel_lists.reconos.de mailing list
reconos-devel@lists.reconos.de
https://ml01.ispgateway.de/mailman/listinfo/reconos-devel_lists.reconos.de

Antwort per Email an