Re: [PATCH v5 8/8] rpmsg: Turn name service into a stand alone driver

From: Guennadi Liakhovetski
Date: Tue Nov 17 2020 - 01:46:32 EST


Hi Mathieu,

On Mon, Nov 16, 2020 at 03:40:03PM -0700, Mathieu Poirier wrote:
> On Mon, Nov 16, 2020 at 04:51:52PM +0100, Arnaud POULIQUEN wrote:

[snip]

> > Having said that, does this guarantee the probe, a good question!
> > Maybe you or Mathieu have the answer, not me...
>
> I did a lot of probing, went deep in the bowels of the user mode helper
> subsystem and looked at sys_load_module(). Especially at do_init_module() where
> function do_one_initcall()[1] is called on mod->init, which happens to be
> rpmsg_ns_init() where the name space driver is registered. I am confident we
> can rely on this mechanism.

Thanks for investigating and confirming that! So, we can be confident, that
if the module is already loaded at the time when the NS device is registered,
the probing happens synchronously. Now, as for how to actually load the
module, I'd really propose to move rpmsg_ns_register_device() into the .c
file and then the problem will be resolved automatically: as a symbol
dependence the module will be loaded whenever another module, calling
rpmsg_ns_register_device() is loaded.

Thanks
Guennadi