All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Huan Fang <huanf@domain.hid>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] deadlock for rtdm_mutex
Date: Thu, 18 Mar 2010 16:16:38 +0100	[thread overview]
Message-ID: <4BA243D6.5010404@domain.hid> (raw)
In-Reply-To: <B66DE711C138E84F96E6A2EDD078830B5F2A4D39CE@MAIL02.ug.kth.se>

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


  parent reply	other threads:[~2010-03-18 15:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-03-18 17:28   ` Huan Fang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA243D6.5010404@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=huanf@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.