All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Philippe Gerum <rpm@xenomai.org>,
	Matthias Schneider <ma30002000@yahoo.de>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] rtdm_mutex_init on forge
Date: Thu, 29 May 2014 18:34:03 +0200	[thread overview]
Message-ID: <5387617B.6030208@xenomai.org> (raw)
In-Reply-To: <538760BE.4050309@xenomai.org>

On 05/29/2014 06:30 PM, Philippe Gerum wrote:
> On 05/29/2014 06:19 PM, Philippe Gerum wrote:
>> On 05/29/2014 05:42 PM, Matthias Schneider wrote:
>>> Hi all,
>>>
>>> I have a question about rtdm_mutex_init in forge. BUG_ON is
>>> triggered each time I create an rtdm_mutex. This seems to be
>>> due to a check in xnsynch_init, while apparently some
>>> implementation is still missing in rtdm_mutex_init():
>>>
>>> void rtdm_mutex_init(rtdm_mutex_t *mutex)
>>> {
>>>          spl_t s;
>>>
>>>          /* Make atomic for re-initialisation support */
>>>          xnlock_get_irqsave(&nklock, s);
>>>
>>>          xnsynch_init(&mutex->synch_base,
>>>                       XNSYNCH_PRIO | XNSYNCH_PIP | XNSYNCH_OWNER, NULL);
>>>
>>>          xnlock_put_irqrestore(&nklock, s);
>>> }
>>>
>>>
>>> void xnsynch_init(struct xnsynch *synch, int flags, atomic_long_t
>>> *fastlock)
>>> {
>>>          if (flags & XNSYNCH_PIP)
>>>                  flags |= XNSYNCH_PRIO | XNSYNCH_OWNER;  /*
>>> Obviously... */
>>>
>>>          synch->status = flags & ~XNSYNCH_CLAIMED;
>>>          synch->owner = NULL;
>>>          synch->cleanup = NULL;  /* Only works for PIP-enabled
>>> objects. */
>>>          synch->wprio = -1;
>>>          INIT_LIST_HEAD(&synch->pendq);
>>>
>>>          if (flags & XNSYNCH_OWNER) {
>>>                  BUG_ON(fastlock == NULL); // <---------- Obviously
>>> this is
>>>                                            //             always
>>> occurs for an
>>>                                            //             rtdm_mutex.
>>>                  synch->fastlock = fastlock;
>>>                  atomic_long_set(fastlock, XN_NO_HANDLE);
>>>          } else
>>>                  synch->fastlock = NULL;
>>> }
>>>
>>> At the moment I am not sure if the atomic_long_t counter needs be
>>> added to
>>> rtdm_mutex or the flags need to be changed. Thanks for your help,
>>>
>>
>> RTDM mutexes cannot and do not have to provide fast locking memory, the
>> assertion I have added to xnsynch_init() is broken. Will fix.
> 
> Yes, the intent was to acknowledge the fact that we know how to 
> implement fast locking on all supported arch, rtdm was overlooked. So 
> this spurious assertion builds on the wrong assumption that a NULL 
> fastlock cannot happen with priority inversion protected locks.
> 

Adding fastlock to RTDM mutexes looks possible, and would create a
lockless fast patch for them as well.

-- 
                                                                Gilles.


  reply	other threads:[~2014-05-29 16:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 15:42 [Xenomai] rtdm_mutex_init on forge Matthias Schneider
2014-05-29 16:19 ` Philippe Gerum
2014-05-29 16:30   ` Philippe Gerum
2014-05-29 16:34     ` Gilles Chanteperdrix [this message]
2014-05-29 17:12       ` Philippe Gerum
2014-05-29 19:37 ` Philippe Gerum
2014-06-01 11:56   ` Matthias Schneider

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=5387617B.6030208@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=ma30002000@yahoo.de \
    --cc=rpm@xenomai.org \
    --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.