Skip to contentSkip to conversation

mutex and timers

Xenomai Jesper Christensen 2 participants 5 messages Nov 29, 2012

lore
Share & tools
lore
#0 lore raw

Hello

I was wondering if (and i have a feeling i already know the answer) it is a no-go to call rtdm_mutex_lock from a rtdm timer handler? I've just discovered that is what we do, and i have a feeling it is causing trouble (most of the time it seems to work however).

Signature · 6 lines
/Jesper B. Christensen
Development Engineer
T +45 39 55 88 02
E [email protected]
Thrane & Thrane A/S - Lundtoftegaardsvej 93D
DK-2800 Kgs. Lyngby, Denmark - www.thrane.com
#1 lore raw
Quoted 7 lines · Jesper Christensen

Hello

I was wondering if (and i have a feeling i already know the answer) it is a no-go to call rtdm_mutex_lock from a rtdm timer handler? I've just discovered that is what we do, and i have a feeling it is causing trouble (most of the time it seems to work however).

no go indeed. As soon as the mutex is contented, an attempt is made to put the caller to sleep, which can't be done over an IRQ context. So the situation is essentially, a mess.

Signature · 1 line
Philippe.
#2 lore raw

As i suspected, thank you very much.

/Jesper B. Christensen
Development Engineer
T +45 39 55 88 02
E [email protected]
Thrane & Thrane A/S - Lundtoftegaardsvej 93D
DK-2800 Kgs. Lyngby, Denmark - www.thrane.com

Quoted 13 lines · Philippe Gerum
Quoted 7 lines · Jesper Christensen

Hello

I was wondering if (and i have a feeling i already know the answer) it is a no-go to call rtdm_mutex_lock from a rtdm timer handler? I've just discovered that is what we do, and i have a feeling it is causing trouble (most of the time it seems to work however).

no go indeed. As soon as the mutex is contented, an attempt is made to put the caller to sleep, which can't be done over an IRQ context. So the situation is essentially, a mess.

#3 lore raw
In reply to Jesper Christensen
Quoted 7 lines · Jesper Christensen

Hello

I was wondering if (and i have a feeling i already know the answer) it is a no-go to call rtdm_mutex_lock from a rtdm timer handler? I've just discovered that is what we do, and i have a feeling it is causing trouble (most of the time it seems to work however).

Btw, you should enable XENO_OPT_DEBUG_NUCLEUS and XENO_OPT_DEBUG_RTDM in your kernel config (leave out DEBUG_QUEUES, it introduces a lot of overhead and should only be set when explicitly required). This would trap at such attempt, pinpointing the issue.

Signature · 1 line
Philippe.
#4 lore raw

Okay i will do that, thanks.

/Jesper B. Christensen
Development Engineer
T +45 39 55 88 02
E [email protected]
Thrane & Thrane A/S - Lundtoftegaardsvej 93D
DK-2800 Kgs. Lyngby, Denmark - www.thrane.com

Quoted 14 lines · Philippe Gerum
Quoted 7 lines · Jesper Christensen

Hello

I was wondering if (and i have a feeling i already know the answer) it is a no-go to call rtdm_mutex_lock from a rtdm timer handler? I've just discovered that is what we do, and i have a feeling it is causing trouble (most of the time it seems to work however).

Btw, you should enable XENO_OPT_DEBUG_NUCLEUS and XENO_OPT_DEBUG_RTDM in your kernel config (leave out DEBUG_QUEUES, it introduces a lot of overhead and should only be set when explicitly required). This would trap at such attempt, pinpointing the issue.