From: Alan Stern <stern@rowland.harvard.edu>
To: Greg KH <greg@kroah.com>
Cc: Oliver Neukum <oneukum@suse.com>,
Julius Werner <jwerner@chromium.org>,
USB Storage list <usb-storage@lists.one-eyed-alien.net>,
Dan Williams <dcbw@redhat.com>,
Kernel development list <linux-kernel@vger.kernel.org>,
USB list <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] usb: storage: Add ums-cros-aoa driver
Date: Tue, 3 Sep 2019 10:14:36 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44L0.1909031009250.1859-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20190903091953.GA12325@kroah.com>
On Tue, 3 Sep 2019, Greg KH wrote:
> On Tue, Sep 03, 2019 at 10:46:14AM +0200, Oliver Neukum wrote:
> > Am Montag, den 02.09.2019, 18:47 +0200 schrieb Greg KH:
> > >
> > > This should work just fine today. Add a new device id to the "new_id"
> > > file and then tell the driver to bind. That's pretty much the same as a
> > > "force_bind", right?
> >
> > That looks like a race condition by design to me.
>
> How?
>
> Anyway, this should all "just work" somehow, there's an old lwn.net
> article I wrote about this over a decade ago when it was added. A
> number of subsystems use this all the time (vfio?) and I haven't heard
> any issues with it in a long time.
No, this won't "just work". The problem is that when you write to the
new_id file, usb_store_new_id() calls driver_attach(), which tries to
bind the driver to any matching device. There _will_ be other matching
devices, and trying to bind them will cause runtime errors.
That isn't what we want. We want to bind the driver to a _specific_
device and no others, even if the others match the new id.
Now, this is what writing to the sysfs "bind" file does -- except that
it won't let you bind a driver to a device it doesn't match!
So we have two problems:
Bind a driver to a particular device,
Even though the id's for the device don't match the driver.
The kernel already contains solutions for each of these problems, but
nothing that can handle both at once.
Alan Stern
next prev parent reply other threads:[~2019-09-03 14:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 23:14 [PATCH] usb: storage: Add ums-cros-aoa driver Julius Werner
2019-08-27 23:29 ` Matthew Dharm
[not found] ` <CAA6KcBAykS+VkhkcF42PhGyNu8KAEoaYPgA9-ru_HCxKrAEZzg@mail.gmail.com>
2019-08-27 23:59 ` Julius Werner
2019-08-28 8:32 ` Greg Kroah-Hartman
2019-08-28 16:17 ` Alan Stern
2019-08-28 16:41 ` Dan Williams
2019-08-29 3:26 ` Julius Werner
2019-08-29 7:25 ` Greg Kroah-Hartman
2019-08-29 15:41 ` Alan Stern
2019-08-30 0:31 ` Julius Werner
2019-08-30 17:43 ` Alan Stern
2019-09-02 16:47 ` Greg KH
2019-09-03 8:46 ` Oliver Neukum
2019-09-03 9:19 ` Greg KH
2019-09-03 10:04 ` Oliver Neukum
2019-09-03 12:45 ` Greg KH
2019-09-03 14:14 ` Alan Stern [this message]
2019-09-06 21:02 ` Julius Werner
2019-09-07 19:10 ` 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=Pine.LNX.4.44L0.1909031009250.1859-100000@iolanthe.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=dcbw@redhat.com \
--cc=greg@kroah.com \
--cc=jwerner@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=usb-storage@lists.one-eyed-alien.net \
/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).