From: "Petr Cervenka" <grugh@domain.hid>
To: gilles.chanteperdrix@xenomai.org
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] rtdm_event_timedwait returns -EINTR
Date: Tue, 05 May 2009 10:22:58 +0200 [thread overview]
Message-ID: <200905051022.9846@domain.hid> (raw)
In-Reply-To: <49FF15ED.1010008@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 2436 bytes --]
From: gilles.chanteperdrix@xenomai.org
>Petr Cervenka wrote:
>> I have found following problems / errors:
>> -------------------------------------------------------------- 1)
>> rtdm_event_timedwait() in ioctl handler is not automatically
>> internally restarted (driver: rtdm, app. tasks: native)
>
>That is because rtdm_event_timedwait is not a syscall. It is a
>kernel-space call. Your job is to get ioctl to return -EINTR when
>rtdm_event_timedwait returns -EINTR, so that ioctl will be restarted in
>user-space.
>
>This is undocumented, because you should already know about that if you
>have done a little driver work under linux.
>
Finally I start to understand it. Sorry, but I wrote only couple of drivers. With
knowledge of hardware but not linux.
>>
>> 2) computer hangs, when I call in ioctl handler something like: do {
>> res = rtdm_event_timedwait(&event, timeout, NULL); } while (res ==
>> -EINTR); this could have perhaps some relevance:
>> https://mail.gna.org/public/xenomai-help/2008-11/msg00025.html
>
>That is because you should return to user-space to get the signal handled.
>
So it is better to divide longer operation with device (for example initialization)
into two ioctls. First one for registry settings and second one for waiting for
ready state. Or am I wrong?
>>
>> 3) rt_event_wait() in application is restarted always with the same
>> relative timeout. it could run forever.
>
>Yes, we know that, and we know a fix. But another fix is to use the new
>*_until calls.
>
>>
>> problems with version 2.5-rc1:
>> ----------------------------------------------- 1) function
>> rt_task_shadow always returns -EFAULT
>
>Could you provide us with a small example which has this problem ?
>
Example is in the attachment.
>>
>> 2) when resizing window with latency test running, it prints out "Not
>> SIGSHADOW !". But it should be SIGSHADOW (in my opinion).
>
>"Not SIGSHADOW!" is printed when the SIGWINCH signal handler identifies
>a SIGWINCH not originating from Xenomai. And when you resize the window,
>a SIGWINCH is sent to the application which originates from the Linux
>kernel, not from Xenomai. So, the "Not SIGSHADOW!" is correct. However,
>it is essentially a debug message
>
Oh, it my fault. When I identified these signals as SIGWINCH, I automatically
assumed that it's SIGHARDEN. I completely forgot to look at the basic mean
of SIGWINCH signal. I feel little ashamed.
Petr
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: main.cpp --]
[-- Type: text/x-c++src; name="main.cpp", Size: 1390 bytes --]
#include <sys/mman.h>
#include <native/task.h>
#include <native/event.h>
#include <native/timer.h>
#define MY_EVENT 0x00000001ll
#define MY_PRIORITY 99
static RT_TASK mainTask;
int main(int argc, char** argv) {
const double ONE_SEC = 1e9;
const RTIME timeout = (RTIME)(5 * ONE_SEC);
RT_EVENT event;
unsigned long mask;
RTIME start, end;
int res;
mlockall(MCL_CURRENT | MCL_FUTURE);
res = rt_task_shadow(&mainTask, "main_task", MY_PRIORITY, 0);
if (res < 0) {
printf("rt_task_shadow(): %d (%s)\n", res, strerror(-res));
}
res = rt_task_set_mode(0, T_PRIMARY, NULL);
if (res < 0) {
printf("rt_task_set_mode(): %d (%s)\n", res, strerror(-res));
}
res = rt_event_create(&event, NULL, 0, EV_PRIO);
if (res < 0) {
printf("rt_event_create(): %d (%s)\n", res, strerror(-res));
}
start = rt_timer_read();
res = rt_event_wait(&event, MY_EVENT, &mask, EV_ALL, rt_timer_ns2ticks(timeout));
end = rt_timer_read();
if (res < 0 && res != -ETIMEDOUT) {
printf("rt_event_wait(): %d (%s)\n", res, strerror(-res));
}
printf("time - measured %g s, wanted %g s\n", rt_timer_ticks2ns(end - start)/ONE_SEC, timeout/ONE_SEC);
res = rt_event_delete(&event);
if (res < 0) {
printf("rt_event_delete(): %d (%s)\n", res, strerror(-res));
}
return 0;
}
next prev parent reply other threads:[~2009-05-05 8:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200905041613.30996@domain.hid>
[not found] ` <200905041614.26154@domain.hid>
[not found] ` <200905041615.12763@domain.hid>
[not found] ` <200905041616.11698@domain.hid>
[not found] ` <200905041617.10314@domain.hid>
[not found] ` <200905041618.6444@domain.hid>
[not found] ` <200905041619.25024@domain.hid>
[not found] ` <200905041620.27181@domain.hid>
2009-05-04 14:20 ` [Xenomai-help] rtdm_event_timedwait returns -EINTR Petr Cervenka
2009-05-04 14:22 ` Philippe Gerum
2009-05-04 14:29 ` Philippe Gerum
2009-05-04 16:11 ` Petr Cervenka
2009-05-04 16:21 ` Gilles Chanteperdrix
2009-05-05 8:22 ` Petr Cervenka [this message]
2009-05-04 17:15 ` Philippe Gerum
[not found] <200904301508.29432@domain.hid>
[not found] ` <200904301509.13094@domain.hid>
[not found] ` <200904301510.8382@domain.hid>
[not found] ` <200904301511.15875@domain.hid>
[not found] ` <200904301512.9035@domain.hid>
[not found] ` <200904301513.12716@domain.hid>
[not found] ` <200904301514.6099@domain.hid>
[not found] ` <200904301515.16182@domain.hid>
2009-04-30 13:16 ` Petr Cervenka
2009-04-30 14:09 ` Thomas Lockhart
2009-04-30 14:55 ` Philippe Gerum
2009-04-30 15:27 ` Gilles Chanteperdrix
2009-04-30 18:37 ` Philippe Gerum
2009-05-02 16:27 ` Gilles Chanteperdrix
2009-05-02 18:31 ` Philippe Gerum
2009-05-04 8:24 ` Petr Cervenka
2009-05-04 8:41 ` Philippe Gerum
2009-04-30 22:40 ` Thomas Lockhart
2009-05-01 9:34 ` Philippe Gerum
2009-05-01 9:40 ` Philippe Gerum
2009-05-01 21:35 ` Thomas Lockhart
2009-05-01 22:07 ` Philippe Gerum
2009-05-01 23:44 ` Thomas Lockhart
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=200905051022.9846@domain.hid \
--to=grugh@domain.hid \
--cc=gilles.chanteperdrix@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.