Re: [patch] 2.3.99-pre6-3 VM fixed

From: Linus Torvalds (torvalds@transmeta.com)
Date: Thu Apr 27 2000 - 16:24:18 EST


On Thu, 27 Apr 2000, Kanoj Sarcar wrote:
>
> I really need to learn the locking rules for the kernel. As far as
> I can see, lock_kernel is a spinning monitor, so any intr code should
> be able to grab lock_kernel.

No.

Interrupts must NOT grab the kernel lock.

It's not because of the regular dead-lock concerns (an interrupt could
just increment the lock counter), but because of more subtle issues: the
counter maintenance is not atomic, and should not be atomic. For example,
during re-schedules we drop the kernel lock flag ("kernel_flag", but we
still maintain the lock counter), so an interrupt that came in at that
time would _think_ that it got the kernel lock (because the counter is
non-zero), but it really doesn't get it.

                Linus

-
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 : Sun Apr 30 2000 - 21:00:13 EST