linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Jonathan Corbet <corbet@lwn.net>,
	Randy Dunlap <randy.dunlap@oracle.com>
Subject: Re: [RFC] New kobject/kset/ktype documentation and example code
Date: Wed, 28 Nov 2007 18:00:27 +0100	[thread overview]
Message-ID: <1196269227.3242.93.camel@lov.site> (raw)
In-Reply-To: <20071128175108.5a370684@gondolin.boeblingen.de.ibm.com>

On Wed, 2007-11-28 at 17:51 +0100, Cornelia Huck wrote:
> On Wed, 28 Nov 2007 17:36:29 +0100,
> Kay Sievers <kay.sievers@vrfy.org> wrote:
> 
> > 
> > On Wed, 2007-11-28 at 17:12 +0100, Cornelia Huck wrote:
> > > On Wed, 28 Nov 2007 16:57:48 +0100,
> > > Kay Sievers <kay.sievers@vrfy.org> wrote:
> > > 
> > > > On Wed, 2007-11-28 at 16:48 +0100, Cornelia Huck wrote:
> > > > > On Wed, 28 Nov 2007 13:23:02 +0100,
> > > > > Kay Sievers <kay.sievers@vrfy.org> wrote:
> > > > > > On Wed, 2007-11-28 at 12:45 +0100, Cornelia Huck wrote:
> > > > > > > On Tue, 27 Nov 2007 15:02:52 -0800, Greg KH <greg@kroah.com> wrote:
> > > > 
> > > > > > > > The uevent function will be called when the uevent is about to be sent to
> > > > > > > > userspace to allow more environment variables to be added to the uevent.
> > > > > > > 
> > > > > > > It may be helpful to mention which uevents are by default created by
> > > > > > > the kobject core (KOBJ_ADD, KOBJ_DEL, KOBJ_MOVE).
> > > > > > 
> > > > > > I think, we should remove all these default events from the kobject
> > > > > > core. We will not be able to manage the timing issues and "raw" kobject
> > > > > > users should request the events on their own, when they are finished
> > > > > > adding stuff to the kobject. I see currently no way to solve the
> > > > > > "attributes created after the event" problem. The new
> > > > > > *_create_and_register functions do not allow default attributes to be
> > > > > > created, which will just lead to serious trouble when someone wants to
> > > > > > use udev to set defaults and such things. We may just want to require an
> > > > > > explicit call to send the event?
> > > > > 
> > > > > There will always be attributes that will show up later (for example,
> > > > > after a device is activated). Probably the best approach is to keep the
> > > > > default uevents, but have the attribute-adder send another uevent when
> > > > > they are done?
> > > > 
> > > > Uh, that's more an exception where we can't give guarantees because of
> > > > very specific hardware setups, and it would be an additional "change"
> > > > event. There are valid cases for this, but only a _very_ few.
> > > > 
> > > > There is absolutely no reason not to do it right with the "add" event,
> > > > just because we are too lazy to solve it proper the current code. It's
> > > > just so broken by design, what we are doing today. :)
> > > 
> > > I'm worrying a bit about changes that impact the whole code tree in
> > > lots of places. I'd be fine with the device layer doing its uevent
> > > manually in device_add() at the very end, though. (This would allow
> > > drivers to add attributes in their probe function before the uevent,
> > > for example.)
> 
> <Looks at device_add() again: It already throws the uevent manually...>

I think I still remember what I did 2.5 years ago :)
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e57cd73e2e844a3da25cc6b420674c81bbe1b387
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=18c3d5271b472c096adfc856e107c79f6fd30d7d

 
> > The driver core does use the split already in most places, I did that
> > long ago. There are not too many (~20) users of kobject_register(), and
> > it's a pretty straight-forward change to change that to _init, _add,
> > _uevent, and get rid of that totally useless "convenience api".
> > 
> > I think there is no longer any excuse to keep that broken code around,
> > and even require to document that it's broken. The whole purpose of the
> > uevent is userspace consumption, which just doesn't work correctly with
> > the code we offer. The fix is trivial, and should be done now, and we no
> > longer need to fiddle around timing issues, just because we are too
> > lazy.
> > 
> > I propose the removal of _all_ funtions that have *register* in their
> > name, and always require the following sequence:
> >   _init()
> >   _add()
> >   _uevent(_ADD)
> > 
> >   _uevent(_REMOVE)
> >   _del()
> >   _put()
> > 
> > The _create_and_register() functions would become  _create_ and_add()
> > and will need an additional _uevent() call after they populated the
> > object.
> 
> I'm absolutely fine with doing that at the kobject level (after all,
> it's a quite contained change, and the uevent function explicitely
> works on a kobject).
> 
> For the other _register()/_unregister() functions, it's a different
> piece of cake. They are:
> - distributed through lot of different code
> - at a higher level than kobjects, and kobject_uevent() acts on the
> kobject
> - usually encapsulating a sequence that wants to be used by almost all
> callers, and that includes a uevent
> 
> I don't think we want people registering a higher level object and then
> wondering why udev doesn't seem to take notice of it.

