mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Alan Stern <stern@rowland.harvard.edu>, Greg KH <greg@kroah.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Tejun Heo <htejun@gmail.com>
Subject: Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.
Date: Tue, 17 Apr 2007 09:16:24 +0200	[thread overview]
Message-ID: <20070417091624.63436fc3@gondolin.boeblingen.de.ibm.com> (raw)
In-Reply-To: <1176778391.14322.273.camel@localhost.localdomain>

On Tue, 17 Apr 2007 12:53:10 +1000,
Rusty Russell <rusty@rustcorp.com.au> wrote:

> On Mon, 2007-04-16 at 15:53 -0400, Alan Stern wrote:
> > The fundamental rule is that whenever you hand out a pointer to a routine
> > living in a module, the receiver has to increment the module's refcount.  
> > But the driver core violates this rule all over the place.
> 
> Hi Alan,
> 
> 	Your rule is overly simplistic, unfortunately.  You have two choices:
> take a reference count, *or* ensure that the reference will go away when
> the module's cleanup routine is called.  Network drivers are a classic
> example of the latter.

Hm, but that's exactly the problem we face here. There is no race-free
way (at least, nobody could think about one yet) to make sure all
references are freed at exit time and simultaneously to make sure that
the release functions have finished before the module has been deleted.

> 
> 	Note that you cannot do both: if the cleanup routine calls something
> which drops a reference count, it implies that the cleanup routine needs
> to be called with non-zero reference count, and it won't be (ignoring
> --force).

That's where that second reference count (the kref in the embedded
kobject in the module) comes into play, that doesn't prevent rmmod from
being run.

  reply	other threads:[~2007-04-17  7:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-16 17:36 Cornelia Huck
2007-04-16 18:05 ` Greg KH
2007-04-16 19:53   ` Alan Stern
2007-04-17  2:53     ` Rusty Russell
2007-04-17  7:16       ` Cornelia Huck [this message]
2007-04-17 16:08         ` Alan Stern
2007-04-17 23:55           ` Rusty Russell
2007-04-18 15:20             ` Alan Stern
2007-04-19  0:46               ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070417091624.63436fc3@gondolin.boeblingen.de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=greg@kroah.com \
    --cc=htejun@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®