[uClinux-dev] Re: soft_irq()

Miles Bader miles at lsi.nec.co.jp
Mon Mar 24 04:36:32 EST 2003

John Williams <jwilliams at itee.uq.edu.au> writes:
> Can anyone give me the "25 words or less" on the kernel soft_irq 
> mechanism?
> if(softirq_pending(cpu))
>    do_softirq();
> For some reason my kernel is taking this branch, even though the only 
> interrupt enabled is the timer, and I can't see anything it does that 
> could cause softirq_pending() to be true.

I'm not entirely cognizant of the details, but soft irqs are not really
interrupts, they're basically a way you can schedule something to happen
`pretty soon, but not necessarily immediately.'  I think they're usually
used to handle tasks in device drivers &c that aren't urgent enough to
immediately need servicing in a real interrupt handler, which allows
keeping the actual interrupt handler small and fast.  They're also run
with interrupts enabled (and never after a nested interrupt), so they
don't block real interrupts.

So (as far as I understand things -- salt liberally!), a typical device
interrupt handler might would twiddle a few bits, update some critical
pointers, schedule a softirq to do anything more time-consuming, and
then return.  The soft-irq it scheduled would then get run just before
returning from the outermost interrupt level.

"Most attacks seem to take place at night, during a rainstorm, uphill,
 where four map sheets join."   -- Anon. British Officer in WW I

More information about the uClinux-dev mailing list