All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Rescnt imbalance in rtdm_mutex_timedlock
@ 2014-03-25 11:45 Erwin Pranz
  2014-03-26 16:49 ` Henri Roosen
  0 siblings, 1 reply; 16+ messages in thread
From: Erwin Pranz @ 2014-03-25 11:45 UTC (permalink / raw)
  To: xenomai

Hello,

I am using rtdm_mutex_lock/rtdm_mutex_unlock in a rtdm driver and I get 
a signal SIGDEBUG_MIGRATE_PRIOINV when I call the driver from a 
priority-0 thread.The signal is sent in xnsynch_release_thread when 
rescnt is 0 on a XNOTHER thread, which means that rescnt is not balanced.

I think the reason why rescnt is not balanced is in 
rtdm_mutex_timedlock: when the owner of the mutex is NULL, the owner is 
changed to the calling thread, but rescnt is not increased.

I suggest the following fix in rtdm_mutex_timedlock:
-       else if (likely(xnsynch_owner(&mutex->synch_base) == NULL))
+       else if (likely(xnsynch_owner(&mutex->synch_base) == NULL)) {
                 xnsynch_set_owner(&mutex->synch_base, curr_thread);
+               if (xnthread_test_state(curr_thread, XNOTHER))
+                       xnthread_inc_rescnt(curr_thread);
+       }

Best regards,

-- 
Erwin Pranz
Software
________________________________

SIGMATEK GmbH & Co KG
Sigmatekstraße 1
5112 Lamprechtshausen Österreich / Austria

Tel.:  +43/6274/4321-0
Fax:  +43/6274/4321-18
E-Mail: erwin.pranz@sigmatek.at
http://www.sigmatek-automation.com



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-03-28 11:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25 11:45 [Xenomai] Rescnt imbalance in rtdm_mutex_timedlock Erwin Pranz
2014-03-26 16:49 ` Henri Roosen
2014-03-26 23:07   ` Gilles Chanteperdrix
2014-03-27  9:41     ` Philippe Gerum
2014-03-27 15:02       ` Henri Roosen
2014-03-27 16:26         ` Philippe Gerum
2014-03-27 18:04           ` Jan Kiszka
2014-03-27 18:24             ` Philippe Gerum
2014-03-27 18:31               ` Jan Kiszka
2014-03-27 18:39                 ` Gilles Chanteperdrix
2014-03-27 20:18                 ` Lowell Gilbert
2014-03-28  8:32                 ` Philippe Gerum
2014-03-27 18:35               ` Gilles Chanteperdrix
2014-03-28  9:52           ` Erwin Pranz
2014-03-28 10:14             ` Philippe Gerum
2014-03-28 11:14               ` Erwin Pranz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.