Re: Preemptive kernel support?

Steve Schefter <[email protected]>
Newsgroups gmane.linux.kernel.streams
Organization The Software Group Limited
Message-ID <[email protected]>
Hi Stefano.

> I would like to use LiS with a MontaVista Linux Carrier Grade Edition 
> (CGE) kernel.
> I have one question: how does LiS behave with a preemptive real-time 
> kernel? Does it support preemtion?
> Has anyone tried to use LiS with MontaVista kernel before?

We used to use Timesys Linux which is also preemtive and had troubles
which were caused by the preemption.  However, that was with an old
LiS (this problem dated back to Oct 2002).  Dave Grothe made changes to
LiS to solve the problem, so you are likely fine.  However, before
this was available, we stopped using Timesys and therefore couldn't
confirm the changes.

I've included a description of the problem we encountered below.  The
current LiS routines will be different from what I show below, but you
might want to see what you think of the changes and it might give you
a place to start if you do run into troubles.

Regards,
	Steve

------------------------------------------------------------------------
Steve Schefter                               phone: +1 705 725 9999 x26
The Software Group Limited		       fax: +1 705 725 9666
642 Welham Road, 			     email: [email protected]
Barrie, Ontario CANADA  L4N 9A1 	       Web: www.wanware.com





The pkt rsrv routine (called by the streams runq thread)
get an RR so it enables the stream head write q.   This
causes the LiS routine wake_up_all_wwrite to run for that
stream head.

wake_up_all_wwrite does (simplified):
     while (sd_wrcnt > 0)
     {
         sd_wrcnt--;
         lis_up(sd_write);
     }

Normally, the process waiting on sd_write will run at some
later time.  It is:

lis_sleep_on_wwrite()
     sd_wrcnt++;
     lis_runqueues();
     lis_down(sd_wwrite);

The trouble comes when the scheduler is preemptive, meaning
that the lis_up causes lis_sleep_on_wwrite() to run immediately.
First, since it increments sd_wrcnt, the while loop in
wake_up_all_wwrite() will go on forever.  Second, lis_runqueues(),
which would normally run other useful queues (like the mpc read
service routine to pass up more RRs).  Doesn't do anything.
That's beause we started this whole process in pkt rsrv, and
more importantly, the streams runq thread.  Since the processing
of queues is already being done, lis_runqueues doesn't run the
other queues.

This would normally be an infinite loop, but the scheduler sets
aside kernel processes eventually if they don't call schedule()
themselves.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.