[uClinux-dev] Re: question about Interrupt handler

gerg gerg at snapgear.com
Fri Nov 23 10:09:57 EST 2001


Hi Vladimir,

Vladimir Vorobyov wrote:
> Continuing Interrupt handlers topic I want to ask some questions:
> 
> 1) I know that I can't transfer data to/from user space from interrupt
> handler and the best way to do it is to wake_up another part of driver
> (for example read function) and let it to perform transferring data from
> FIFO-buffer
> to user space. But 'woken_up' process can strart executing only after next
> timer tick (is it correct ?),

No, not correct.

The code returning from an interrupt can cause a reschedule of tasks.
This can only occur if returning to user mode (in other words an
application was running). A schedule() call may cause your reading
app to run, it may not. Depends on what is running already, and
their relative priorities.

But the bottom line is that an interrupt can cause a task switch.


> in other words after <=10msec. For my task I
> have to
> read large amount of data from FIFO buffer rather fast and 10msec delay
> will dramatically decrease transfer speed. Could you give me an advise how
> to solve this problem ?

You have to allow for reasonably large delays from the interrupt to when
you app runs. Normal Linux/uClinux gives you no guarantees. If this is
just read data why cannot the driver just keep buffering lots of data?


> 2) On the other hand, I work on the rocessor without MMU (MCF5272) and
> transferring data to/from user space from interrupt handler works properly,
> but
> is it correct to do it (write to user space directly)?

For sufficiently fuzzy values of correct :-)

Fundamentally it is a bad thing to do. What if the app dies for some
reason?  The interrupt could be writing into someone else memory space.
What if one day you want to switch to a VM processor?

Regards
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Wizard        EMAIL:  gerg at snapgear.com
Snapgear                                       PHONE:    +61 7 3279 1822
825 Stanley St,                                  FAX:    +61 7 3279 1820
Woolloogabba, QLD, 4102, Australia               WEB:   www.snapgear.com
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list