Received: by oss.sgi.com id ; Tue, 20 Jun 2000 20:46:53 -0700 Received: from deliverator.sgi.com ([204.94.214.10]:9052 "EHLO deliverator.sgi.com") by oss.sgi.com with ESMTP id ; Tue, 20 Jun 2000 20:46:36 -0700 Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by deliverator.sgi.com (980309.SGI.8.8.8-aspam-6.2/980310.SGI-aspam) via SMTP id UAA28653 for ; Tue, 20 Jun 2000 20:41:37 -0700 (PDT) mail_from (kaos@kao2.melbourne.sgi.com) Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id NAA02579; Wed, 21 Jun 2000 13:44:00 +1000 X-Mailer: exmh version 2.1.1 10/15/1999 From: Keith Owens To: Andrew Morton cc: "netdev@oss.sgi.com" Subject: Re: modular net drivers, take 2 In-reply-to: Your message of "Wed, 21 Jun 2000 02:37:58 GMT." <39502A86.6C8C6FC2@uow.edu.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 21 Jun 2000 13:44:00 +1000 Message-ID: <12333.961559040@kao2.melbourne.sgi.com> Sender: owner-netdev@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;netdev-outgoing On Wed, 21 Jun 2000 02:37:58 +0000, Andrew Morton 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.