public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg KH <gregkh@suse.de>
Cc: Kay Sievers <kay.sievers@vrfy.org>,
	Sebastian Ott <sebott@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] bind/unbind uevent
Date: Thu, 16 Dec 2010 11:22:34 +0100	[thread overview]
Message-ID: <20101216112234.21e47f9e@gondolin> (raw)
In-Reply-To: <20101215181854.GA29205@suse.de>

On Wed, 15 Dec 2010 10:18:54 -0800,
Greg KH <gregkh@suse.de> wrote:

> On Wed, Dec 15, 2010 at 07:08:44PM +0100, Cornelia Huck wrote:
> > On Wed, 15 Dec 2010 18:51:48 +0100,
> > Kay Sievers <kay.sievers@vrfy.org> wrote:
> > 
> > > 2010/12/15 Cornelia Huck <cornelia.huck@de.ibm.com>:
> > > > On Wed, 15 Dec 2010 08:23:16 -0800, Greg KH <gregkh@suse.de> wrote:
> > > >> On Wed, Dec 15, 2010 at 02:21:13PM +0100, Cornelia Huck wrote:
> > > 
> > > >> How about I turn it around for you, please show me how the driver core
> > > >> does _not_ support this today?  If you can prove that this isn't working
> > > >> properly, then great, I'll gladly accept patches to resolve it.
> > > >
> > > > Looking at device_add():
> > > 
> > > ...
> > > 
> > > > This will not be a problem if a device driver registers a child device
> > > > (since it can specify the attributes there).
> > > 
> > > Which is the proper way to do it. No driver should ever mangle a
> > > device which it does not own. It's like adding properties of a block
> > > device directly to a usb_interface device. That just can not work
> > > correctly for many reasons, inside and outside of the kernel.
> > 
> > That's fine for new device drivers.
> 
> No, that's for _all_ drivers, why should yours be "special" and not work
> this way?

Because it would break existing userspace.

> 
> > > > I think the basic problem is that the KOBJ_ADD uevent notifies
> > > > userspace that "a device is there", while the device will only be
> > > > really useable by userspace once a driver has bound to it.
> > > 
> > > This device represents a device on a bus, and can usually do its own
> > > things. A driver can bind to it, but should not mangle it.
> > > 
> > > > A module
> > > > load triggered by KOBJ_ADD is fine, but trying to actually use the
> > > > device after KOBJ_ADD is racy. This will not matter in the usual case,
> > > > since either the matching/probing is fast enough or userspace will wait
> > > > for something like a block device anyway, but we've seen problems on
> > > > s390. A KOBJ_BIND/UNBIND would make a proper distinction between
> > > > "device is there" and "device is usable".
> > > 
> > > We don't rally want any such events. We expect a new child device
> > > being created from the driver, instead of re-using the existing bus
> > > device.
> > 
> > Do we want to force a device driver to create a child device just to
> > notify userspace of the bind?
> 
> That's the way all other buses and drivers work, again, why are your
> devices and drivers "special" here?

?? This has nothing to do with our drivers. Why should a generic driver
that doesn't need extra attributes etc. create a child device? (Well,
if that's the way it's supposed to work...)

> 
> > > > (Besides, what happens on unbind/bind? Shouldn't userspace know that a
> > > > device is now bound to a different driver?)
> > > 
> > > It does that by watching the child devices the driver creates and destroys.
> > > 
> > > We already have enough events to handle on today's boxes, we really
> > > don't want to add new ones, which are only needed to work around such
> > > use cases, which ideally just should be fixed.
> > > 
> > > If you can not change the current drivers to create child devices, the
> > > driver can probably just send change events for the already existing
> > > devices it mangles from the driver.
> > 
> > Since introducing child devices would change the userspace interface, a
> > change event on BUS_NOTIFY_BOUND_DRIVER would probably be the most
> > reasonable for our busses.
> 
> No, you _already_ get those events, and you can add attributes
> automatically when that happens today!

But it is still _after_ the KOBJ_ADD uevent, which makes it still racy,
regardless of who adds the attributes. (And of course we would only do
the change event for our busses, not for everyone.)

Cornelia

  reply	other threads:[~2010-12-16 10:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07 16:18 [RFC] bind/unbind uevent Sebastian Ott
2010-12-07 16:27 ` Greg KH
2010-12-07 17:29   ` Sebastian Ott
2010-12-07 18:33     ` Greg KH
2010-12-07 19:00       ` Kay Sievers
2010-12-08 10:18         ` Sebastian Ott
2010-12-08 16:02           ` Greg KH
2010-12-13 19:27             ` Sebastian Ott
2010-12-13 19:36               ` Greg KH
2010-12-14 18:26                 ` Sebastian Ott
2010-12-14 19:29                   ` Greg KH
2010-12-15 13:21                     ` Cornelia Huck
2010-12-15 16:23                       ` Greg KH
2010-12-15 17:35                         ` Cornelia Huck
2010-12-15 17:51                           ` Kay Sievers
2010-12-15 18:08                             ` Cornelia Huck
2010-12-15 18:18                               ` Greg KH
2010-12-16 10:22                                 ` Cornelia Huck [this message]
2010-12-08 10:16       ` Sebastian Ott
2010-12-08 16:01         ` Greg KH

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=20101216112234.21e47f9e@gondolin \
    --to=cornelia.huck@de.ibm.com \
    --cc=gregkh@suse.de \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sebott@linux.vnet.ibm.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