From: Dmitry Torokhov <dtor_core@ameritech.net>
To: johnpol@2ka.mipt.ru
Cc: sensors@stimpy.netroedge.com, LKML <linux-kernel@vger.kernel.org>,
Greg KH <gregkh@suse.de>
Subject: Re: [RFC/PATCH 0/22] W1: sysfs, lifetime and other fixes
Date: Tue, 26 Apr 2005 01:50:00 -0500 [thread overview]
Message-ID: <200504260150.00948.dtor_core@ameritech.net> (raw)
In-Reply-To: <1114497816.8527.66.camel@uganda>
On Tuesday 26 April 2005 01:43, Evgeniy Polyakov wrote:
> On Mon, 2005-04-25 at 15:22 -0500, Dmitry Torokhov wrote:
> > On 4/25/05, Evgeniy Polyakov <johnpol@2ka.mipt.ru> wrote:
> > > While thinking about locking schema
> > > with respect to sysfs files I recalled,
> > > why I implemented such a logic -
> > > now one can _always_ remove _any_ module
> > > [corresponding object is removed from accessible
> > > pathes and waits untill all exsting users are gone],
> > > which is very good - I really like it in networking model,
> > > while with whole device driver model
> > > if we will read device's file very quickly
> > > in several threads we may end up not unloading it at all.
> >
> > I am sorrry, that is complete bull*. sysfs also allows removing
> > modules at an arbitrary time (and usually without annoying "waiting
> > for refcount" at that)... You just seem to not understand how driver
> > code works, thus the need of inventing your own schema.
>
> Ok, let's try again - now with explanation,
> since it looks like you did not even try to understand what I said.
> If you will remove objects from ->remove() callback
> you may end up with rmmod being stuck.
> Explanation: each read still gets reference counter,
> while in rmmod path there is a wait until it is zero.
> If there are too many simultaneous reads - even
> if each will put reference counter at the end, we still can have
> non zero refcnt each time we check it in rmmod path.
> That is why object must be removed from accessible pathes
> first, and only freed in ->remove() callback.
Please try to read the code. device_unregister and kobject_unregister
do not require caller to wait for the last reference to drop, they rely
on availability of release method to clean up the object when last user
is gone. driver_unregister is blocking (like your family code) but
teardown takes no time. If driver is in use (attributes are open) then
module refcount is non-zero and instead of (possibly endless) "waiting for
refcount to drop" message you will get nice -EBUSY.
If you program so that you wait in module_exit for object release - you
get what you deserve.
> > BTW, I am looking at the connector code ATM and I am just amazed at
> > all wied refounting stuff that is going on there. what a single
> > actomic_dec_and_test() call without checkng reurn vaue is supposed to
> > do again?
>
> It has explicit barrieres, which guarantees that
> there will not be atomic operation vs. non atomic
> reordering.
And you can't use explicit barriers - why exactly?
--
Dmitry
next prev parent reply other threads:[~2005-04-26 6:50 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-21 7:07 [RFC/PATCH 0/22] W1: sysfs, lifetime and other fixes Dmitry Torokhov
2005-04-21 7:08 ` [RFC/PATCH 1/22] W1: whitespace fixes Dmitry Torokhov
2005-04-21 7:08 ` [RFC/PATCH 2/22] W1: formatting fixes Dmitry Torokhov
2005-04-21 7:09 ` [RFC/PATCH 3/22] W1: use attribute group for master's attributes Dmitry Torokhov
2005-04-21 7:10 ` [RFC/PATCH 4/22] W1: use attribute group for slave's attributes Dmitry Torokhov
2005-04-21 7:11 ` [RFC/PATCH 5/22] W1: list handling cleanup Dmitry Torokhov
2005-04-21 7:13 ` [RFC/PATCH 6/22] W1: drop owner field from master and slave structures Dmitry Torokhov
2005-04-21 7:13 ` [RFC/PATCH 7/22] W1: bus operations cleanup Dmitry Torokhov
2005-04-21 7:15 ` [RFC/PATCH 8/22] W1: merge master code into one file Dmitry Torokhov
2005-04-21 7:16 ` [RFC/PATCH 9/22] W1: drop custom hotplug over netlink notification Dmitry Torokhov
2005-04-21 7:17 ` [RFC/PATCH 10/22] W1: drop main control thread Dmitry Torokhov
2005-04-21 7:18 ` [RFC/PATCH 11/22] W1: move w1_search to the rest of IO code Dmitry Torokhov
2005-04-21 7:19 ` [RFC/PATCH 12/22] W1: drop unneeded master attributes Dmitry Torokhov
2005-04-21 7:20 ` [RFC/PATCH 13/22] W1: cleanup master attributes handling Dmitry Torokhov
2005-04-21 7:21 ` [RFC/PATCH 14/22] W1: rename timeout to scan_interval Dmitry Torokhov
2005-04-21 7:22 ` [RFC/PATCH 15/22] W1: add slave_ttl master attribute Dmitry Torokhov
2005-04-21 7:23 ` [RFC/PATCH 16/22] W1: cleanup masters refcounting & more Dmitry Torokhov
2005-04-21 7:23 ` [RFC/PATCH 17/22] W1: cleanup slave " Dmitry Torokhov
2005-04-21 7:25 ` [RFC/PATCH 18/22] W1: cleanup family implementation Dmitry Torokhov
2005-04-21 7:26 ` [RFC/PATCH 19/22] W1: convert families to be proper sysfs rivers Dmitry Torokhov
2005-04-21 7:27 ` [RFC/PATCH 20/22] W1: add w1_device_id/MODULE_DEVICE_TABLE for automatic driver loading Dmitry Torokhov
2005-04-21 7:36 ` [RFC/PATCH 21/22] W1: implement standard hotplug handler Dmitry Torokhov
2005-04-21 7:38 ` [RFC/PATCH 22/22] W1: expose module parameters in sysfs Dmitry Torokhov
2005-04-21 13:18 ` [RFC/PATCH 0/22] W1: sysfs, lifetime and other fixes Evgeniy Polyakov
2005-04-21 14:31 ` Dmitry Torokhov
2005-04-25 9:08 ` Evgeniy Polyakov
2005-04-25 16:32 ` Dmitry Torokhov
2005-04-25 19:26 ` Evgeniy Polyakov
2005-04-25 21:32 ` Dmitry Torokhov
2005-04-26 7:19 ` Evgeniy Polyakov
2005-04-25 20:15 ` Evgeniy Polyakov
2005-04-25 20:22 ` Dmitry Torokhov
2005-04-26 6:43 ` Evgeniy Polyakov
2005-04-26 6:50 ` Dmitry Torokhov [this message]
2005-04-26 7:06 ` Evgeniy Polyakov
2005-04-26 7:16 ` Dmitry Torokhov
2005-04-26 7:35 ` Evgeniy Polyakov
2005-04-26 7:00 ` Greg KH
2005-04-26 7:17 ` Evgeniy Polyakov
2005-04-26 6:58 ` Greg KH
2005-04-21 16:09 ` Dmitry Torokhov
2005-04-25 9:11 ` Evgeniy Polyakov
2005-04-25 16:36 ` Dmitry Torokhov
2005-04-25 19:32 ` Evgeniy Polyakov
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=200504260150.00948.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=gregkh@suse.de \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=sensors@stimpy.netroedge.com \
/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