From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: Petr Cervenka <grugh@domain.hid>, xenomai@xenomai.org
Subject: Re: [Xenomai-help] rtdm_event_timedwait hang-up
Date: Mon, 20 Mar 2006 16:27:23 +0100 [thread overview]
Message-ID: <441EC9DB.7090907@domain.hid> (raw)
In-Reply-To: <441EC28F.20004@domain.hid>
Jan Kiszka wrote:
> Philippe Gerum wrote:
>
>>Jan Kiszka wrote:
>>
>>>Petr Cervenka wrote:
>>>
>>>
>>>>Hello,
>>>>I'm trying to port a driver of a AD card to RTDM.
>>>>When I use rtdm_event_timedwait in IOCTL handler (called from NRT
>>>>user app), the system will hang-up immediately.
>>>>Does it have something to do with:
>>>>https://mail.gna.org/public/xenomai-help/2006-03/msg00035.html
>>>>, ie. it's not possible to call wait /caller blocking functions from
>>>>non-real-time, is it?
>>>
>>>
>>>Yep, that's exactly the point, it's an illegal usage.
>>>
>>>And the fact that this still causes a crash instead of some more
>>>graceful failure reminds me of one reason why I asked for the new
>>>XENO_ASSERT macro: adding debug checks for such mistakes to RTDM.
>>>
>>
>>It would be nice to have all potentially blocking syscalls actively
>>checking for invalid call context, so that we always get graceful
>>returns. At least, I'm in the process of adding the missing checks to
>>the traditional RTOS skins which I'm extending with a native syscall
>>interface. The good news is that it's basically a matter of grepping
>>xnsynch_sleep_on() in the codebase.
>>
>>--- skins/rtdm/drvlib.c (revision 765)
>>+++ skins/rtdm/drvlib.c (working copy)
>>@@ -648,6 +648,11 @@
>> else if (!__test_and_clear_bit(0, &event->pending)) {
>> xnthread_t *thread = xnpod_current_thread();
>>
>>+ if (xnpod_unblockable_p()) {
>>+ err = -EPERM;
>>+ goto unlock_and_exit;
>>+ }
>>+
>> xnsynch_sleep_on(&event->synch_base, XN_INFINITE);
>>
>> if (!xnthread_test_flags(thread, XNRMID|XNBREAK))
>>@@ -658,6 +663,7 @@
>> err = -EINTR;
>> }
>>
>>+ unlock_and_exit:
>> xnlock_put_irqrestore(&nklock, s);
>>
>> return err;
>
>
> Agree, but I prefer to be able to switch those checks off when the used
> drivers have been verified for correctness.
>
> Actually, this check is up to them: when some service is invoked from
> the "wrong" context, the driver can return -ENOSYS to let Xenomai switch
> to the right one. It can also return some other error to the user
> instead. Or it can block certain contexts by not registering related
> service handlers.
I agree; there are some RTDM specific issues, especially the adaptive calls.
>
> As the user never invokes RTDM services directly, I see no need for
> permanent checks. The Linux kernel does such checking also on demand,
> not by default.
>
Yes, but the kernel usually don't go south when a user-level app does a
mistake. We currently do.
> Jan
>
--
Philippe.
next prev parent reply other threads:[~2006-03-20 15:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-20 13:34 [Xenomai-help] rtdm_event_timedwait hang-up Petr Cervenka
2006-03-20 13:59 ` Jan Kiszka
2006-03-20 14:27 ` Philippe Gerum
2006-03-20 14:56 ` Jan Kiszka
2006-03-20 15:27 ` Philippe Gerum [this message]
2006-03-20 16:13 ` Jan Kiszka
2006-03-20 16:20 ` Jan Kiszka
2006-03-20 16:54 ` Philippe Gerum
2006-03-20 17:02 ` Jan Kiszka
2006-03-20 17:26 ` Philippe Gerum
2006-03-21 0:48 ` Alexis Berlemont
2006-03-21 2:04 ` Jan Kiszka
2006-03-21 2:04 ` [Xenomai-core] COMEDI over RTDM (was: rtdm_event_timedwait hang-up) Jan Kiszka
2006-03-22 1:24 ` [Xenomai-core] " Alexis Berlemont
2006-03-24 17:31 ` [Xenomai-core] Re: COMEDI over RTDM Jan Kiszka
2006-03-20 18:01 ` [Xenomai-help] rtdm_event_timedwait hang-up Petr Cervenka
2006-03-20 23:02 ` Jan Kiszka
2006-03-20 23:31 ` Jeff Webb
2006-03-21 14:03 ` [Xenomai-help] rtdm_event_timedwait hang-up - SOLVED Petr Cervenka
2006-03-21 14:17 ` Philippe Gerum
2006-03-21 15:17 ` Jan Kiszka
2006-03-21 16:29 ` Philippe Gerum
2006-03-21 16:56 ` Jan Kiszka
2006-03-21 17:34 ` Philippe Gerum
2006-03-21 18:18 ` Jan Kiszka
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=441EC9DB.7090907@domain.hid \
--to=rpm@xenomai.org \
--cc=grugh@domain.hid \
--cc=jan.kiszka@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.