public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Scott Wood <scottwood@freescale.com>
Cc: Kim Phillips <kim.phillips@linaro.org>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	R65777@freescale.com, B08248@freescale.com,
	christoffer.dall@linaro.org, alex.williamson@redhat.com,
	a.motakis@virtualopensystems.com, agraf@suse.de,
	B16395@freescale.com
Subject: Re: [REPOST][PATCH 1/2] driver core: Add new device_driver flag to allow binding via sysfs only
Date: Thu, 19 Dec 2013 12:34:01 -0800	[thread overview]
Message-ID: <20131219203401.GA11290@kroah.com> (raw)
In-Reply-To: <1387484531.3140.134.camel@snotra.buserror.net>

On Thu, Dec 19, 2013 at 02:22:11PM -0600, Scott Wood wrote:
> On Wed, 2013-12-18 at 17:07 -0800, Greg Kroah-Hartman wrote:
> > On Tue, Dec 03, 2013 at 12:34:46PM +0000, Kim Phillips wrote:
> > > VFIO supports pass-through of devices to user space - for sake
> > > of illustration, say a PCI e1000 device:
> > > 
> > > - the e1000 is first unbound from the PCI e1000 driver via sysfs
> > > - the vfio-pci driver is told via new_id that it now handles e1000 devices
> > > - the e1000 is explicitly bound to vfio-pci through sysfs
> > > 
> > > However, now we have two drivers in the system that both handle e1000
> > > devices.  A hotplug event could then occur and it is ambiguous as to which
> > > driver will claim the device.  The desired semantics is that vfio-pci is
> > > only bound to devices by explicit request in sysfs.  This patch makes this
> > > possible by introducing a sysfs_bind_only flag in struct device_driver.
> > 
> > Why deal with this at all and not just deal with the "bind" sysfs file
> > instead?  That way no driver core logic needs to be changed at all, and
> > your userspace tools know _exactly_ which device is being bound to the
> > new device.
> > 
> > Don't mess with the "new_id" file for stuff like this, as you point out,
> > it's "tricky"...
> 
> As discussed before, "bind" does not bypass the ID checks, and thus it
> does not work without either "new_id" or a wildcard match.

Ah, forgot about that.

> Or are you proposing changing "bind" so that it does bypass the ID
> checks?  Or perhaps a new "force_bind" file that does?

No.  But you can use bind/unbind along with the existing new_id file to
get what you want today.  If you just happen to bind a device to a wrong
driver for a while, that's not really a problem, right?

I don't like this patch as we are adding lots of special and odd logic
to the core, for use by almost no one, which ensures that it will never
get tested, and will probably get broken in some subtle way in the
future.

Heck, I can't even ensure that you got it right now, with this tiny
patch, how do you know it works given that there are no users of this
flag anywhere (hint, you never showed me any...)

greg k-h

  reply	other threads:[~2013-12-19 20:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 12:34 [REPOST][PATCH 1/2] driver core: Add new device_driver flag to allow binding via sysfs only Kim Phillips
2013-12-03 15:34 ` Jan Kiszka
2013-12-05 17:45   ` Kim Phillips
2013-12-05 22:38     ` Scott Wood
2013-12-09 18:58       ` Kim Phillips
2013-12-09 19:12         ` Jan Kiszka
2013-12-09 21:33           ` Scott Wood
2013-12-19  1:04   ` Greg Kroah-Hartman
2013-12-19  1:07 ` Greg Kroah-Hartman
2013-12-19 20:22   ` Scott Wood
2013-12-19 20:34     ` Greg Kroah-Hartman [this message]
2013-12-19 21:06       ` Stuart Yoder
2013-12-19 21:43         ` Greg Kroah-Hartman
2013-12-19 22:15           ` Scott Wood
2013-12-19 22:32             ` Greg Kroah-Hartman
2013-12-19 23:08               ` Stuart Yoder
2013-12-20  0:00                 ` Greg Kroah-Hartman

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=20131219203401.GA11290@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=B08248@freescale.com \
    --cc=B16395@freescale.com \
    --cc=R65777@freescale.com \
    --cc=a.motakis@virtualopensystems.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=christoffer.dall@linaro.org \
    --cc=kim.phillips@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scottwood@freescale.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