All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] SIGDEBUG_RESCNT_IMBALANCE with recursive mutex
@ 2016-06-01 15:07 Jeffrey Melville
  2016-06-01 15:45 ` Gilles Chanteperdrix
  2016-06-01 16:45 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 7+ messages in thread
From: Jeffrey Melville @ 2016-06-01 15:07 UTC (permalink / raw)
  To: xenomai@xenomai.org

Hi,

Setup: Xenomai 2.6.4 (actually 2.6 git rev 4f349cf0553, with a99426
cherry-picked) with kernel 3.14.17 on a Zynq and the POSIX skin using
the ipipe patches included with the specified git rev)

We've noticed that SIGDEBUG_RESCNT_IMBALANCE is generated when a
(Xenomai) mutex is taken recursively by an NRT thread. The snippet at
the bottom of this message will reproduce the issue. I omitted most of
the error-checking for brevity.

A couple previous threads have discussed slightly similar problems, but
I never saw final resolutions:
http://www.xenomai.org/pipermail/xenomai/2012-January/025278.html
http://www.xenomai.org/pipermail/xenomai/2014-October/031919.html

As far as "why are we doing this?", the problem area occurs in a test
suite where some tests have to run as NRT threads because they don't
have to run real-time and will get killed by the watchdog if they run as
RT threads. Removing the Xenomai wrappers would also be complicated for
reasons that are outside of the scope of this email.

Thanks,
Jeff

---
#include <stdio.h>
#include <pthread.h>

int main(int argc, char **argv)
{
    pthread_mutex_t mutex;
    pthread_mutexattr_t mutex_attr;
    pthread_mutexattr_init(&mutex_attr);
    pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
    if (pthread_mutex_init(&mutex, &mutex_attr) != 0)
    {
        printf("Failed to initialize mutex.\n");
        return 1;
    }
    pthread_mutexattr_destroy(&mutex_attr);
    pthread_mutex_lock(&mutex);
    pthread_mutex_lock(&mutex);
    pthread_mutex_unlock(&mutex);
    pthread_mutex_unlock(&mutex);
    pthread_mutex_destroy(&mutex);
    return 0;
}


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

end of thread, other threads:[~2016-06-17 19:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-01 15:07 [Xenomai] SIGDEBUG_RESCNT_IMBALANCE with recursive mutex Jeffrey Melville
2016-06-01 15:45 ` Gilles Chanteperdrix
2016-06-01 16:48   ` Jeffrey Melville
2016-06-01 16:45 ` Gilles Chanteperdrix
2016-06-01 16:58   ` Jeffrey Melville
2016-06-16 13:26     ` Gilles Chanteperdrix
2016-06-17 19:30       ` Jeffrey Melville

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.