Received: by oss.sgi.com id ; Mon, 19 Jun 2000 17:59:17 -0700 Received: from smtprch2.nortelnetworks.com ([192.135.215.15]:59108 "EHLO smtprch2.nortel.com") by oss.sgi.com with ESMTP id ; Mon, 19 Jun 2000 17:58:50 -0700 Received: from zrchb213.us.nortel.com (actually zrchb213) by smtprch2.nortel.com; Mon, 19 Jun 2000 19:55:25 -0500 Received: from zctwb003.asiapac.nortel.com ([47.152.32.111]) by zrchb213.us.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id NH9NYPPX; Mon, 19 Jun 2000 19:58:29 -0500 Received: from pwold011.asiapac.nortel.com ([47.181.193.45]) by zctwb003.asiapac.nortel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id NCLF8BRB; Tue, 20 Jun 2000 10:58:31 +1000 Received: from uow.edu.au (IDENT:akpm@localhost [127.0.0.1]) by pwold011.asiapac.nortel.com (8.9.3/8.9.3) with ESMTP id KAA14759; Tue, 20 Jun 2000 10:58:17 +1000 Message-ID: <394EC1A8.46941D36@uow.edu.au> Date: Tue, 20 Jun 2000 00:58:16 +0000 X-Sybari-Space: 00000000 00000000 00000000 From: Andrew Morton X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.4.0-test1-ac10 i686) X-Accept-Language: en MIME-Version: 1.0 To: Donald Becker CC: "netdev@oss.sgi.com" Subject: Re: modular net drivers References: <394E2616.C25F8376@uow.edu.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Orig: Sender: owner-netdev@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;netdev-outgoing Donald Becker wrote: > Hello, Donald. > On Mon, 19 Jun 2000, Andrew Morton wrote: > > > As you may have noticed, Al Viro is running around the kernel getting > > rid of MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT. His long-term plan > > is to remove MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT completely. > > I'm looking into the changes required for the net drivers. > > Hmmm, this is curious. > Should not the "feature freeze" phase come well after the "interface freeze"? > This is pretty obviously an interface change. Yes, I find it amusing that when something stable is imminent, people start madly running around cleaning up stuff that should have been done months/years ago. Oh well. Better than not doing it. Linus' attitude is that interface changes should go into 2.4 even if they're large/risky, because he seeks to minimise the differences between 2.4 and 2.5, so problem fixes can be fed between the two. This is unconventional and useful. > > - All 2.4-only netdrivers can have all their MOD_DEC and MOD_INC calls > > removed. All that twisty logic to keep track of the counts can be > > tossed. A single > > > > SET_NETDEVICE_OWNER(dev); > > "Twisty logic"? Most of the drivers have straight-forward use counts. They used to, but it was risky. The problem with a simple MOD_INC_USE_COUNT at the end of open() is that the preceding kmalloc()'s can sleep while the module refcount is zero, exposing an opportunity for the module to be unloaded while running. So the "fix" was to move the MOD_INC_USE_COUNT to the top of open() and to do complementary MOD_DEC calls wherever the open() method takes an error path. It's pretty stinky and still doesn't stop the races. > How is this new method any simpler? If anything, it seems to be more > complex without any obvious benefit. Well, even if it wasn't for the race-avoidance issue, it's always nice to suck out duplicated code and put it in one place.