[OpenAFS] Re: suggestion for linux kernel modules

Jeffrey Hutzelman jhutz@cmu.edu
Sun, 04 Dec 2005 20:19:54 -0500


On Wednesday, November 02, 2005 11:39:50 AM -0500 Joe Buehler 
<jbuehler@spirentcom.com> wrote:

> Tim Spriggs wrote:
>
>>   I just thought I would point out the uname is a standard utility and
>> works almost everywhere. On the other hand, my kernel doesn't provide a
>> /proc/ksyms (2.6.12.5 vanilla kernel)
>>
>>   This may be a good idea but the implementation needs some modification
>> to be more general. This is probably why uname was used in the first
>> place.
>
> I don't run the 2.6 kernel so some changes are needed for that case -- I
> know that the /proc file name changed; perhaps its content has also.

The issue is not that the filename changed, but that the kernel can be
configured not to export the file.


Fortunately, we came up with a solution to this problem long ago.  Instead 
of selecting an AFS module based on the uname output, you can use the 
symbol version matching algorithm supported by afsmodname.  Then you can 
name the files whatever you want.

The RPM's for 2.6.x-based systems don't do this any more, because it was 
assumed that in modern systems, it would be very uncommon for the same 
module to work on more than one kernel, and also quite uncommon to have two 
kernels on the same system with the same `uname -r` but different options. 
I know of no distribution which ships multiple kernels with the same 
version and different options, so any such conflict is presumably the 
result of the user having built his own kernel.  Since it already doesn't 
work to have two kernels on the same machine with the same version....

Of course, if you're building kernels for distribution, then you need to be 
careful to use distinct names for every possible configuration, and not 
just to make it possible to select an AFS module.  I expect most large 
sites that distribute locally-built kernels learned this lesson some time 
ago.



BTW, note that naming modules based on the contents of /proc/ksyms makes 
the assumption that the module you're building belongs with whatever kernel 
happens to be running on the machine where you built it.  While this may 
sometimes be true for users who are building their own kernels and AFS 
modules by hand, it is almost never true for anyone building kernels for 
distribution (I build something like a dozen kernels for distribution to 
machines in my facility.  I can't boot each one to build an AFS module for 
it, both because that would mean a dozen disruptive, hard-to-automate 
reboot cycles for the build machine, and because the sources are in AFS!)

-- Jeff