LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   getting notified in user-space on interrupts (https://www.linuxquestions.org/questions/linux-general-1/getting-notified-in-user-space-on-interrupts-816692/)

mylinuxforums 06-27-2010 07:03 PM

getting notified in user-space on interrupts
 
Hi,
I hope this is the right place to post to because I haven't found any other related forums.
I'm working on an AMD opteron running Linux 2.6.28.6
I want to preload a hardware performance counter (register) with a value to have it overflow after a number of a specific event counts. As I understand, when the counter in the register overflows, an interrupt will be generated and handled by the appropriate interrupt handler. How can my user-level application get notified whenever the interrupt occurs? I want to obtain information on the instruction that caused the overflow. Is this possible?
I think this is different than responding to signals with sigaction(). I never dealt with interrupts before, so any help is appreciated.

Thanks

irmin 06-28-2010 03:13 PM

Hi,

as far as I know there is no syscall that allows you to handle IRQs or any other interrupts from user space. The only possibility to catch any interrupt and pass them to user space is to build your own kernel module that offers this functionality. I thing this kind of control should not be passed to userspace since you can totally mess up the peripheral hardware (like not sending ACK to the PIC or similar) blocking all interrupts of lower priority. Also interrupts are executed at ring 0 that provides your program total control over the CPU meaning that your program can change memory permissions at will during the interrupt. So the best thing will be to write a kernel module that notifies your program when the selected interrupt occurs.


All times are GMT -5. The time now is 04:39 PM.