I am writing some customized application and allowed to change interrupt handler code in the linux kernel.
I am having a user thread which is waiting for an interrupt to happen. If that interrupt happens then the first thing I want to do is to execute that user thread.
Is there any way to make it work.
Thanks
Create a character device (that's what the kernel does, handles devices). Have the user thread read from that device. It will hang as there are no characters to read.
When the interrupt happens, output a character (or some meaningful message) to that device from your module. The thread will wake up, read the message and continue.
Give the handler thread some nice priority so that it wakes up early.
Alternatively, you may just have the thread waiting on
select
orsleep
and send it a signal (kernel functionkill_proc_info
) and the thread will wake up. Make sure the thread handles the signal.Instead of doing an overkill with making a character driver, making a sysfs entry would have been sufficient. You can do any blocking call like, read / select / poll on that sysfs entry and feed to it from your interrupt handler.
Interesting problem to solve for you is
etc.