* [Xenomai-help] deadlock for rtdm_mutex
@ 2010-03-18 15:05 Huan Fang
2010-03-18 15:15 ` Philippe Gerum
2010-03-18 15:16 ` Jan Kiszka
0 siblings, 2 replies; 4+ messages in thread
From: Huan Fang @ 2010-03-18 15:05 UTC (permalink / raw)
To: xenomai@xenomai.org
Hi,
Sometimes I got below assertion failed:
xenomai/skins/rtdm/drvlib.c:1544 (mutex_owner != curr_thread)
Looking into the code,
/* Redefinition to clarify XENO_ASSERT output */
#define mutex_owner xnsynch_owner(&mutex->synch_base)
XENO_ASSERT(RTDM, mutex_owner != curr_thread,
err = -EDEADLK; goto unlock_out;);
Does it mean if the current owner of mutex is different from the requesting thread, then a -EDEADLK error is returned?(which is not documented in RTDM api doc)
In my case, if one thread tries to lock same mutex twice, the assertion is thrown out as well. Could you please explain a bit how does Xenomai detect deadlock?
Thanks.
Regards,
Huan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-help] deadlock for rtdm_mutex
2010-03-18 15:05 [Xenomai-help] deadlock for rtdm_mutex Huan Fang
@ 2010-03-18 15:15 ` Philippe Gerum
2010-03-18 15:16 ` Jan Kiszka
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2010-03-18 15:15 UTC (permalink / raw)
To: Huan Fang; +Cc: xenomai@xenomai.org
On Thu, 2010-03-18 at 16:05 +0100, Huan Fang wrote:
> Hi,
>
> Sometimes I got below assertion failed:
>
> xenomai/skins/rtdm/drvlib.c:1544 (mutex_owner != curr_thread)
>
> Looking into the code,
> /* Redefinition to clarify XENO_ASSERT output */
> #define mutex_owner xnsynch_owner(&mutex->synch_base)
> XENO_ASSERT(RTDM, mutex_owner != curr_thread,
> err = -EDEADLK; goto unlock_out;);
>
> Does it mean if the current owner of mutex is different from the requesting thread, then a -EDEADLK error is returned?(which is not documented in RTDM api doc)
> In my case, if one thread tries to lock same mutex twice, the assertion is thrown out as well. Could you please explain a bit how does Xenomai detect deadlock?
> Thanks.
#define XENO_ASSERT(subsystem,cond,action) do { \
if (unlikely(CONFIG_XENO_OPT_DEBUG_##subsystem > 0 && !(cond))) { \
xnarch_trace_panic_freeze(); \
xnlogerr("assertion failed at %s:%d (%s)\n", __FILE__, __LINE__,
(#cond)); \
xnarch_trace_panic_dump(); \
action; \
} \
} while(0)
XENO_ASSERT(RTDM, mutex_owner != curr_thread,
err = -EDEADLK; goto unlock_out;);
This means that RTDM mutexes do not allow recursion.
>
> Regards,
> Huan
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
--
Philippe.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-help] deadlock for rtdm_mutex
2010-03-18 15:05 [Xenomai-help] deadlock for rtdm_mutex Huan Fang
2010-03-18 15:15 ` Philippe Gerum
@ 2010-03-18 15:16 ` Jan Kiszka
2010-03-18 17:28 ` Huan Fang
1 sibling, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2010-03-18 15:16 UTC (permalink / raw)
To: Huan Fang; +Cc: xenomai@xenomai.org
Huan Fang wrote:
> Hi,
>
> Sometimes I got below assertion failed:
>
> xenomai/skins/rtdm/drvlib.c:1544 (mutex_owner != curr_thread)
>
> Looking into the code,
> /* Redefinition to clarify XENO_ASSERT output */
> #define mutex_owner xnsynch_owner(&mutex->synch_base)
> XENO_ASSERT(RTDM, mutex_owner != curr_thread,
> err = -EDEADLK; goto unlock_out;);
>
> Does it mean if the current owner of mutex is different from the requesting thread, then a -EDEADLK error is returned?(which is not documented in RTDM api doc)
If the mutex is contended, the owner _must_ be different from the
current thread.
> In my case, if one thread tries to lock same mutex twice, the assertion is thrown out as well. Could you please explain a bit how does Xenomai detect deadlock?
Quite simple: RTDM mutexes do not support recursion, so you must not
acquire them twice in the same thread. That's a reasonable
simplification of the design you find in the mainline kernel as well e.g.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-help] deadlock for rtdm_mutex
2010-03-18 15:16 ` Jan Kiszka
@ 2010-03-18 17:28 ` Huan Fang
0 siblings, 0 replies; 4+ messages in thread
From: Huan Fang @ 2010-03-18 17:28 UTC (permalink / raw)
To: xenomai@xenomai.org
Thanks for the explanation, now it's clear.
Regards,
Huan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-18 17:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18 15:05 [Xenomai-help] deadlock for rtdm_mutex Huan Fang
2010-03-18 15:15 ` Philippe Gerum
2010-03-18 15:16 ` Jan Kiszka
2010-03-18 17:28 ` Huan Fang
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.