rtai deadlocking

garrett beaubien garrett.beaubien at gmail.com
Sat Nov 10 06:36:08 CET 2007


Hello,

Sorry to repost my problem, but I'm a little bit lost......

I'm using rtai 3.6 with kernel 2.6.20 (SMP) on a core duo machine, and I'm
still having issues.  I've tried rtai 3.5 as well, with the same results.
I've done some more testing, and I don't understand the results.  I have 2
modules, one with a normal kernel thread, another with a real time thread.
Each is acquiring and releasing a common spinlock
(rt_spin_lock_irqsave/rt_spin_unlock_irqrestore).  If both threads run on
the same core, eventually what happens is a deadlock.  At first I though the
real time thread  could be preempting the kernel thread, but it appears (by
printing the spinlock state) that after the kernel thread releases the lock,
the lock state is unlocked (== 1), but somehow before the realtime thread
tries to acquire it, the lock state changes to locked (==0).

The kernel thread runs with a period of 1/4 second.  The real time thread
runs with a period of 1.1 msec.  These are the only two threads that access
this spinlock.

I think I should be able to synchronize a non realtime and a realtime thread
with the above functions.  Am I correct?  If so, does anyone have an idea
how the spinlock state could change value like this?  Could anyone point me
in the right direction as to how to troubleshoot and fix this problem?
Could there be some compiler optimization causing something to execute out
of order or some other kind of magic?

Thank you very much,
Garrett.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.rtai.org/pipermail/rtai/attachments/20071110/f386f985/attachment.htm 


More information about the Rtai mailing list