From: Rusty Russell <rusty@rustcorp.com.au>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
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: Thu, 19 Apr 2007 10:46:41 +1000 [thread overview]
Message-ID: <1176943601.5940.17.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0704181110510.12246-100000@iolanthe.rowland.org>
On Wed, 2007-04-18 at 11:20 -0400, Alan Stern wrote:
> On Wed, 18 Apr 2007, Rusty Russell wrote:
>
> > Hi Alan,
> >
> > Your assertion is correct. I haven't studied the driver core, so I
> > might be off-base here, but you'll note that if the module references
> > the core kmalloc'ed object rather than the other way around it can be
> > done safely. The core can also reference the module, but it must be
> > able to live without it once it's gone (eg. by returning -ENOENT).
>
> "Live without it once it's gone..." Do you mean once the object is gone
> or once the module is gone? The core in general has no way to know when
> the module is gone; all it knows about is the object. The trouble arises
> when the module is gone (whether the core knows it or not) but the object
> is still present.
Hi Alan,
I meant that the module is gone: it has told the object (via
unregister_xxx) that it's gone.
> > A really poor example is below:
...
> The example is fine as far as it goes, but it assumes that all
> interactions with the underlying r->foo object can be done under a
> spinlock. Of course this isn't true in general.
There are certainly other ways of doing it, such as a mutex, a refcnt &
completion (for function pointers), or disabling preemption across the
access and using stop_machine(). Of course, these add complexity.
This is the reason that I've always disliked module removal. We have a
lot of code to deal with it and it has awkward semantics (unless --wait
is used). OTOH, I'm not a fan of the network approach, either: I feel
that bringing up an interface should bump the refcnt of the module which
implements that interface. Currently taking out e1000 will just kill my
eth0.
Cheers,
Rusty.
>
> Alan Stern
prev parent reply other threads:[~2007-04-19 0:47 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
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 [this message]
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=1176943601.5940.17.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=cornelia.huck@de.ibm.com \
--cc=greg@kroah.com \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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
Powered by JetHome