Re: [PATCH] irq_enter/irq_exit consolidation

From: David S. Miller
Date: Sun Sep 12 2004 - 18:00:40 EST


On Sun, 12 Sep 2004 12:44:48 +0100
Russell King <rmk+lkml@xxxxxxxxxxxxxxxx> wrote:

> 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.

It works out actually, if we take an interrupt in the middle
of the operation, that's fine because the preemption count
will be precisely the same as we first read it by the time
we return from that interrupt, work out some example cases
as I think that makes it easier to understand.
-
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/