in_irq()

Madhavi (madhavis@sasken.com)
Tue, 3 Dec 2002 11:35:23 +0530 (IST)


Hi

I am using a UP system with CONFIG_SMP=y in .config with linux 2.4.19
kernel.

I have this piece of code:

spin_lock_irqsave(&some_lock, flags);
in_irq();
spin_unlock_irqrestore(&some_lock, flags);

I have read somewhere (I think its given in the Unreliable Guide to
kernel locking) that in_irq() returns true when the interrupts
are blocked. So, I was expecting in_irq() to return true here. But, it is
returning 0 here.

I have gone through the code and it seems that the __local_irq_count is
getting incremented only in irq_enter(). So, the behavior I am getting
seems to be correct.

## Could someone tell me which is the correct behavior of in_irq()?

## I have one more doubt. If I have a thread in which I do
spin_lock_irqsave(&some_lock, flags), can I expect the main kernel thread
also not to service any interrupts? I am getting replies to ping packets
when the thread is doing spin_lock_irqsave(), which means that all
hardware interrupts are not blocked. How can I block all hardware
interrupts?

Thanks in advance.

regards
Madhavi.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/