Skip to contentSkip to conversation

Deadlock with interrupt shield activated / Avoid mode switches at compile time

Xenomai-help Markus Seemann 3 participants 3 messages Jul 28, 2010 – Jul 31, 2010

lore
Share & tools
lore
#0 lore raw

Hello,

a more theoretical question:

Is it possible to provocate a deadlock while switching a RTTask from primary mode to secondary mode when the interrupt shield is activated? Perhaps with this kind of scenario:
- linux process takes semaphore
- RTTask switches to secondary mode and also tries to take this semaphore
- The semaphore would be released in ISR context of the linux kernel. But the interrupt shield prevents the execution of this isr.

How realistic is this scenario?

Another question:
Is it possible to avoid mode switches for realtime tasks at compile time for a specific task?

Thanks in advance,
Markus
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02

#1 lore raw
Quoted 12 lines · Markus Seemann

Hello,

a more theoretical question:

Is it possible to provocate a deadlock while switching a RTTask from primary mode to secondary mode when the interrupt shield is activated? Perhaps with this kind of scenario: - linux process takes semaphore - RTTask switches to secondary mode and also tries to take this semaphore - The semaphore would be released in ISR context of the linux kernel. But the interrupt shield prevents the execution of this isr.

Quoted 1 line

How realistic is this scenario?

Does not look very realistic, but it is possible. Anyway, the interrupt shield no longer exists in Xenomai 2.5.

Quoted 4 lines

Another question: Is it possible to avoid mode switches for realtime tasks at compile time for a specific task?

No. But we provide a way to detect and act upon them at run-time.

When a switch to secondary mode happens, it is necessary to get the task to continue running, so, the only way to handle such situation would be to destroy the task in need for a switch to secondary mode.

Signature · 1 line
					    Gilles.
#2 lore raw
In reply to Markus Seemann
Quoted 11 lines · Markus Seemann

Hello,

a more theoretical question:

Is it possible to provocate a deadlock while switching a RTTask from primary mode to secondary mode when the interrupt shield is activated? Perhaps with this kind of scenario:
- linux process takes semaphore
- RTTask switches to secondary mode and also tries to take this semaphore
- The semaphore would be released in ISR context of the linux kernel. But the interrupt shield prevents the execution of this isr.

How realistic is this scenario?

The I-shield would be disengaged as soon as a non-Xenomai thread is scheduled in, resuming the linux ISR flow. So unless the CPU remains 100% busy to process Xenomai threads either in primary or secondary mode
- which would be the first problem to solve - this can't happen (the RT task for one would block, pending on the semaphore, creating an opportunity for non-RT threads to resume).

This is not to say that the I-shield might not bring other tricky issue(s) in, but this one is not possible by design.

Quoted 5 lines

Another question:
Is it possible to avoid mode switches for realtime tasks at compile time for a specific task?

Avoiding a priori would mean to deny compilation when a code path which may lead to a linux syscall is detected; not quite simple to implement for userland apps given otherwise valid dependencies on the glibc Xenomai may have (e.g. for creating threads).

Quoted 10 lines

Thanks in advance,
Markus
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.