Skip to contentSkip to conversation

Jan Kiszka : nucleus: Fix xnpod_schedule shadow return path for HW_UNLOCKED_SWITCH

Xenomai-core Gilles Chanteperdrix 1 participant 1 message Jun 18, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 40 lines · GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 97de95fdb166d731081f08e157674742f24a243b
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=97de95fdb166d731081f08e157674742f24a243b
Author: Jan Kiszka <[email protected]>
Date:   Sat Jun 18 15:24:22 2011 +0200

nucleus: Fix xnpod_schedule shadow return path for HW_UNLOCKED_SWITCH

Since f6af9b831c, the xnpod_schedule of an interrupt handler may also perform a domain migration. For that case, we must disable interrupts again before returning to a migrated shadow context as the interrupt handler tail depends on that. This only affects HW_UNLOCKED_SWITCH archs.

---

 ksrc/nucleus/pod.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
ksrc/nucleus/pod.c +1 -2
index ec24cb3..f2fa7c8 100644
@@ -1473,8 +1473,7 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t mask,
 		 * would enter the critical section in xnpod_schedule
 		 * while the current Adeos domain is Linux, which
 		 * would defeat the purpose of having called
-		 * xnarch_escalate(). xnpod_schedule() is expected to
-		 * return with interrupts on.
+		 * xnarch_escalate().
 		 */
 		if (mask & XNRELAX) {
 			xnlock_clear_irqon(&nklock);
@@ -2345,9 +2344,12 @@ reschedule:
 			xnshadow_exit();
 		}

ksrc/nucleus/pod.c reschedule: · line 2352

Quoted 10 lines
ksrc/nucleus/pod.c +6 -3
 
-		/* We are returning to xnshadow_relax via
-		   xnpod_suspend_thread, do nothing,
-		   xnpod_suspend_thread will re-enable interrupts. */
+#ifdef CONFIG_XENO_HW_UNLOCKED_SWITCH
+		/* Callers, specifically the reschedule of an IRQ handler that
+		   hit before we called xnpod_schedule xnpod_suspend_thread,
+		   expect us to return with interrupts disabled. */
+		splmax();
+#endif

What about using splexit(s) here instead?

Signature · 1 line
                                                                Gilles.