All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] RTDM rtdm_task_sleep in kernel not always wakes up
@ 2010-03-12 18:21 Huan Fang
  2010-03-13 12:08 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: Huan Fang @ 2010-03-12 18:21 UTC (permalink / raw)
  To: xenomai@xenomai.org

Hello. I am writing a driver using RTDM. Just for testing, I have a rt kernel thread waiting for event signal sent from nrt_ioctl. After the thread is activated, it calls
 rtdm_task_busy_sleep(100000); then
 rtdm_task_sleep(100000);
 When the RT thread is really sleeping, the nrt_ioctl resumes and sleeps via wait_event_interruptible_timeout(2 jiffiles).

Normally, RT thread wakes up after 100us. But the thread seems to hang after 20-30 such loops and never wake up. 
When I kill the process. I saw that wait_event_interruptible_timeout returns a -512. 
The worse thing is I saw kernel panic sometimes during such context switches.

Huan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] RTDM rtdm_task_sleep in kernel not always wakes up
  2010-03-12 18:21 [Xenomai-help] RTDM rtdm_task_sleep in kernel not always wakes up Huan Fang
@ 2010-03-13 12:08 ` Gilles Chanteperdrix
  2010-03-16 15:15   ` Huan Fang
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2010-03-13 12:08 UTC (permalink / raw)
  To: Huan Fang; +Cc: xenomai@xenomai.org

Huan Fang wrote:
> Hello. I am writing a driver using RTDM. Just for testing, I have a
> rt kernel thread waiting for event signal sent from nrt_ioctl. After
> the thread is activated, it calls rtdm_task_busy_sleep(100000); then 
> rtdm_task_sleep(100000); When the RT thread is really sleeping, the
> nrt_ioctl resumes and sleeps via wait_event_interruptible_timeout(2
> jiffiles).
> 
> Normally, RT thread wakes up after 100us. But the thread seems to
> hang after 20-30 such loops and never wake up. When I kill the
> process. I saw that wait_event_interruptible_timeout returns a -512.
>  The worse thing is I saw kernel panic sometimes during such context
> switches.

Hi,

If you are using wait_event_interruptible_timeout from the context of a
xenomai thread running in primary mode, it is normal to get kernel
oopses. If you do not do that, then I did not get your explanation, and
I think the best thing to do is to send us a self contained example,
including driver code and user-space code. Something that we can compile
and run to see what you are observing.

Regards.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai-help] RTDM rtdm_task_sleep in kernel not always wakes up
  2010-03-13 12:08 ` Gilles Chanteperdrix
@ 2010-03-16 15:15   ` Huan Fang
  0 siblings, 0 replies; 3+ messages in thread
From: Huan Fang @ 2010-03-16 15:15 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai@xenomai.org

Hello,

The wait_event_interruptible_timeout is running in non real time context of ioctl_nrt part.
I also tried to replace it with an infinite loop like while(condition); then the rt process is never waken up and the nrt process is stuck at the while loop in ioctl.
Is it because the Linux kernel is not fully preemptible even if I already configured the CONFIG_PREEMPT=y (No PREEMPT_RT patch)?

Best Regards,
Huan
________________________________________
From: Gilles Chanteperdrix [gilles.chanteperdrix@xenomai.org]
Sent: 13 March 2010 13:08
To: Huan Fang
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] RTDM rtdm_task_sleep in kernel not always wakes up

Huan Fang wrote:
> Hello. I am writing a driver using RTDM. Just for testing, I have a
> rt kernel thread waiting for event signal sent from nrt_ioctl. After
> the thread is activated, it calls rtdm_task_busy_sleep(100000); then
> rtdm_task_sleep(100000); When the RT thread is really sleeping, the
> nrt_ioctl resumes and sleeps via wait_event_interruptible_timeout(2
> jiffiles).
>
> Normally, RT thread wakes up after 100us. But the thread seems to
> hang after 20-30 such loops and never wake up. When I kill the
> process. I saw that wait_event_interruptible_timeout returns a -512.
>  The worse thing is I saw kernel panic sometimes during such context
> switches.

Hi,

If you are using wait_event_interruptible_timeout from the context of a
xenomai thread running in primary mode, it is normal to get kernel
oopses. If you do not do that, then I did not get your explanation, and
I think the best thing to do is to send us a self contained example,
including driver code and user-space code. Something that we can compile
and run to see what you are observing.

Regards.

--
                                            Gilles.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-16 15:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 18:21 [Xenomai-help] RTDM rtdm_task_sleep in kernel not always wakes up Huan Fang
2010-03-13 12:08 ` Gilles Chanteperdrix
2010-03-16 15:15   ` Huan Fang

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.