On Wed, 21 Jun 2000 02:37:58 +0000,
Andrew Morton <andrewm@xxxxxxxxxx> wrote:
>Module unload is a very rare occurence, so let's penalise that and that
>We grab the ENTIRE machine within sys_delete_module.
>Like, grab the big kernel lock, then wait until ALL other CPUs are
>spinning on the kernel lock, and then allow sys_delete_module to
CPU 0 CPU 1
use_count == 0, OK to remove
Grab big kernel lock.
Wait for other cpus to spin.
module_exit() sleeps, drops lock.
open() continues, enters module.
sleep in module open code, drop lock.
module_exit() wakes and continues.
Code is removed.
module open code wakes and continues.
Anything sleeping loses the lock. Any sleep in module open code primes
the race, if the module_exit code also sleeps the race is triggered.