All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Cc: dmitry.torokhov@gmail.com, falcon@meizu.com, tiwai@suse.de,
	tj@kernel.org, arjan@linux.intel.com,
	linux-kernel@vger.kernel.org, oleg@redhat.com,
	akpm@linux-foundation.org, penguin-kernel@i-love.sakura.ne.jp,
	joseph.salisbury@canonical.com, bpoirier@suse.de,
	"Luis R. Rodriguez" <mcgrof@suse.com>
Subject: Re: [RFC v1 0/3] driver-core: add asynch module loading support
Date: Sun, 31 Aug 2014 09:41:50 -0700	[thread overview]
Message-ID: <20140831164150.GA3339@kroah.com> (raw)
In-Reply-To: <1409475800-17573-1-git-send-email-mcgrof@do-not-panic.com>

On Sun, Aug 31, 2014 at 02:03:17AM -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> While reviewing Wu Zhangjin's solution to async probe [0] and his
> ideas on creating async groups I decided to try following the init
> levels on the kernel to try to help with synchronization at least
> on some level. This borrows ideas discussed with the kthread_create()
> solution [1] and also simplifies the idea of how we should be grouping
> async calls between drivers.
> 
> A few things worth mentioning. I decided to go down a generic solution as
> if we ever wanted to bring asynchrnonization behaviour below modules
> this would allow folks to start testing this without much effort. It
> allows asynchronous calls to upkeep the order already set in place
> for built-in code. If one wanted to eventually venture down below
> that path we'd need to add respective exit calls for each level, as
> right now we just assume that every level should use module_exit().
> SmPL grammer could be used to easily tidy this up, for example on
> the subsys_init():
> 
> @ subsys_found @
> expression fn_init;
> declarer name subsys_initcall;
> @@
> 
>   subsys_initcall(fn_init);                                                     
> 
> @ subsys_exit_found depends on subsys_found @
> expression fn_exit;
> declarer name module_exit;
> declarer name subsys_exitcall;
> @@                                                                              
>                                                                                 
> - module_exit(fn_exit);
> + subsys_exitcall(fn_exit);
> 
> And so on. The second thing to note is that when an asynchronous
> call is used we don't want to free the init data as otherwise
> async_run_entry_fn() will run into a missing init routine. SmPL
> could still be used to convert basic __init data out if this is
> needed, however if the init routine also used other init data
> we'd also have to remove the other __init data used. It could
> in theory be possible to do a witch hunt to write this in grammar
> but for now only a simple conversion on the init side is recommended
> as reflected in the SmPL below and manual inspection after that.
> Another option as suggested by Julia to me was to consider an
> __init_asynch which we could reap later. This is of course if
> we go down this generic path.
> 
> @ module_init_found @
> identifier f;
> declarer name module_init;
> declarer name module_init_async;
> @@
> 
> -   module_init(f);
> +   module_init_async(f);
> 
> @ modify_decl depends on module_init_found @
> identifier module_init_found.f;
> @@
> 
> - int f
> + int f
>     (...) { ... }
> 
> 
> @ module_exit_found depends on module_init_found @
> identifier fn_exit;
> declarer name module_exit;
> declarer name module_exit_async;
> @@
> 
> - module_exit(fn_exit);
> + module_exit_async(fn_exit);
> 
> Although not visible the above int f does remove the __init...
> 
> If generalizing an async solution is not desirable in the
> long run for things other than modules than a bool should
> be easy to use to figure if probe should run async'd or not.
> Grouping however still becomes a question then, and this is
> why I went with this approach as it aligns itself more closely
> to the kernel init levels and that should be well tested. In
> theory it could even be possible to use a similar strategy to
> asynch on per init level when built-in using a similar strategy
> but these would have to be separate.

This is a much larger change than I was wanting, I just wanted a change
to 'struct driver' to add a new flag that a driver could then use to say
if it can be async probed or not by the driver core.

Closer to Tejun's patch in this email series, but toggleable on a
per-driver basis, if for no other reason than David's response about
some drivers _having_ to be bound to their device by the time module
init returns.

thanks,

greg k-h

  parent reply	other threads:[~2014-08-31 16:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-31  9:03 [RFC v1 0/3] driver-core: add asynch module loading support 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
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 [this message]
     [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=20140831164150.GA3339@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=bpoirier@suse.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=falcon@meizu.com \
    --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=tiwai@suse.de \
    --cc=tj@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.