Oh, I'm just talking about lib/kobject.c. And the new kobj/kset stuff we
added which is currently in the -mm tree.

It suffers from the same old problem, and even gets documentend as
"broken" now. I really think that should be fixed proper instead, and
it's the right time to do it now.

Thanks,
Kay



  reply	other threads:[~2007-11-28 17:01 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 23:02 [RFC] New kobject/kset/ktype documentation and example code Greg KH
2007-11-27 23:03 ` [RFC] sample kobject implementation Greg KH
2007-11-27 23:04 ` [RFC] Sample kset/ktype/kobject implementation Greg KH
2007-11-28 16:35   ` Cornelia Huck
2007-11-29  6:11     ` Greg KH
2007-11-29  9:39       ` Cornelia Huck
2007-11-29 20:39         ` Greg KH
2007-11-29 22:11           ` Alan Stern
2007-11-30  5:07             ` Dave Young
2007-11-30  5:57               ` Dave Young
2007-11-30 14:51               ` Alan Stern
2007-11-30  6:41             ` Greg KH
2007-11-27 23:10 ` [RFC] New kobject/kset/ktype documentation and example code Kyle McMartin
2007-11-27 23:29   ` Greg KH
2007-11-27 23:21 ` Frans Pop
2007-11-28  3:50 ` Jonathan Corbet
2007-11-29  5:46   ` Greg KH
2007-11-28  9:01 ` Cornelia Huck
2007-11-28 12:35   ` Kay Sievers
2007-11-28 15:52     ` Cornelia Huck
2007-11-28 16:03       ` Kay Sievers
2007-11-28 16:09         ` Cornelia Huck
2007-11-28 17:06           ` Greg KH
2007-11-28 19:18   ` Alan Stern
2007-11-29 10:12     ` Cornelia Huck
2007-11-29 15:47       ` Alan Stern
2007-11-29 16:28         ` Cornelia Huck
2007-11-29 16:55           ` Alan Stern
2007-11-29 17:52             ` Cornelia Huck
2007-11-29  5:59   ` Greg KH
2007-11-28 11:45 ` Cornelia Huck
2007-11-28 12:23   ` Kay Sievers
2007-11-28 15:48     ` Cornelia Huck
2007-11-28 15:57       ` Kay Sievers
2007-11-28 16:12         ` Cornelia Huck
2007-11-28 16:36           ` Kay Sievers
2007-11-28 16:51             ` Cornelia Huck
2007-11-28 17:00               ` Kay Sievers [this message]
2007-11-29  6:08                 ` Greg KH
2007-11-29  7:50                   ` Kay Sievers
2007-11-29  9:35                     ` Cornelia Huck
2007-11-29 10:53                       ` Kay Sievers
2007-11-29  6:02     ` Greg KH
2007-11-29  6:04   ` Greg KH
2007-11-29  9:41     ` Cornelia Huck
2007-11-28 19:03 ` Alan Stern
2007-11-28 19:28   ` Kay Sievers
2007-11-28 19:36     ` Alan Stern
2007-11-28 19:46       ` Kay Sievers
2007-11-28 20:42         ` [PATCH] kobject: make sure kobj->ktype is set before kobject_init Alan Stern
2007-11-28 20:52           ` Kay Sievers
2007-11-28 21:45           ` Greg KH
2007-11-28 22:00             ` Alan Stern
2007-11-28 22:38               ` Greg KH
2007-11-29 10:05               ` Cornelia Huck
2007-11-29 10:59                 ` Kay Sievers
2007-11-29 11:48                   ` Cornelia Huck
2007-11-29 15:54                   ` Alan Stern
2007-11-29 16:04                     ` Kay Sievers
2007-11-29 16:21                       ` Cornelia Huck
2007-11-29 21:53                         ` kobject_init rewrite Greg KH
2007-11-29 21:54                           ` Greg KH
2007-11-30  9:31                             ` Cornelia Huck
2007-11-29 22:16                           ` Alan Stern
2007-11-29 22:24                             ` Greg KH
2007-11-29 17:06                       ` [PATCH] kobject: make sure kobj->ktype is set before kobject_init Alan Stern
2007-11-29 17:17                         ` Kay Sievers
2007-11-29 18:04                           ` Alan Stern
2007-11-29 18:33                             ` Kay Sievers
2007-11-29 19:05                               ` Alan Stern
2007-11-29 19:51                                 ` Kay Sievers
2007-11-29 20:09                                   ` Alan Stern
2007-11-29 20:19                                     ` Kay Sievers
2007-11-29 20:26                                       ` Kay Sievers
2007-11-30  9:30                                         ` Cornelia Huck
2007-11-29  6:18   ` [RFC] New kobject/kset/ktype documentation and example code Greg KH
2007-11-29 15:42     ` Alan Stern

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=1196269227.3242.93.camel@lov.site \
    --to=kay.sievers@vrfy.org \
    --cc=corbet@lwn.net \
    --cc=cornelia.huck@de.ibm.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --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;
as well as URLs for NNTP newsgroup(s).