Re: Signalling from kernel

Mark Hemment (markhe@nextd.demon.co.uk)
Tue, 15 Apr 1997 12:06:05 +0100 (BST)


Hi Claus,

On Tue, 15 Apr 1997, Claus Schroeter wrote:
> I think implementing a kernel->user channel would be a really good thing.
> (Lets think about it :-) )

I've just remembered, there is 'something' available, the LiS (Linux
STREAMS project). I can't find my reference to it, but I believe they now
have it working.
OK, I've heard all the inefficient stories about STREAMS, but it can be
used for a kernel->user channel (this is how "syslog" is implemented on
several UNIX OSes).

> Yes I know this method from the realtime clock driver, is this interrupt
> safe ?

Yes. All you do is call wake_up_process() from the interrupt routine of
your 'real' driver to stop the 'info' driver from blocking (sleeping).

It sounds to me that you are worried about latencies (the time between the
event occuring, and your user-space task being scheduled).
While it is not strictly safe, you can increase the scheduling pri of the
waiting task from your interrupt-driver (just stick a ptr to it in a
global from the 'info') and set the "need_resched" variable. If you
driver has been installed to use 'slow' interrupts, the kernel can be
force to try a re-schedule (I think).
Infact, alot of kernels allow a blocking task to specify a priority to be
used once it has woken up. eg. sleep_on(&wchan, INODE_PRI);

Regards,

markhe

------------------------------------------------------------------
Mark Hemment, Unix/C Software Engineer (Contractor)
markhe@nextd.demon.co.uk http://www.nextd.demon.co.uk/
"Success has many fathers, failure is a B**TARD!" - anon
------------------------------------------------------------------