Broken IRQ code (was Re: spinlocks() are severely broken in 2.2.X and 2.4.X for modules)

From: Russell King (rmk@arm.linux.org.uk)
Date: Sun Jul 02 2000 - 02:58:43 EST


Gérard Roudier writes:
> On Fri, 30 Jun 2000, Jeff V. Merkey wrote:
> [...]
> > void NWLockLRU(LRU_HANDLE *lru_handle)
> > {
> > spinlock_irqsave(&lru_handle->LRU_spinlock, lru_handle->LRU_flags);
>
> Does not seem to me safe to store irq flags in shared data structures.
> SMP .vs. UP does not seem to matter here.

Also, I am aware that there are two archiectures which Linux supports which
changing the IRQ/FIQ state, and then returning from the function that
changed them does not have the expected results.

What I mean is you will get behaviour such as:

        void my_own_broken_disable_irqs(void)
        {
                /* interrupts are enabled */
                cli();
                /* interrupts are disabled */
        }

        void foo(void)
        {
                /* interrupts are enabled */
                my_own_broken_disable_irqs();
                /* interrupts are still enabled */
        }

I obviously can only talk about one (in fact, one obsolete class of one CPU)
This is because these CPUs restore the state of the program flags on returning
from function calls.

I think the other CPU was something like mips or sparc?
   _____
  |_____| ------------------------------------------------- ---+---+-
  | | Russell King rmk@arm.linux.org.uk --- ---
  | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
  | +-+-+ --- -+-
  / | THE developer of ARM Linux |+| /|\
 / | | | --- |
    +-+-+ ------------------------------------------------- /\\\ |

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



This archive was generated by hypermail 2b29 : Fri Jul 07 2000 - 21:00:10 EST