Re: Wake_up_process() in interrupt handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 31, 2002 at 06:48:05AM -0800, kernel_learner wrote:
> Rule of thumb:
> 
> Nothing is going to stop u from doing anything in the
> ISR. There are no 'programming' restrictions as
> such..but to acheive the right goals..:

Oh yes. There is something. There are things, that will inevitably lead
to a crash sooner or later. That is especially everything, that can
eventually call down to schedule(). Simply because the ISR is running
with interrupts disabled and also because current is not set to anything
sane. Bottom-halves have interrupts enabled (that's why they are used
after all), so you can do longer operations there, but you still can't
sleep as current is still not anything sane. 

> Don't sleep_on or use an API that can cause unbounded
> delays (unpredictably).. You want to do as much as
> possible in the ISR and also not block for too long..

That's about right. But the true reason is really schedule() and
anything else that uses current.

You also have to be careful with spinlocks (let alone semaphores - they
call schedule()), because when the interrupt occurs while a lock is
locked and wants to lock it, it will spin forever - deadlock. So the
interrupt must not happen - that's what spin_lock_irqsave is for.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux