From: Philippe Gerum <rpm@xenomai.org>
To: Philippe Gerum <rpm@xenomai.org>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PATCH] fix pthread cancellation in native skin
Date: Wed, 01 Feb 2006 20:07:52 +0100 [thread overview]
Message-ID: <43E10708.3030109@domain.hid> (raw)
In-Reply-To: <43E0FCB8.1050902@domain.hid>
Philippe Gerum wrote:
> Gilles Chanteperdrix wrote:
>
>> Gilles Chanteperdrix wrote:
>> > This is not the only situation where a thread with a nucleus
>> suspension
>> > bit need to run shortly in secondary mode: it also occurs when
>> > suspending with xnpod_suspend_thread() a thread running in secondary
>> > mode; the thread receives the SIGCHLD signal and need to execute
>> shortly
>> > with the suspension bit set in order to cause a migration to primary
>> > mode.
>> > > So, the only case when we are sure that a user-space thread can
>> not be
>> > scheduled by Linux seems to be when this thread does not have the
>> > XNRELAX bit.
>>
>> From all the bits in XNTHREAD_BLOCK_BITS, only when the XNPEND bit is
>> set, a thread can not be running in secondary mode. Hence the proposed
>> patch.
>>
>
> Almost ok, but XNDELAY might also be set alone, indicating a purely
> timed wait state (i.e. without sync object to pend on, so XNPEND is off).
>
Forget about this: XNDELAY might also be a transient bit like XNSUSP, so you are
right, we cannot test it there.
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: ksrc/nucleus/shadow.c
>> ===================================================================
>> --- ksrc/nucleus/shadow.c (revision 507)
>> +++ ksrc/nucleus/shadow.c (working copy)
>> @@ -1543,14 +1543,25 @@
>>
>> #ifdef CONFIG_XENO_OPT_DEBUG
>> {
>> - xnflags_t status = threadin->status & ~XNRELAX;
>> + xnflags_t status = threadin->status;
>> int sigpending = signal_pending(next);
>>
>> - if (!(next->ptrace & PT_PTRACED) &&
>> + if (!testbits(status, XNRELAX))
>> + {
>> + show_stack(xnthread_user_task(threadin),NULL);
>> + xnpod_fatal("Hardened thread %s[%d] running in Linux
>> domain?! (status=0x%lx, sig=%d, prev=%s[%d])",
>> + threadin->name,
>> + next->pid,
>> + status,
>> + sigpending,
>> + prev->comm,
>> + prev->pid);
>> + }
>> + else if (!(next->ptrace & PT_PTRACED) &&
>> /* Allow ptraced threads to run shortly in order to
>> properly recover from a stopped state. */
>> testbits(status,XNSTARTED) &&
>> - testbits(status,XNTHREAD_BLOCK_BITS))
>> + testbits(status,XNPEND))
>> {
>> show_stack(xnthread_user_task(threadin),NULL);
>> xnpod_fatal("blocked thread %s[%d] rescheduled?!
>> (status=0x%lx, sig=%d, prev=%s[%d])",
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Xenomai-core mailing list
>> Xenomai-core@domain.hid
>> https://mail.gna.org/listinfo/xenomai-core
>
>
>
--
Philippe.
next prev parent reply other threads:[~2006-02-01 19:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-28 9:34 [Xenomai-core] [PATCH] fix pthread cancellation in native skin Jan Kiszka
2006-01-28 10:25 ` Gilles Chanteperdrix
2006-01-30 11:34 ` Gilles Chanteperdrix
2006-02-01 12:31 ` Gilles Chanteperdrix
2006-02-01 18:23 ` Philippe Gerum
2006-02-01 19:07 ` Philippe Gerum [this message]
2006-02-03 16:21 ` Gilles Chanteperdrix
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=43E10708.3030109@domain.hid \
--to=rpm@xenomai.org \
--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.