public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] Re: DSR Scheduling Problem
@ 2006-01-14  0:45 Jay Foster
  2006-01-14  2:12 ` Grant Edwards
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Jay Foster @ 2006-01-14  0:45 UTC (permalink / raw)
  To: 'Grant Edwards', ecos-discuss

I still think that FIFO queuing of the DSRs is better than LIFO queuing,
because in the absence of any DSR priority information, the best that can be
done is temporal priority (ie FIFO).  This prevents the case (that I'm
seeing) where a lower priority ISR's DSR preempts a higher priority ISR's
DSR (the priority is lost in the LIFO DSR queue).

I located the kernel versions of the DSR code
(kernel/current/src/intr/intr.cxx), and discovered that there are two
implementations for the DSR handling (CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST,
and CYGIMP_KERNEL_INTERRUPTS_DSRS_TABLE).  The default is to use the LIST,
which is LIFO, but the TABLE implementation is FIFO.  I switched my
configuration to the TABLE implementation, and my code works.  So a second
reason to use FIFO for the DSR LIST implementation is to match the behavior
of the TABLE implementation.

Jay


-----Original Message-----
From: Grant Edwards [mailto:grante@visi.com]
Sent: Friday, January 13, 2006 3:42 PM
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Re: DSR Scheduling Problem


> The test begins by transmitting data, which is looped back to the
receiver.
> It starts out with:
> 	TX ISR -> TX DSR
> 	TX ISR -> TX DSR
> 	...
> 	TX-ISR -> TX DSR
>
> Then I get the RX ISR during the TX DSR, which just schedules
> the RX DSR. However, the RX DSR does not run until 39 ms
> later,

And TX DSRs are running during that entire 38ms?

> resulting in an overrun error.  During this time period, the
> TX ISR and TX DSR continue their work transmitting the
> remaining data.  After all of the data has been sent, THEN the
> RX DSR runs.

It appears you don't have enough CPU time to run all of the
DSRs you want in the alloted time.

> Looking at the code post_dsr() and call_dsr() in
> hal/common/current/src/drv_api.c, I noticed that the DSRs are
> queued at the head of the list, and dequeued also from the
> head of the list.

Yup.  DSRs are scheduled in a LIFO manner. 

> This seems wrong,

It seems to work for everybody else. ;)

> as it can (and apparently does) cause DSRs to get delayed by
> other DSRs that are queued later.  Seems like it would be
> better to queue them on the end of the list and dequeue them
> from the head of the list, so that the DSRs would get run in
> the order in which they are queued.

If the DSRs that you're scheduling require 150% of the
available CPU time, then something's going to fail.  

In your particular case, perhaps it is better to fail in manner
B than in manner A. But, very few eCos users have the option of
failing, so nobody put in much extra effort to make things fail
in manner B rather than in manner A.  

Did that make sense?

-- 
Grant Edwards                   grante             Yow!  I'm having an
                                  at               EMOTIONAL OUTBURST!! But,
                               visi.com            uh, WHY is there a WAFFLE
                                                   in my PAJAMA POCKET??

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 33+ messages in thread
* [ECOS] Re: DSR Scheduling Problem
@ 2006-02-13 14:51 Uwe Kindler
  2006-02-13 15:26 ` Grant Edwards
  0 siblings, 1 reply; 33+ messages in thread
From: Uwe Kindler @ 2006-02-13 14:51 UTC (permalink / raw)
  To: ecos-discuss; +Cc: osv


Hello,

I followed the "DSR scheduling problem" thread with little interest - 
till now. In the last days I improved the eCos CAN driver for FlexCAN 
module of Motorola Coldfire processors and run into trouble with DSR 
scheduling.

The FlexCAN module contains 16 message buffers for reception of CAN 
messages. Each buffer got its own interrupt vector. There is always only 
one message buffer active. That means, if a CAN message arrives, the 
message buffer that received this message will be locked immediatelly 
and the next message buffer will be enabled. So it is possible to read 
data from one buffer while listening for the next message with another 
buffer. In some situations there are bursts of CAN messages on the CAN 
bus - that is absolutely normal and does not mean that bus load is to high.

When a ISR of a message buffer is called, then the next message buffer 
will be enabled by this ISR. Disabling the active buffer and enabling 
the next one is quite fast and guarants that no message will be lost. 
When such a burst of messages arrives it may happen, that a number of 
message buffer ISRs will be called without any chance for a DSR to run. 
This is not really a problem because we have up to 16 message buffers. 
As soon as all messages are received the DSRs will run. And they will 
run in LIFO order. So the interesting thing is, if we receive the CAN 
messages with the following IDs:

