netdev
[Top] [All Lists]

Re: modular net drivers, take 2

To: Andrew Morton <andrewm@xxxxxxxxxx>
Subject: Re: modular net drivers, take 2
From: Keith Owens <kaos@xxxxxxxxxx>
Date: Wed, 21 Jun 2000 13:44:00 +1000
Cc: "netdev@xxxxxxxxxxx" <netdev@xxxxxxxxxxx>
In-reply-to: Your message of "Wed, 21 Jun 2000 02:37:58 GMT." <39502A86.6C8C6FC2@xxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
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
>alone.
>
>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
>proceed.

       CPU 0                              CPU 1
rmmod
use_count == 0, OK to remove
Grab big kernel lock.
Wait for other cpus to spin.
                                  Enter open().
                                  spin.
sys_delete_module runs.
module_exit() sleeps, drops lock.
                                  open() continues, enters module.
                                  MOD_INC_USE_COUNT
                                  sleep in module open code, drop lock.
module_exit() wakes and continues.
Code is removed.
                                  module open code wakes and continues.
                                  Oops.

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.


<Prev in Thread] Current Thread [Next in Thread>