From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Philippe Gerum <rpm@xenomai.org>
Cc: Xenomai-help@domain.hid
Subject: Re: [Xenomai-help] Interrupt processing crashes in semTake
Date: Fri, 25 Nov 2005 13:04:20 +0100 [thread overview]
Message-ID: <17286.64964.4382.190611@domain.hid> (raw)
In-Reply-To: <4386EACC.1080501@domain.hid>
[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 1847 bytes --]
Philippe Gerum wrote:
> Hans-J. Ude wrote:
> > I'm porting an vxWorks application to Xenomai at the moment. When it comes
> > to interrupt handling, there is nothing in the vx skin to handle that (did i
> > overlook something?). First I've tried to handle that down in the xenomai
> > layer but problems occured and someone advised me to use a native interrupt
> > task using rt_intr_wait. I did so but the program segfaults after a minute
> > or so. I've put a sigsegv handler with a stack backtrace function into the
> > code. That shows the crash happens in the internals of semTake. Is it
> > problematic to make skin calls (semGive in my case) from inside the native
> > irq handler?
>
> Yes, it's indeed a problem. When calling semTake from the in-kernel
> VxWorks skin, the invoked code expects a VxWorks task to be current in
> order to put it to sleep, but in your case, it's a native skin task.
> Since both TCBs have obviously different memory layouts, the segfault is
> inevitable. The same goes when calling semGive from a native task, since
> the latter code needs to fiddle with the caller's internals. That's a
> limitation of possible skin interactions.
Looking at the code, it seems that semTake should return an error when
called from an ISR, and semGive should work when called from an ISR, for
semaphores created with semBCreate or semCCreate, but not for those
created with semMCreate.
But there is an issue with wind_errnoset not checking whether the value
returned by wind_current_task is not NULL, this should explain the
segfault, but will not be make semTake work from an ISR.
Could you check whether the attached patch removes the segfault ?
It should applied to the vxworks skin defs.h file; its location depends
on the Xenomai branch you are using.
--
Gilles Chanteperdrix.
[-- Attachment #2: wind_errnoset.diff --]
[-- Type: text/plain, Size: 844 bytes --]
Index: defs.h
===================================================================
--- defs.h (revision 153)
+++ defs.h (working copy)
@@ -55,7 +55,11 @@
{ \
if(!xnpod_asynch_p() && \
xnthread_test_flags(xnpod_current_thread(), IS_WIND_TASK)) \
- wind_current_task()->errorStatus = value; \
+ { \
+ wind_task_t *_cur = wind_current_task(); \
+ if (_cur) \
+ _cur->errorStatus = value; \
+ } \
} while(0)
next prev parent reply other threads:[~2005-11-25 12:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-25 9:58 [Xenomai-help] Interrupt processing crashes in semTake Hans-J. Ude
2005-11-25 10:43 ` Philippe Gerum
2005-11-25 12:04 ` Gilles Chanteperdrix [this message]
2005-11-27 18:47 ` 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=17286.64964.4382.190611@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=Xenomai-help@domain.hid \
--cc=rpm@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.