0x001, 0x002, 0x003, 0x004, 0x005

our application will  see the following:

0x005, 0x004, 0x003, 0x002, 0x001

So the eCos DSR handling does change the received data here. At the 
moment I did not ran into any trouble with my CAN application and it 
seems not to be a problem but there is still a little bad feeling with 
this behaviour. It was quite tricky to write the CAN driver in a way 
that it works well with list and table implementation of DSR scheduling.

Regards,

Uwe Kindler
Softwareentwicklung

--

cetoni GmbH
Am Wiesenring 6
D-07554 Korbussen

Tel.: +49 (0) 36602 338 28
Fax:  +49 (0) 36602 338 11
uwe.kindler@cetoni.de
www.cetoni.de

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 33+ messages in thread
* [ECOS] DSR Scheduling Problem
@ 2006-01-13 23:01 Jay Foster
  2006-01-13 23:38 ` [ECOS] " Grant Edwards
  0 siblings, 1 reply; 33+ messages in thread
From: Jay Foster @ 2006-01-13 23:01 UTC (permalink / raw)
  To: ecos-discuss

I am experiencing a problem with a serial driver that I'm developing.  It
uses separate RX and TX ISRs and DSRs.  The RX and TX ISRs just schedule the
corresponding DSR to run.

The test begins by transmitting data, which is looped back to the receiver.
It starts out with:
	TX ISR -> TX DSR
	TX ISR -> TX DSR
	...
	TX-ISR -> TX DSR

Then I get the RX ISR during the TX DSR, which just schedules the RX DSR.
However, the RX DSR does not run until 39 ms later, resulting in an overrun
error.  During this time period, the TX ISR and TX DSR continue their work
transmitting the remaining data.  After all of the data has been sent, THEN
the RX DSR runs.

Looking at the code post_dsr() and call_dsr() in
hal/common/current/src/drv_api.c, I noticed that the DSRs are queued at the
head of the list, and dequeued also from the head of the list.  This seems
wrong, as it can (and apparently does) cause DSRs to get delayed by other
DSRs that are queued later.  Seems like it would be better to queue them on
the end of the list and dequeue them from the head of the list, so that the
DSRs would get run in the order in which they are queued.

Jay


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2006-02-16 14:08 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-14  0:45 [ECOS] Re: DSR Scheduling Problem Jay Foster
2006-01-14  2:12 ` Grant Edwards
2006-01-14  3:04   ` Paul D. DeRocco
2006-01-14  3:40     ` Grant Edwards
2006-01-16  8:40       ` Daniel Néri
2006-01-16 10:36         ` Nick Garnett
2006-01-16 11:45           ` [ECOS] Generic 16x5x serial driver use of transmit FIFO (was: DSR Scheduling Problem) Daniel Néri
2006-01-16 12:23             ` Nick Garnett
2006-01-16 15:13         ` [ECOS] Re: DSR Scheduling Problem Grant Edwards
2006-01-17  9:43         ` Andrew Lunn
2006-01-16  8:27   ` Dirk Husemann
2006-01-16 15:11     ` Grant Edwards
2006-02-13 10:41   ` Sergei Organov
2006-02-15  2:06     ` Brett Delmage
2006-02-15  9:57       ` Sergei Organov
2006-02-15 13:23         ` Stefan Sommerfeld
2006-02-15 14:07           ` Sergei Organov
2006-02-15 14:14             ` Stefan Sommerfeld
2006-02-15 15:54           ` Grant Edwards
2006-02-15 15:53         ` Grant Edwards
2006-02-15 18:30           ` Nick Garnett
2006-02-15 19:30             ` Sergei Organov
2006-02-16 10:00               ` Nick Garnett
2006-02-16 13:09                 ` Sergei Organov
2006-02-15 19:36           ` Sergei Organov
2006-02-15 19:57             ` Grant Edwards
2006-02-16 14:08               ` Sergei Organov
2006-02-15 16:34         ` Brett Delmage
2006-01-14  8:23 ` Andrew Lunn
2006-01-16 10:27 ` Nick Garnett
  -- strict thread matches above, loose matches on Subject: below --
2006-02-13 14:51 Uwe Kindler
2006-02-13 15:26 ` Grant Edwards
2006-01-13 23:01 [ECOS] " Jay Foster
2006-01-13 23:38 ` [ECOS] " Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).