Re: [PATCH] irq_enter/irq_exit consolidation

From: Russell King
Date: Sun Sep 12 2004 - 06:59:38 EST


On Sun, Sep 12, 2004 at 01:25:54PM +0200, Christoph Hellwig wrote:
> Move irq_enter/irq_exit from <asm/hardirq.h> to <linux/hardirq.h>.
> There some fishy things going on with the do_softirq invokation on
> arm, arm26 and s390.
>
> arm calls __do_softirq directly without local irq disabling which looks
> like a real bug to me.

The ARM interrupt subsystem guarantees that local IRQs are disabled
prior to irq_exit() being invoked. This is a must for reasons other
than softirq semantics - hardware IRQ controllers may require a
nonatomic read-modify-write to update their IRQ masking state.

This guarantee must also exist on every other architecture, otherwise:

> ===== include/linux/hardirq.h 1.1 vs edited =====
> --- 1.1/include/linux/hardirq.h 2004-09-08 08:32:57 +02:00
> +++ edited/include/linux/hardirq.h 2004-09-11 21:26:28 +02:00
> +#define irq_exit() \
> +do { \
> + preempt_count() -= IRQ_EXIT_OFFSET; \

would be buggy - it's an inherently non-atomic operation. Not only that
but the behaviour of nested interrupts would change depending on whether
they interrupted before or after preempt count has been updated.

So maybe every other architecture except ARM is buggy? 8)

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/