From: Philippe Gerum <rpm@xenomai.org>
To: "M. Koehrer" <mathias_koehrer@domain.hid>
Cc: xenomai@xenomai.org, jan.kiszka@domain.hid
Subject: Re: [Xenomai-help] Re: Re: What happens if task entry function returns?
Date: Sat, 18 Nov 2006 16:52:23 +0100 [thread overview]
Message-ID: <1163865143.4990.47.camel@domain.hid> (raw)
In-Reply-To: <16178634.1163773048304.JavaMail.ngmail@domain.hid>
On Fri, 2006-11-17 at 15:17 +0100, M. Koehrer wrote:
> Hi Jan,
>
> First, I give you some more information about the error.
> The output is the following:
> Hi, I am task A Hello
> Hi, I am task B World
> Main waits for A
> This is the end of A
> Main waits for B
>
> Then the system hangs.
>
Confirmed here on a two-way PIII. Well, _this_ was a nice one.
Basically, the softlock was due to a missing rescheduling call after
task A has exited, leaving task B in ready state, somewhere in the
Twilight Zone. The patch below fixes it on my setup:
--- ksrc/nucleus/shadow.c (revision 1854)
+++ ksrc/nucleus/shadow.c (working copy)
@@ -1631,7 +1631,8 @@
static inline void do_taskexit_event(struct task_struct *p)
{
- xnthread_t *thread = xnshadow_thread(p); /* p == current */
+ xnthread_t *thread = xnshadow_thread(p); /* p == current */
+ spl_t s;
if (!thread)
return;
@@ -1639,12 +1640,15 @@
if (xnpod_shadow_p())
xnshadow_relax(0);
- /* So that we won't attempt to further wakeup the exiting task in
- xnshadow_unmap(). */
-
+ xnlock_get_irqsave(&nklock, s);
+ /* Prevent wakeup call from xnshadow_unmap(). */
xnshadow_thrptd(p) = NULL;
xnthread_archtcb(thread)->user_task = NULL;
- xnpod_delete_thread(thread); /* Should indirectly call xnshadow_unmap(). */
+ /* xnpod_delete_thread() -> hook -> xnshadow_unmap(). */
+ xnpod_delete_thread(thread);
+ xnsched_set_resched(thread->sched);
+ xnpod_schedule();
+ xnlock_put_irqrestore(&nklock, s);
xnltt_log_event(xeno_ev_shadowexit, thread->name);
}
--
Philippe.
next prev parent reply other threads:[~2006-11-18 15:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-17 12:14 [Xenomai-help] Re: Re: What happens if task entry function returns? M. Koehrer
2006-11-17 13:58 ` [Xenomai-help] " Jan Kiszka
2006-11-17 14:17 ` [Xenomai-help] " M. Koehrer
2006-11-17 15:00 ` Jan Kiszka
2006-11-17 15:28 ` M. Koehrer
2006-11-17 15:38 ` Jan Kiszka
2006-11-18 15:52 ` Philippe Gerum [this message]
2006-11-20 7:52 ` Re: [Xenomai-help] Re: Re: What happens if task entry function M. Koehrer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1163865143.4990.47.camel@domain.hid \
--to=rpm@xenomai.org \
--cc=jan.kiszka@domain.hid \
--cc=mathias_koehrer@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.