Re: [PATCH] 2.4.18 raid1 - fix SMP locking/interrupt errors, fix

Paul Clements (
Mon, 25 Mar 2002 13:33:02 -0500 (EST)

On Sun, 24 Mar 2002, Andrew Morton wrote:

> However a bare spin_unlock_irq() in a function means that
> callers which wish to keep interrupts disabled are subtly
> subverted. We've had bugs from this before.

Yes, that was precisely what was happening in raid1. There were
"nested" spin_lock_irq() calls.

> So the irqrestore functions are much more robust. I believe
> that they should be the default choice. The non-restore
> versions should be viewed as a micro-optimised version,
> to be used with caution. The additional expense of the save/restore
> is quite tiny - 20-30 cycles, perhaps.

I was wondering about the performance of these. I was reluctant
to change all occurrences of spin_lock_irq() to the save/restore
versions, even though that seemed like the safest thing to do, so
I had to analyze every code path where spin_locks were involved
to see which ones absolutely needed to change...very tedious.

Thanks for the explanations.


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at