mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	falcon@meizu.com, Takashi Iwai <tiwai@suse.de>,
	arjan@linux.intel.com,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	penguin-kernel@i-love.sakura.ne.jp,
	Joseph Salisbury <joseph.salisbury@canonical.com>,
	bpoirier@suse.de, "Luis R. Rodriguez" <mcgrof@suse.com>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [RFC v1 0/3] driver-core: add asynch module loading support
Date: Sun, 31 Aug 2014 07:38:22 -0400	[thread overview]
Message-ID: <20140831113822.GF19853@htj.dyndns.org> (raw)
In-Reply-To: <CANq1E4QFtTrCU8eq67AqeUO1v9EAZnAfaHJW4CnJkh0KKq9XmA@mail.gmail.com>

(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@kernel.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

  reply	other threads:[~2014-08-31 11:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-31  9:03 Luis R. Rodriguez
2014-08-31  9:03 ` [RFC v1 1/3] driver-core: split module_init() and module_exit() Luis R. Rodriguez
2014-08-31  9:03 ` [RFC v1 2/3] async: move synchronous caller into a helper Luis R. Rodriguez
2014-08-31  9:03 ` [RFC v1 3/3] async: add driver asynch levels Luis R. Rodriguez
2014-08-31 10:13 ` [RFC v1 0/3] driver-core: add asynch module loading support Tejun Heo
2014-08-31 11:02   ` Tejun Heo
2014-08-31 11:05     ` Tejun Heo
2014-08-31 17:52       ` Dmitry Torokhov
2014-08-31 19:26         ` Arjan van de Ven
2014-08-31 20:11           ` Dmitry Torokhov
2014-08-31 11:25     ` David Herrmann
2014-08-31 11:38       ` Tejun Heo [this message]
2014-08-31 18:28   ` Dmitry Torokhov
2014-08-31 22:02     ` Tejun Heo
2014-08-31 23:06       ` Dmitry Torokhov
2014-08-31 23:40         ` Tejun Heo
2014-08-31 14:44 ` Arjan van de Ven
2014-08-31 17:50   ` Dmitry Torokhov
2014-08-31 19:24     ` Arjan van de Ven
2014-08-31 19:31       ` Greg KH
2014-08-31 20:14         ` Dmitry Torokhov
2014-08-31 20:40           ` Greg KH
2014-08-31 21:53             ` Tejun Heo
2014-08-31 22:15               ` Greg KH
2014-08-31 22:53                 ` Tejun Heo
2014-08-31 23:20                   ` Arjan van de Ven
2014-08-31 23:29                     ` Tejun Heo
2014-08-31 22:51               ` Dmitry Torokhov
2014-08-31 23:03                 ` Tejun Heo
2014-09-04 21:21             ` Luis R. Rodriguez
2014-09-04 21:52               ` Greg KH
2014-08-31 16:41 ` Greg KH
     [not found] <99jhsb6abtsilpt3j5nu991b.1409513632114@email.android.com>
2014-08-31 22:32 ` Arjan van de Ven
2014-08-31 22:45   ` Dmitry Torokhov
2014-08-31 22:48     ` Arjan van de Ven

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=20140831113822.GF19853@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=bpoirier@suse.de \
    --cc=dh.herrmann@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=falcon@meizu.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joseph.salisbury@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@do-not-panic.com \
    --cc=mcgrof@suse.com \
    --cc=oleg@redhat.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rusty@rustcorp.com.au \
    --cc=tiwai@suse.de \
    /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

all inboxes | Powered by JetHome®