Re: Module Versioning Problems

Jacques Gelinas (jack@solucorp.qc.ca)
Mon, 16 Sep 1996 00:24:31 -0400 (EDT)


On Mon, 16 Sep 1996, Hans Lermen wrote:

> On Sun, 15 Sep 1996, Alan Cox wrote:
>
> > We have a nasty module version bug at the moment as genksyms version ids
> > for SMP and uniprocessor kernels match but the code doesnt work from
> > one to the other (in fact getting it wrong can lose you things like
> > file systems).
> >
> > [ ... ]
> > Am I right in thinking I can do this... and if so would the modules folks
> > care to confirm it and submit the change to Linus
> >
> > #ifdef __SMP__ /* SMP machine */
> > /* Generate symbol_S0123456 */
> > #define _set_ver(sym,vers) sym ## _S ## vers
> > #else
> > /* Generate symbol_R0123456 */
> > #define _set_ver(sym,vers) sym ## _R ## vers
> > #endif /* SMP */
> >
>
> Yes, I guess this would work though it needs to adapt the modules package.
>
> However, it doesn't solve the problem for non-MODVERSION compilations.
> For these we would need a variable in kernel (e.g. smp_num_cpus), which
> is compiled in also in non-SMP kernel (currently it is #ifdef __SMP__).
> The modules, if compiled under SMP should have a reference to this
> variable (could be in <linux/module.h>) and insmod could take care of the rest.
> This solution would solve both cases, with or without MODVERSION and the
> changes in the modules package are minimal.

To avoid confusion, SMP module should be thrown in
/lib/modules/kernel-version.SMP/. This would allow one to boot a SMP
kernel and then a non SMP kernel and still have all his modules
operationnal. A simple change in modprobe/depmod would select the proper
directory. Currently, the default is to select the directory this way

/lib/modules/`uname -r`/

We could define a different scheme (by looking in /proc/somewhere) to look
up the proper directory.

As for a solution to fully differentiate non versioned module, we should
simply define a simpler mangling such as just add _S at the end of any
kernel symbol using the same strategy as used for versionning. Not even a
change to the module package, except to automate the location.

What do you think!

--------------------------------------------------------
Jacques Gelinas (jacques@solucorp.qc.ca)
Linuxconf: The ultimate administration system for Linux.
see http://www.solucorp.qc.ca:/linuxconf