Re: PROBLEM SOLVED: 2.4.x SPINLOCKS behave differently then 2.2.x

Linus Torvalds (torvalds@transmeta.com)
Wed, 18 Jul 2001 17:59:49 -0700 (PDT)


On Wed, 18 Jul 2001, Alex Ivchenko wrote:
>
> Our hardware requires that once you start talking to firmware you cannot let
> anybody to interrupt you.
> Thus, I lazily put in all "magic" handlers (read, write, ioctl):
>
> my_ioctl() {
> ... do entry stuff
> _fw_spinlock // = spin_lock_irqsave(...);
>
> .. do my stuff (nobody could interrupt me)
>
> _fw_spinunlock // = spin_lock_irqrestore(...);
> }

This should be ok, but ONLY if you don't sleep or do anything that could
sleep (or are otherwise bad) inside the spinlocks. The things you must not
have inside spinlocks are

- global cli/sti
- scheduling calls (and things that call them - sleep etc)
- user memory access (get_user/put_user etc)

But a wake_up() should be fine.

Linus

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