Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Blocking in interrupt handler.

    I have situation where I have to wait in interrupt handler till I compele other work/wait till some flag set.

    i.e want to wait (not return from IH) and block inside interrupt handler, dont want to loop as it cause lot of cpu usage.

    let me know if we have any signaling or any mechanism.

    Thanks in Advance!!!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Bad! Bad!! Bad!!! Bad!!!! Bad!!!!!

    NEVER wait in an interrupt handler! Set some state flag and let your driver or kernel thread wait until the event you need happens, or a timeout occurs. What you propose is a perfect way to cause a system to totally hang, or go into some sort of LaLa Land...

    So, this brings us to the real question - what is it that you are trying to accomplish?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3

    You can use workqueues, and schdule a work from interrupt handler and them in workqueue handler perform the required logic. However, if you really want to loop inside in the interrupt handle, I will suggest you change preempt mode to Realtime (CONFIG_RT), this will make the interrupt handlers as threads, then you can block inside them.
    Last edited by oz; 11-22-2011 at 12:23 PM. Reason: spam removal

  4. $spacer_open
  5. #4
    Thanks Deepak ,, configuring to realtime will work for me..

  6. #5
    Welcome, but what is the requirement to block inside an interrupt handler? If you want to some do exclusive work, then why not protect non interrupt code with spin_lock_irqsave/spin_unlock_irqrestore. If not, then I think you need to modify your design to avoid blocking inside an interrupt handler.

    Quote Originally Posted by dassudheer View Post
    Thanks Deepak ,, configuring to realtime will work for me..
    Last edited by oz; 11-26-2011 at 12:34 PM. Reason: spam removal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts