[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140831113822.GF19853@htj.dyndns.org>
Date: Sun, 31 Aug 2014 07:38:22 -0400
From: Tejun Heo <tj@...nel.org>
To: David Herrmann <dh.herrmann@...il.com>
Cc: "Luis R. Rodriguez" <mcgrof@...not-panic.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>, falcon@...zu.com,
Takashi Iwai <tiwai@...e.de>, arjan@...ux.intel.com,
linux-kernel <linux-kernel@...r.kernel.org>,
Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
penguin-kernel@...ove.sakura.ne.jp,
Joseph Salisbury <joseph.salisbury@...onical.com>,
bpoirier@...e.de, "Luis R. Rodriguez" <mcgrof@...e.com>,
Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [RFC v1 0/3] driver-core: add asynch module loading support
(cc'ing Rusty for module loading)
Hello,
On Sun, Aug 31, 2014 at 01:25:03PM +0200, David Herrmann wrote:
> On Sun, Aug 31, 2014 at 1:02 PM, Tejun Heo <tj@...nel.org> wrote:
> > @@ -689,9 +704,23 @@ int bus_add_driver(struct device_driver *drv)
> >
> > klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers);
> > if (drv->bus->p->drivers_autoprobe) {
> > - error = driver_attach(drv);
> > - if (error)
> > - goto out_unregister;
> > + struct driver_attach_work *daw;
Oops, this probably should go inside the below if block.
> > +
> > + if (drv->owner) {
> > + daw = kzalloc(sizeof(*daw), GFP_KERNEL);
> > + if (!daw) {
> > + error = -ENOMEM;
> > + goto out_unregister;
> > + }
> > +
> > + INIT_WORK(&daw->work, driver_attach_workfn);
> > + daw->driver = drv;
> > + queue_work(driver_attach_wq, &daw->work);
>
> Doesn't this break on-demand cdev initialization? We currently call
> request_module() on open() for unclaimed major/minor combinations. If
> driver_attach() is no longer part of module_init(), there is no
> guarantee the driver created the cdev before request_module() returns.
Right, yeah, this really looks like something we'd need to switch per
insmod instance. It looks like driver core needs a generic parameter
to tell it to whether drive probing asynchronously to module loading
or not. Maybe we can add a generic driver param like
"driver_async_probe"?
> I actually like this "deferred attach" approach, so this is not meant
> as counter-argument. We just need to make sure to have a notion of
> "settled modules" so we know how long to wait after loading a module.
Another way could be making module-generic pollable file in the
module's sysfs dir to indicate "full init completion", which would map
to probing completion for drivers; however, given that we need to keep
the synchronous behavior by default for compatibility, I don't think
that buys us much.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists