[Xenomai-git] Jan Kiszka : nucleus: Return from xnpod_suspend_thread(XNRELAX) with interrupt disabled
Module: xenomai-head Branch: master Commit: ef290da5e838a66df7a04539d7a77a6b0b820936 URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=ef290da5e838a66df7a04539d7a77a6b0b820936 Author: Jan Kiszka Date: Sat Jun 18 15:49:50 2011 +0200 nucleus: Return from xnpod_suspend_thread(XNRELAX) with interrupt disabled This cleans up the special handling of XNRELAX in xnpod_suspend_thread a bit: Instead of re-enabling the interrupts when returning to a relaxed thread, move that code to xnshadow_relax. Saves some explanations. Signed-off-by: Jan Kiszka --- ksrc/nucleus/pod.c|9 +++-- ksrc/nucleus/shadow.c | 11 +++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c index a98d9b7..9f75092 100644 --- a/ksrc/nucleus/pod.c +++ b/ksrc/nucleus/pod.c @@ -1462,11 +1462,9 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t mask, * have been called from xnshadow_relax(), in which * case we introduce an opportunity for interrupt * delivery right before switching context, which -* shortens the uninterruptible code path. This -* particular caller expects us to always return with -* interrupts enabled. +* shortens the uninterruptible code path. * -* We have to shut irqs off around xnpod_schedule() +* We have to shut irqs off before xnpod_schedule() * though: if an interrupt could preempt us in * __xnpod_schedule right after the call to * xnarch_escalate but before we lock the nklock, we @@ -1478,9 +1476,8 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t mask, if (mask & XNRELAX) { xnlock_clear_irqon(&nklock); - splhigh(s); + splmax(); xnpod_schedule(); - splexit(s); return; } /* diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c index 2189d1a..9f82fa8 100644 --- a/ksrc/nucleus/shadow.c +++ b/ksrc/nucleus/shadow.c @@ -1094,20 +1094,15 @@ void xnshadow_relax(int notify, int reason) * xnpod_suspend_thread() when switching out the current * thread, not to break basic assumptions we do there. * -* We disable interrupts here to initiate the migration -* sequence, and let xnpod_suspend_thread() enable them back -* before returning to us. +* We disable interrupts during the migration sequence, but +* xnpod_suspend_thread() has an interrupts-on section built in. */ splmax(); rpi_push(thread->sched, thread); schedule_linux_call(LO_WAKEUP_REQ, current, 0); clear_task_nowakeup(current); xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL); - /* -* As a special case when switching out a relaxed thread, -* interrupts have been re-enabled before returning to us. See -* xnpod_suspend_thread(). -*/ + splnone(); if (XENO_DEBUG(NUCLEUS) && rthal_current_domain != rthal_root_domain) xnpod_fatal("xnshadow_relax() failed for thread %s[%d]", thread->name, xnthread_user_pid(thread)); ___ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : nucleus: Return from xnpod_suspend_thread(XNRELAX) with interrupt disabled
Module: xenomai-jki Branch: for-upstream Commit: 8c3abce47b0c5e381c35d7fd26ea129547413e3c URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8c3abce47b0c5e381c35d7fd26ea129547413e3c Author: Jan Kiszka Date: Sat Jun 18 15:49:50 2011 +0200 nucleus: Return from xnpod_suspend_thread(XNRELAX) with interrupt disabled This cleans up the special handling of XNRELAX in xnpod_suspend_thread a bit: Instead of re-enabling the interrupts when returning to a relaxed thread, move that code to xnshadow_relax. Saves some explanations. Signed-off-by: Jan Kiszka --- ksrc/nucleus/pod.c|9 +++-- ksrc/nucleus/shadow.c | 11 +++ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c index f2fa7c8..d33701d 100644 --- a/ksrc/nucleus/pod.c +++ b/ksrc/nucleus/pod.c @@ -1462,11 +1462,9 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t mask, * have been called from xnshadow_relax(), in which * case we introduce an opportunity for interrupt * delivery right before switching context, which -* shortens the uninterruptible code path. This -* particular caller expects us to always return with -* interrupts enabled. +* shortens the uninterruptible code path. * -* We have to shut irqs off around xnpod_schedule() +* We have to shut irqs off before xnpod_schedule() * though: if an interrupt could preempt us in * __xnpod_schedule right after the call to * xnarch_escalate but before we lock the nklock, we @@ -1478,9 +1476,8 @@ void xnpod_suspend_thread(xnthread_t *thread, xnflags_t mask, if (mask & XNRELAX) { xnlock_clear_irqon(&nklock); - splhigh(s); + splmax(); xnpod_schedule(); - splexit(s); return; } /* diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c index 2189d1a..9f82fa8 100644 --- a/ksrc/nucleus/shadow.c +++ b/ksrc/nucleus/shadow.c @@ -1094,20 +1094,15 @@ void xnshadow_relax(int notify, int reason) * xnpod_suspend_thread() when switching out the current * thread, not to break basic assumptions we do there. * -* We disable interrupts here to initiate the migration -* sequence, and let xnpod_suspend_thread() enable them back -* before returning to us. +* We disable interrupts during the migration sequence, but +* xnpod_suspend_thread() has an interrupts-on section built in. */ splmax(); rpi_push(thread->sched, thread); schedule_linux_call(LO_WAKEUP_REQ, current, 0); clear_task_nowakeup(current); xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL); - /* -* As a special case when switching out a relaxed thread, -* interrupts have been re-enabled before returning to us. See -* xnpod_suspend_thread(). -*/ + splnone(); if (XENO_DEBUG(NUCLEUS) && rthal_current_domain != rthal_root_domain) xnpod_fatal("xnshadow_relax() failed for thread %s[%d]", thread->name, xnthread_user_pid(thread)); ___ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git