Module alias and device table support.
Subsystems (7)
PATCH 1/1 Module alias and device table support.
This patch adds MODULE_ALIAS("foo") capability, and uses it to automatically generate sensible aliases from device tables. The post-processing is a little rough, but works.
Name: Module alias and device table support
Author: Rusty Russell
Status: Tested on 2.5.59
D: Introduces "MODULE_ALIAS" which modules can use to embed their own
D: aliases for modprobe to use. Also adds a "finishing" step to modules to
D: supplement their aliases based on MODULE_TABLE declarations, eg.
D: 'usb:v0506p4601dl*dh*dc*dsc*dp*ic*isc*ip*' for drivers/usb/net/pegasus.o
include/linux/isapnp.h +3 -1
@@ -69,8 +69,9 @@/* export used IDs outside module */ #define ISAPNP_CARD_TABLE (name) \ - MODULE_GENERIC_TABLE(isapnp_card, name) + MODULE_TABLE(isapnp_card, name) +/* If you change this, you must update scripts/table2alias.c. */ struct isapnp_card_id {unsigned long driver_data;/* data private to the driver */ unsigned short card_vendor, card_device;
@@ -85,6 +86,7 @@ struct isapnp_card_id {#define ISAPNP_DEVICE_SINGLE_END \ .card_vendor = 0, .card_device = 0 +/* If you change this, you must update scripts/table2alias.c. */ struct isapnp_device_id {unsigned short card_vendor, card_device;unsigned short vendor, function;
include/linux/module.h +7 -5
@@ -50,13 +50,14 @@ search_extable(const struct exception_ta unsigned long value);#ifdef MODULE +#define ___module_cat (a,b) a ## b +#define __module_cat (a,b) ___module_cat(a,b) +/* For userspace: you can also call me... */ +#define MODULE_ALIAS (alias) \ + static const char __module_cat(__alias_,__LINE__)[] \ + __attribute__((section(".modalias"),unused)) = alias -/* For replacement modutils, use an alias not a pointer. */ #define MODULE_GENERIC_TABLE (gtype,name) \ -static const unsigned long __module_##gtype##_size \ - __attribute__ ((unused)) = sizeof(struct gtype##_id); \ -static const struct gtype##_id * __module_##gtype##_table \ - __attribute__ ((unused)) = name; \ extern const struct gtype##_id __mod_##gtype##_table \ __attribute__ ((unused, alias(__stringify(name))))
@@ -96,6 +97,7 @@ extern const struct gtype##_id __mod_##g#else /* !MODULE */ +#define MODULE_ALIAS (alias)#define MODULE_GENERIC_TABLE (gtype,name)#define THIS_MODULE ((struct module *)0)#define MOD_INC_USE_COUNT do { } while (0)
include/linux/pci.h +1 -0
@@ -491,6 +491,7 @@ struct pbus_set_ranges_dataunsigned long prefetch_start, prefetch_end; }; +/* If you change this, you must update scripts/table2alias.c. */ struct pci_device_id {unsigned int vendor, device;/* Vendor and device ID or PCI_ANY_ID */ unsigned int subvendor, subdevice;/* Subsystem ID's or PCI_ANY_ID */
include/linux/usb.h +1 -0
@@ -371,6 +371,7 @@ static inline int usb_make_path (struct* matches towards the beginning of your table, so that driver_info can * record quirks of specific products. */ +/* If you change this, you must update scripts/table2alias.c. */ struct usb_device_id {/* which fields to match against? */ __u16 match_flags;
scripts/Makefile +1 -1
@@ -8,7 +8,7 @@ # docproc: Preprocess .tmpl file in order to generate .sgml documentation # conmakehash: Create arrays for initializing the kernel console tables -host-progs := fixdep split-include conmakehash docproc kallsyms +host-progs := fixdep split-include conmakehash docproc kallsyms table2alias build-targets := $(host-progs) # Let clean descend into subdirs
scripts/Makefile.build +7 -2
@@ -175,11 +175,16 @@ endif quiet_cmd_link_multi-y = LD $@ cmd_link_multi-y = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^) +ifdef CONFIG_HOTPLUG +module_link_hotplug-multi = `$(CONFIG_SHELL) scripts/extract_aliases [email protected] "$(modname_flags)" $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.ko=-objs))) $($(subst $(obj)/,,$(@:.ko=-y)))),$^)` +module_link_hotplug-single = `$(CONFIG_SHELL) scripts/extract_aliases [email protected] "$(modname_flags)" $<` +endif + quiet_cmd_link_multi-m = LD [M] $@ -cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.ko=-objs))) $($(subst $(obj)/,,$(@:.ko=-y)))),$^) init/vermagic.o +cmd_link_multi-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.ko=-objs))) $($(subst $(obj)/,,$(@:.ko=-y)))),$^) $(module_link_hotplug-multi) init/vermagic.o quiet_cmd_link_single-m = LD [M] $@ -cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o +cmd_link_single-m = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_MODULE) -o $@ $< init/vermagic.o $(module_link_hotplug-single) # Don't rebuilt vermagic.o unless we actually are in the init/ dir ifneq ($(obj),init)
scripts/extract_aliases +21 -0
@@ -0,0 +1,21 @@ +#! /bin/sh + +# Look for module tables, and if found, put them in the object file +# and print its name. +set -e + +OUTPUT="$1" +MODNAME_FLAGS="$2" +shift 2 + +$NM --no-sort --print-size --radix=d --print-file-name "$@" | + grep '__mod_[a-z_]*_table' | + while IFS=": " read FILE OFFSET SIZE TYPE NAME; do + scripts/table2alias $NAME $FILE $OFFSET $SIZE + done > $OUTPUT.c + +if [ -s $OUTPUT.c ]; then + $CC $CFLAGS $NOSTDINC_FLAGS $EXTRA_CFLAGS $MODNAME_FLAGS -DMODULE -include include/linux/module.h -c -o $OUTPUT.o $OUTPUT.c + echo $OUTPUT.o +fi +rm $OUTPUT.c
scripts/table2alias.c +244 -0
244 lines not on this page · raw message
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Quoted 4 lines · Rusty Russell
This patch adds
MODULE_ALIAS("foo")capability, and uses it to automatically generate sensible aliases from device tables. The post-processing is a little rough, but works.
Quoted 8 lines
Name: Module alias and device table support
Author: Rusty Russell
Status: Tested on 2.5.59D: Introduces "
MODULE_ALIAS" which modules can use to embed their own
D: aliases for modprobe to use. Also adds a "finishing" step to modules to
D: supplement their aliases based onMODULE_TABLEdeclarations, eg.
D: 'usb:v0506p4601dl*dh*dc*dsc*dp*ic*isc*ip*' fordrivers/usb/net/pegasus.o
Some comments:
o First of all, we're basically moving depmod functionality into the kernel tree, which I regard as a good thing, since we have to deal with actual kernel structures here. (The obvious disadvantage is that this makes it much easier to change these kernel structures, which breaks compatibility with other (user space) tools who expect a certain format)
I was wondering if it's not somewhat kludgy to add info into an ELF section into a module, just to have it extracted again by modutils shortly afterwards - the alternative would be to have the kernel generate modules.*map directly (or rather modules.alias now). However, I guess I'm convinced now that this is per-module information and should be kept as such. To avoid all kinds of trouble with separate files (module.ko and module.alias), it's probably really best to store it into an elf section directly.
o My nm (RH 7.2 or .3, GNU nm 2.11.90.0.8) doesn't support --print-size. That'll probably affect many users.
o What about collecting the struct xxx_device_id definitions into some header which could be included from the userspace code extracting the info instead of duplicating it. Still not quite fool-proof, but better than duplicating the info.
o I think it'd be a good time to consider naming these sections e.g. "__discard.modalias", the license one "__discard.license" and have the kernel module loader discard "__discard*", so that it doesn't need to be aware of all that special crap, nor waste space for it. (Well, it needs to know about the license, anyway, so that's not such a good example).
o I'm not totally happy with the integration into the build system yet, but it'll clash with the module versioning changes anyway ;)
The modversions patch introduces a postprocessing stage for modules, which currently will only be invoked with CONFIG_MODVERSIONS set. However, I'm considering to make that pass mandatory either way. It basically obtains the list of all modules from the earlier stage, so it doesn't recurse and can thus be very fast. I'm currently coding the actual versioning process in C, since the shell / sed / grep based solution's performance isn't exactly great. In doing that, I already notice unresolved symbols and warn about them, which I think is an improvement to the build process, missing EXPORT_SYMBOL()s tend to go unnoticed quite often otherwise.
Doing this postprocessing unconditionally would allow to generate the alias tables at this point as well.
And while we're at it, we could add another section which specifies which other modules this module depends on (a.k.a which symbols it uses), making depmod kinda obsolete.
--Kai
Quoted 5 lines · Kai Germaschewski
Quoted 3 lines · Rusty Russell
This patch adds
MODULE_ALIAS("foo")capability, and uses it to automatically generate sensible aliases from device tables. The post-processing is a little rough, but works.
I fail to see why a module would have to declare aliases for itself. Aliases are an userspace/after boot problem (i.e., which one is eth0?, etc), so this means having _two_ (three?) ways of getting the same kind of info (in-module/in-kernel, /etc/module.somethingortheother). Not nice.
Quoted 9 lines
Quoted 8 lines
Name: Module alias and device table support
Author: Rusty Russell
Status: Tested on 2.5.59D: Introduces "
MODULE_ALIAS" which modules can use to embed their own
D: aliases for modprobe to use. Also adds a "finishing" step to modules to
D: supplement their aliases based onMODULE_TABLEdeclarations, eg.
D: 'usb:v0506p4601dl*dh*dc*dsc*dp*ic*isc*ip*' fordrivers/usb/net/pegasus.o
Quoted 7 lines
Some comments:
o First of all, we're basically moving depmod functionality into the kernel tree, which I regard as a good thing, since we have to deal with actual kernel structures here. (The obvious disadvantage is that this makes it much easier to change these kernel structures, which breaks compatibility with other (user space) tools who expect a certain format)
It doesn't "move", it "replicates into". Not nice at all.
[...]
Quoted 6 lines
o I think it'd be a good time to consider naming these sections e.g. "__discard.modalias", the license one "__discard.license" and have the kernel module loader discard "__discard*", so that it doesn't need to be aware of all that special crap, nor waste space for it. (Well, it needs to know about the license, anyway, so that's not such a good example).
Good idea.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
Quoted 3 lines · Horst von Brand
I fail to see why a module would have to declare aliases for itself. Aliases are an userspace/after boot problem (i.e., which one is eth0?, etc) Please read the FAQ at http://www.tux.org/lkml/
I second this. A module can declare, what it provides (e.g. ethX, scsi-host-adapter), but what is loaded for each actual device should be decided be be user space (/sbin/hotplug?).
Identification, enumeration and classification is fine in the kernel, but assigning actual devices to each driver (e.g. host-adapter-A to a request_module("scsi-host-adapter")) should be done by user space, where important.
Regards
Ingo Oeser
Signature · 1 line
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
Hi,
Quoted 3 lines · Kai Germaschewski
exactly great. In doing that, I already notice unresolved symbols and warn about them, which I think is an improvement to the build process, missing EXPORT_SYMBOL()s tend to go unnoticed quite often otherwise.
The problem here is that we use System.map, it's not that difficult to extract the exported symbols:
objcopy -j .kstrtab -O binary vmlinux .export.tmp
tr \\0 \\n < .export.tmp > Export.map
Quoted 6 lines
Doing this postprocessing unconditionally would allow to generate the alias tables at this point as well.
And while we're at it, we could add another section which specifies which other modules this module depends on (a.k.a which symbols it uses), making depmod kinda obsolete.
It makes sense to keep depmod close to the linker, as both need the same knowledge about resolving symbols, but I still don't know why that would be a reason to put it into the kernel.
It doesn't really matter if that information is generated during build or at install, it just has to be at /lib/module/uname -r in a way modprobe understands. BTW for my taste modprobe has too much knowledge about the module layout, which actually belongs to the linker.
I finally looked a bit closer at the module alias. The possibility of wildcards is certainly interesting, but besides of this it looks to me as if we exchange one crutch with another. The alias string is too static and cryptic. Adding information to it requires changes at too many places (let alone adding information dynamically).
What I'd really like to see is a really generic but still simple system to match devices and drivers, e.g. describing properties like this:
bus=usb
vendor=0x1234
product=0x4321
device=1-3,5
Forcing the matching onto modprobe doesn't look like a good idea to me, as IMO it takes too much away from hotplug. The alias string is not usable for hotplug, but above properties can be used to trigger other operations beside module loading.
bye, Roman
Quoted 10 lines · Roman Zippel
Quoted 3 lines · Kai Germaschewski
exactly great. In doing that, I already notice unresolved symbols and warn about them, which I think is an improvement to the build process, missing EXPORT_SYMBOL()s tend to go unnoticed quite often otherwise.
The problem here is that we use System.map, it's not that difficult to extract the exported symbols:
objcopy -j .kstrtab -O binary vmlinux .export.tmp
tr \\0 \\n < .export.tmp > Export.map
What you say is right (except that it misses symbols exported from modules), but I don't see what you mean the problem is?
Quoted 3 lines
It makes sense to keep depmod close to the linker, as both need the same knowledge about resolving symbols, but I still don't know why that would be a reason to put it into the kernel.
Well, I hope you mean into the kernel tree, it sure doesn't make sense to put it into the kernel itself.
Anyway, I think rusty's approach is to deal with the kernel-internal data structures from inside the kernel tree (during the build, that is) and generate data in a fixed format (.modalias) for depmod to read. Since depmod is external, it needs a fixed interface. Makes sense to me.
--Kai
Hi,
Quoted 10 lines · Kai Germaschewski
Quoted 7 lines
Quoted 2 lines
missing
EXPORT_SYMBOL()s tend to go unnoticed quite often otherwise.The problem here is that we use System.map, it's not that difficult to extract the exported symbols:
objcopy -j .kstrtab -O binary vmlinux .export.tmp
tr \\0 \\n < .export.tmp > Export.mapWhat you say is right (except that it misses symbols exported from modules), but I don't see what you mean the problem is?
See above, maybe I quoted to much. The other exported symbols are already extracted by depmod, so it had exactly the information it needs and would give more correct warnings.
Quoted 11 lines
Quoted 3 lines
It makes sense to keep depmod close to the linker, as both need the same knowledge about resolving symbols, but I still don't know why that would be a reason to put it into the kernel.
Well, I hope you mean into the kernel tree, it sure doesn't make sense to put it into the kernel itself.
Anyway, I think rusty's approach is to deal with the kernel-internal data structures from inside the kernel tree (during the build, that is) and generate data in a fixed format (.modalias) for depmod to read. Since depmod is external, it needs a fixed interface. Makes sense to me.
You have to define a fixed format somewhere anyway, either you have to do it for depmod or for modprobe. This only moves the problem around and if we already break interfaces, we should look at all the possibilities. What I'm really missing is an analysis of the problem(s) and a description of how the solution solves it. After reading most of the patches I think I understand what Rusty is trying to do, but I still think there are better solutions, unfortunately Rusty doesn't talk with me anymore :(, if anyone else knows what I'm doing wrong, I'd be really happy to know about it.
bye, Roman
Quoted 8 lines · Roman Zippel
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
missing
EXPORT_SYMBOL()s tend to go unnoticed quite often otherwise.The problem here is that we use System.map, it's not that difficult to extract the exported symbols:
objcopy -j .kstrtab -O binary vmlinux .export.tmp
tr \\0 \\n < .export.tmp > Export.map
Quoted 6 lines
Quoted 2 lines
What you say is right (except that it misses symbols exported from modules), but I don't see what you mean the problem is?
See above, maybe I quoted to much. The other exported symbols are already extracted by depmod, so it had exactly the information it needs and would give more correct warnings.
The exported symbols can be extracted just as easily from System.map as from vmlinux, so I think I still don't understand your point. (And chances are higher that System.map is in /boot than an uncompressed vmlinux).
depmod does give correct warnings, but only at modules install time, not at modules build time, that's what I was trying to say.
--Kai
Hi,
Quoted 2 lines · Kai Germaschewski
depmod does give correct warnings, but only at modules install time, not at modules build time, that's what I was trying to say.
depmod certainly could give correct warnings, but currently it doesn't because System.map contains not only exported symbols.
bye, Roman
In message <[email protected]> y ou write:
Quoted 6 lines · Rusty Russell
Quoted 4 lines
D: Introduces "
MODULE_ALIAS" which modules can use to embed their own
D: aliases for modprobe to use. Also adds a "finishing" step to modules to
D: supplement their aliases based onMODULE_TABLEdeclarations, eg.
D: 'usb:v0506p4601dl*dh*dc*dsc*dp*ic*isc*ip*' fordrivers/usb/net/pegasus.o
Quoted 7 lines
Some comments:
o First of all, we're basically moving depmod functionality into the kernel tree, which I regard as a good thing, since we have to deal with actual kernel structures here. (The obvious disadvantage is that this makes it much easier to change these kernel structures, which breaks compatibility with other (user space) tools who expect a certain format)
Yes, but people already expect to run depmod at boot, and I haven't made depmod safe for cross compiling. It could be done, but is it worth it? I don't know.
BTW, the reason for using the alias mechanism is that aliases are useful in themselves: consider you write a "new_foo" driver, you can do "MODULE_ALIAS("foo")" and so no userspace changes are neccessary. module-init-tools 0.9.8 already supported this.
Quoted 2 lines
o My nm (RH 7.2 or .3, GNU nm 2.11.90.0.8) doesn't support --print-size. That'll probably affect many users.
OK. Fortunately I have a new version of the table2alias program which takes the elf object directly, anyway, which has the benifit of being faster, too.
Quoted 4 lines
o What about collecting the struct
xxx_device_iddefinitions into some header which could be included from the userspace code extracting the info instead of duplicating it. Still not quite fool-proof, but better than duplicating the info.
Great minds think alike: this was what Greg said. I did this in the updated patch.
Quoted 6 lines
o I think it'd be a good time to consider naming these sections e.g. "__discard.modalias", the license one "__discard.license" and have the kernel module loader discard "__discard*", so that it doesn't need to be aware of all that special crap, nor waste space for it. (Well, it needs to know about the license, anyway, so that's not such a good example).
I prefer to keep special symbols out of section names, so we can do nice tricks later with __start_. So __discard_modalias would be my preference if we're going to change it.
Quoted 2 lines
o I'm not totally happy with the integration into the build system yet, but it'll clash with the module versioning changes anyway ;)
Yeah, I thought you'd say that 8). I consider this to be after modversions in the queue, and I don't want to overload you.
Quoted 9 lines
The modversions patch introduces a postprocessing stage for modules, which currently will only be invoked with
CONFIG_MODVERSIONSset. However, I'm considering to make that pass mandatory either way. It basically obtains the list of all modules from the earlier stage, so it doesn't recurse and can thus be very fast. I'm currently coding the actual versioning process in C, since the shell / sed / grep based solution's performance isn't exactly great. In doing that, I already notice unresolved symbols and warn about them, which I think is an improvement to the build process, missing EXPORT_SYMBOL()s tend to go unnoticed quite often otherwise.
Well, you get them as warnings from depmod, but more timely checks is good.
Quoted 6 lines
Doing this postprocessing unconditionally would allow to generate the alias tables at this point as well.
And while we're at it, we could add another section which specifies which other modules this module depends on (a.k.a which symbols it uses), making depmod kinda obsolete.
We can already figure what symbols it uses in depmod: the original modprobe did just that, but Adam Richter complained about speed with 1200 modules (sure, it's < 1 second for most people, but Debian on an old 486 would suck hard).
But putting the dependent module names in a section... I must say I rather like that. I'll have to mull it over though.
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Quoted 10 lines · Rusty Russell
Quoted 6 lines
o First of all, we're basically moving depmod functionality into the kernel tree, which I regard as a good thing, since we have to deal with actual kernel structures here. (The obvious disadvantage is that this makes it much easier to change these kernel structures, which breaks compatibility with other (user space) tools who expect a certain format)
Yes, but people already expect to run depmod at boot, and I haven't made depmod safe for cross compiling. It could be done, but is it worth it? I don't know.
Well, I don't necessarily mean to kill all of depmod, I guess it still makes sense to have userspace code extract and contract dependency and alias information, so that modprobe doesn't need to open all modules just to find the one which is requested.
It's not mandatory to use depmod though, it's e.g. possible someone comes up with code which composes an initramfs on the fly, that might be perfectly happy with extracting the information directly from the modules.
Quoted 4 lines
BTW, the reason for using the alias mechanism is that aliases are useful in themselves: consider you write a "
new_foo" driver, you can do "MODULE_ALIAS("foo")" and so no userspace changes are neccessary. module-init-tools 0.9.8 already supported this.
Yup, that's nice.
Quoted 6 lines
Quoted 2 lines
o My nm (RH 7.2 or .3, GNU nm 2.11.90.0.8) doesn't support --print-size. That'll probably affect many users.
OK. Fortunately I have a new version of the table2alias program which takes the elf object directly, anyway, which has the benifit of being faster, too.
Alright. I think we're heading towards a generic postprocessor here, which takes the .o, extracts information as necessary and generates some .c file which contains e.g. checksums for the unresolved symbols (when MODVERSIONS is selected), a section to record which modules we depend on, an alias section etc. This .c is then compiled and linked into the final .ko
table2alias would then be just another module in this postprocessor. (My current version is in C already but calls "nm" to extract symbol info. If we put in the code from your new table2alias, I suppose we can instead open the object directly and find the information as necessary)
Quoted 3 lines
I prefer to keep special symbols out of section names, so we can do nice tricks later with
__start_. So__discard_modaliaswould be my preference if we're going to change it.
Fine with me. Since it's not being actually used yet, if you agree on changing it, let's do it now ;)
Quoted 6 lines
Quoted 3 lines
o I'm not totally happy with the integration into the build system yet, but it'll clash with the module versioning changes anyway ;)
Yeah, I thought you'd say that 8). I consider this to be after modversions in the queue, and I don't want to overload you.
Yup, I think modversions should have a little time to settle first. There's really only one tricky point with modversions (and the other stuff above), i.e. we need a complete list of all modules. With people playing tricks with "make SUBDIRS=..." that needs some care to not go accidentally wrong.
Quoted 4 lines
We can already figure what symbols it uses in depmod: the original modprobe did just that, but Adam Richter complained about speed with 1200 modules (sure, it's < 1 second for most people, but Debian on an old 486 would suck hard).
Well, just reading the symbols from my 100 modules takes about 1.5 secs on the laptop here, and that's with everything in cache, so I think Adam was right there ;)
--Kai
Rusty Russell <[email protected]> said:
[...]
Quoted 4 lines
BTW, the reason for using the alias mechanism is that aliases are useful in themselves: consider you write a "
new_foo" driver, you can do "MODULE_ALIAS("foo")" and so no userspace changes are neccessary. module-init-tools 0.9.8 already supported this.
May I respectfully disagree again?
This is fundamentally broken, as it takes away the possibility of me (sysadmin) to load foo or old_foo. I end up with an (useless) foo, and a new_foo that aliases for foo, and soon I'd have even_newer_foo masquerading as foo too, and all hell breaks loose. The effect is bloat over just deleting foo in the first place, as it can't be used at all now.
I remember a few cases of renamed modules (yes, annoying like hell) and very few cases of old_foo and new_foo coexisting. In the last case the _user_ had to decide if old_foo or new_foo worked better on their machine, no amount of kbuild ESP would do, no distribution could set this up sanely.
The case where this might be useful are very far in between (if they even exist), and the potential for subtle, invisible, breakage is just too high IMVHO.
Please axe it.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
In message <[email protected]> you write:
Quoted 10 lines
Rusty Russell <[email protected]> said:
[...]
Quoted 4 lines
BTW, the reason for using the alias mechanism is that aliases are useful in themselves: consider you write a "
new_foo" driver, you can do "MODULE_ALIAS("foo")" and so no userspace changes are neccessary. module-init-tools 0.9.8 already supported this.May I respectfully disagree again?
Hi Horst,
Thoughtful and respecful criticism? I didn't think that was
allowed on linux-kernel any more? 8)
Quoted 5 lines
This is fundamentally broken, as it takes away the possibility of me (sysadmin) to load foo or
old_foo. I end up with an (useless) foo, and anew_foothat aliases for foo, and soon I'd haveeven_newer_foomasquerading as foo too, and all hell breaks loose. The effect is bloat over just deleting foo in the first place, as it can't be used at all now.
Well, "modprobe foo" will only give you the "new_foo" driver if (1) the foo driver isn't found, and (2) the new driver author decides that it's a valid replacement.
Whether (2) is ever justified, I'm happy leaving to the individual author (I know, that makes me a wimp).
Consider another example: convenience aliases such as char-major-xxx. Now, I'm not convinced they're a great idea anyway, but if people are going to do this, I'd rather they did it in the kernel, rather than some random userspace program.
I think the alias mechanism is valid, but you have a point about the dangers, too.
Thoughts?
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Quoted 3 lines · Rusty Russell
Well, "modprobe foo" will only give you the "
new_foo" driver if (1) the foo driver isn't found, and (2) the new driver author decides that it's a valid replacement.
It's not the driver author's decision as to which module an admin would like to use. This just seems to make things a lot more awkward.
Quoted 2 lines
going to do this, I'd rather they did it in the kernel, rather than some random userspace program.
Can you explain why please ?
regards
john
In message <[email protected]> you write:
Quoted 8 lines · Rusty Russell
Quoted 4 lines
Well, "modprobe foo" will only give you the "
new_foo" driver if (1) the foo driver isn't found, and (2) the new driver author decides that it's a valid replacement.It's not the driver author's decision as to which module an admin would like to use. This just seems to make things a lot more awkward.
I disagree.
"insmod foo" will *always* get foo. The only exception is when "foo" doesn't exist, in which case modprobe looks for another module which explicitly says it can serve in the place of foo.
This allows smooth transition when a driver is superceded, *if* the new author wants it.
Quoted 4 lines
Quoted 2 lines
going to do this, I'd rather they did it in the kernel, rather than some random userspace program.
Can you explain why please ?
Sure, but you cut the vital bit of my mail. Currently we have (1) request_module() which is used in various cases to request a service, and (2) aliases like "char-major-36", which modprobe.conf (or the old modutils' builtin) says is "netlink". If you introduce a new char major (or, say a new cypher, or new network family, etc), you currenly have to get everyone to include it in their configuration file.
Now, the netlink module *knows* it provides char-major-36: with MODULE_ALIAS() it can say so.
Obviously, there is a place for aliases which are configured by the
user: they are definitely not going away. But many are simple enumerations, which are currently duplicated external to the kernel sources.
So I think it's a good idea, even if using it to replace drivers is insane...
Does that clarify?
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Quoted 3 lines · Rusty Russell
"insmod foo" will *always* get foo. The only exception is when "foo" doesn't exist, in which case modprobe looks for another module which explicitly says it can serve in the place of foo.
OK.
Quoted 2 lines
This allows smooth transition when a driver is superceded, *if* the new author wants it.
I would't let this happen, ever. What if foo does exist and Aunt Tillie just didn't compile it?
[...]
Quoted 9 lines
Sure, but you cut the vital bit of my mail. Currently we have (1)
request_module()which is used in various cases to request a service, and (2) aliases like "char-major-36", which modprobe.conf (or the old modutils' builtin) says is "netlink". If you introduce a new char major (or, say a new cypher, or new network family, etc), you currenly have to get everyone to include it in their configuration file.Now, the netlink module *knows* it provides char-major-36: with
MODULE_ALIAS()it can say so.
The "provides" is the missing clue... You are taking about "provides" (and mixing it up with "alias", something I still can't agree on), I'm talking about "alias". Maybe they should be separate? In your examples netlink _provides_ char-major-36, xyz3000 _provides_ binfmt-754, eepro100 _aliases_ to eth0 here. First use is clearly in-kernel, second one is (or should always be IMVHO) out-of-kernel. Sure, could use the same infrastructure for simplicity.
Now, what if xyz and zyx both provide foo? This will be the case when a new driver comes along...
[This is looking more and more like a task for rpm/apt...
/me ducks and runs]
Thanks for your patience!
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
In message <[email protected]> you write:
Quoted 5 lines
Quoted 3 lines · Rusty Russell
"insmod foo" will *always* get foo. The only exception is when "foo" doesn't exist, in which case modprobe looks for another module which explicitly says it can serve in the place of foo.
Quoted 7 lines
OK.
Quoted 2 lines
This allows smooth transition when a driver is superceded, *if* the new author wants it.
I would't let this happen, ever. What if foo does exist and Aunt Tillie just didn't compile it?
Then they turned the config option off themselves.
Quoted 10 lines
Quoted 2 lines
Now, the netlink module *knows* it provides char-major-36: with
MODULE_ALIAS()it can say so.The "provides" is the missing clue... You are taking about "provides" (and mixing it up with "alias", something I still can't agree on), I'm talking about "alias". Maybe they should be separate? In your examples netlink _provides_ char-major-36, xyz3000 _provides_ binfmt-754, eepro100 _aliases_ to eth0 here. First use is clearly in-kernel, second one is (or should always be IMVHO) out-of-kernel. Sure, could use the same infrastructure for simplicity.
That's a different debate.
This is how it works today, and how it has worked since before 2.2. If you want to argue that another mechanism should be used instead, that's a completely different issue (and not neccessarily something I would disagree with, especially since hotplug is now a first class citizen).
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Quoted 10 lines · Rusty Russell
Quoted 9 lines · Horst von Brand
Rusty Russell <[email protected]> said:
[...]
Quoted 4 lines
BTW, the reason for using the alias mechanism is that aliases are useful in themselves: consider you write a "
new_foo" driver, you can do "MODULE_ALIAS("foo")" and so no userspace changes are neccessary. module-init-tools 0.9.8 already supported this.
Quoted 6 lines
Quoted 1 line
May I respectfully disagree again?
Hi Horst,
Thoughtful and respecful criticism? I didn't think that was
allowed on linux-kernel any more? 8)
Sorry about that. Won't happen again, I promise.
Quoted 9 lines
Quoted 5 lines
This is fundamentally broken, as it takes away the possibility of me (sysadmin) to load foo or
old_foo. I end up with an (useless) foo, and anew_foothat aliases for foo, and soon I'd haveeven_newer_foomasquerading as foo too, and all hell breaks loose. The effect is bloat over just deleting foo in the first place, as it can't be used at all now.Well, "modprobe foo" will only give you the "
new_foo" driver if (1) the foo driver isn't found, and (2) the new driver author decides that it's a valid replacement.
So the alias only works if the original isn't found? Weird... I'd just rename the dang thing and get over it. A distribution kernel won't be able to use this anyway, as they'll either build both alternatives or just one of them and adjust configuration to match.
Quoted 2 lines
Whether (2) is ever justified, I'm happy leaving to the individual author (I know, that makes me a wimp).
Don't trust authors too much when it comes to guessing at random individual installations... ;-)
Quoted 4 lines
Consider another example: convenience aliases such as char-major-xxx. Now, I'm not convinced they're a great idea anyway, but if people are going to do this, I'd rather they did it in the kernel, rather than some random userspace program.
The module munging programs and their configuration are (logically) a part of the kernel (configuration). So this goes against the current wave of exporting as much as possible from the kernel. And IMHO it places policy into the kernel, where it has no place. Plus it enlarges modules, which is a consideration for installation/rescue media.
Quoted 4 lines
I think the alias mechanism is valid, but you have a point about the dangers, too.
Thoughts?
Maybe I'm just being a bit too conservative here. But I still think this is too dangerous for little (or even no) real gain.
Could you please provide examples of use in generic, distribution kernels? Contrast with configuration in /etc/modules.conf and/or modprobe (I think placing this stuff in modprobe is wrong, but that is the way it is today).
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
In message <[email protected]> you write:
Quoted 6 lines
Quoted 3 lines · Rusty Russell
Well, "modprobe foo" will only give you the "
new_foo" driver if (1) the foo driver isn't found, and (2) the new driver author decides that it's a valid replacement.So the alias only works if the original isn't found?
It's defined to be that way for aliases taken from the modules themselves, for this very reason: the admin has no control over it.
It's undefined for the "in the config file case" (they curently *do* override, but that's an implementation detail). It'd be clearer to explicitly say "you can't override module names with "alias", use "install" instead, IMHO.
Quoted 4 lines
Weird... I'd just
rename the dang thing and get over it. A distribution kernel won't be able to use this anyway, as they'll either build both alternatives or just one of them and adjust configuration to match.
I'm not so sure. There have been several cases where a more than one driver supports the same card, but the old one is kept around "just in case". Backwards compatibility during such a transition would be really nice.
In most cases the admin, not the distribution, is the one setting the module options: losing them when you upgrade the kernel is not good.
Quoted 5 lines
Quoted 2 lines
Whether (2) is ever justified, I'm happy leaving to the individual author (I know, that makes me a wimp).
Don't trust authors too much when it comes to guessing at random individual installations... ;-)
Well, true, but if they don't, there's a deeper problem.
Quoted 8 lines
Quoted 4 lines
Consider another example: convenience aliases such as char-major-xxx. Now, I'm not convinced they're a great idea anyway, but if people are going to do this, I'd rather they did it in the kernel, rather than some random userspace program.
The module munging programs and their configuration are (logically) a part of the kernel (configuration). So this goes against the current wave of exporting as much as possible from the kernel.
Well, one major point of the module rewrite is that kernel internals belong in the kernel sources. If you disagree with that, we're probably not going to make progress.
Quoted 1 line
And IMHO it places policy into the kernel, where it has no place.
I try to avoid such fuzzy discussions, as they are rarely benificial.
I would point suggest that you grep for "request_module" in order to understand (1) where policy already is in the kernel, (2) why it is in the kernel, and (3) why this suggestion merely centralizes it.
Quoted 2 lines
Plus it enlarges modules, which is a consideration for installation/rescue media.
Now I think you're really grasping at straws, but you could always use "strip -R .modinfo" if you want to save ~20 bytes.
Quoted 2 lines
Maybe I'm just being a bit too conservative here. But I still think this is too dangerous for little (or even no) real gain.
Possibly. However I beg you to consider how you would introduce a new cypher into 2.6.3.
Quoted 3 lines
Could you please provide examples of use in generic, distribution kernels? Contrast with configuration in
/etc/modules.confand/or modprobe (I think placing this stuff in modprobe is wrong, but that is the way it is today).
Ignoring the hotplug stuff which is going to use it, consider adding a new binary format for XYZ3000 compatibility. For 2.4, you have to do:
1) Write the new binfmt_XYZ3000 module.
2) Write a patch to the modutils to place it in the built-in modules config. Keith's quite receptive with this.
3) Tell your users to upgrade modutils or place "alias binfmt-764 binfmt_XYZ3000" in their /etc/modules.conf (or /etc/modprobe.d/local for Debian).
For 2.5:
1) Write the new binfmt_XYZ3000 module.
2) Place MODULE_ALIAS("binfmt-764") at the bottom.
Hope that clarifies?
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Quoted 10 lines · Rusty Russell
In message <[email protected]> you write:
Quoted 6 lines
Quoted 3 lines · Rusty Russell
Well, "modprobe foo" will only give you the "
new_foo" driver if (1) the foo driver isn't found, and (2) the new driver author decides that it's a valid replacement.So the alias only works if the original isn't found?
It's defined to be that way for aliases taken from the modules themselves, for this very reason: the admin has no control over it.
That's exactly what bothers me. This gives several ways to go to the same place, and the rules of which one applies when _will_ confuse your friendy local BOFH (who does 237 other things besides messing with modules).
Quoted 4 lines
It's undefined for the "in the config file case" (they curently *do* override, but that's an implementation detail). It'd be clearer to explicitly say "you can't override module names with "alias", use "install" instead, IMHO.
Urgh. What is "alias" then for? It has been used for ages as a way of "call module foo by name bar, possibly with this further arguments". Why change that gratuitously?
Quoted 9 lines
Quoted 4 lines
Weird... I'd just
rename the dang thing and get over it. A distribution kernel won't be able to use this anyway, as they'll either build both alternatives or just one of them and adjust configuration to match.I'm not so sure. There have been several cases where a more than one driver supports the same card, but the old one is kept around "just in case". Backwards compatibility during such a transition would be really nice.
Yep. foo --> old-foo, (new) foo is ... foo! ;-)
Or just like today: foo stays foo, new foo is nfoo. When (if) nfoo ends up stable enough, and works everywhere, and can be taken as an all-around replacement for old foo, old foo gets the axe (eventually). AFAIR, there has never been a case of "new driver works everywhere, period" that was not just a replacement for the old one. If you have both around, you _don't_ want the driver author(s) deciding which one to call foo.. If there is just one, no problem.
Quoted 2 lines
In most cases the admin, not the dist ribution, is the one setting the module options: losing them when you upgrade the kernel is not good.
Exactly. The admin won't be messing around with MODULE_ALIAS macros for a random collection of modules everytime she downloads latest-n-greatest, but she will certainly check /etc/modules.conf (just as today); she won't want to recompile the distribution kernel just to fix wrong aliases. People backward compatibility and minimal upgrading pain (to get your random BOFH to recompile a kernel is _not_ trivial today!) is much more important than code backward compatibility, IMHO. [I'm speaking from the perspective of the user/sysadmin, _not_ the kernel hacker here].
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Whether (2) is ever justified, I'm happy leaving to the individual author (I know, that makes me a wimp).
Don't trust authors too much when it comes to guessing at random individual installations... ;-)
Well, true, but if they don't, there's a deeper problem.
Wellcome to the real world. There are literally thnousands of different configurations out there. I wouldn't dare cast any part of the configuration in binary for use everywhere.
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Consider another example: convenience aliases such as char-major-xxx. Now, I'm not convinced they're a great idea anyway, but if people are going to do this, I'd rather they did it in the kernel, rather than some random userspace program.
Quoted 7 lines
Quoted 3 lines
The module munging programs and their configuration are (logically) a part of the kernel (configuration). So this goes against the current wave of exporting as much as possible from the kernel.
Well, one major point of the module rewrite is that kernel internals belong in the kernel sources. If you disagree with that, we're probably not going to make progress.
Kernel internals yes; kernel configuration no. Several different ways of doing the same thing, with subtle overridings and invisible/out of reach parts is no-no-no in my book.
[...]
Quoted 5 lines
Quoted 2 lines
Maybe I'm just being a bit too conservative here. But I still think this is too dangerous for little (or even no) real gain.
Possibly. However I beg you to consider how you would introduce a new cypher into 2.6.3.
How were new cyphers added in 2.5.x recently? No need for strange aliases in-kernel, they get integrated via API. Outside the kernel, leave it to the sysadmin, explicitly. If such an addition is done, I'd want to control the use of the new cypher myself (because I don't upgrade all machines at the same time, whatever), not just getting it suddenly used everywhere when I mention "cypher", and I get to run around in circles trying to find out why shiny new A isn't talking to old B anymore.
Quoted 16 lines
Quoted 3 lines
Could you please provide examples of use in generic, distribution kernels? Contrast with configuration in
/etc/modules.confand/or modprobe (I think placing this stuff in modprobe is wrong, but that is the way it is today).Ignoring the hotplug stuff which is going to use it, consider adding a new binary format for XYZ3000 compatibility. For 2.4, you have to do:
1) Write the new
binfmt_XYZ3000module.2) Write a patch to the modutils to place it in the built-in modules config. Keith's quite receptive with this.
3) Tell your users to upgrade modutils or place "alias binfmt-764
binfmt_XYZ3000" in their/etc/modules.conf(or/etc/modprobe.d/localfor Debian).
Quoted 6 lines
For 2.5:
1) Write the newbinfmt_XYZ3000module.2) Place
MODULE_ALIAS("binfmt-764")at the bottom.Hope that clarifies?
Yep. But (a) How often does this happen? Which other areas could benefit?
(b) $BIG_DISTRIBUTION_VENDOR is quite capable of distributing /etc/modules.conf or modutils with the change; kernel hackers are used to this kind of change (no, I haven't seen Aunt Tillie lately).
Seems we will always disagree :(
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
Hi,
Quoted 5 lines · Horst von Brand
People
backward compatibility and minimal upgrading pain (to get your random BOFH to recompile a kernel is _not_ trivial today!) is much more important than code backward compatibility, IMHO. [I'm speaking from the perspective of the user/sysadmin, _not_ the kernel hacker here].
I can only agree and I hope more people realize the importance of this. My main problem with the module fiasco are the complete new user space tools. I urge anyone who only cares a little bit about modules to compare modules.conf(5) with modprobe.conf(5) and to tell me whether _all_ the removed options are really unnecessary? What happened to deprecating features _first_?
bye, Roman
In message <[email protected]> you write:
Quoted 8 lines
Quoted 4 lines
It's undefined for the "in the config file case" (they curently *do* override, but that's an implementation detail). It'd be clearer to explicitly say "you can't override module names with "alias", use "install" instead, IMHO.
Urgh. What is "alias" then for? It has been used for ages as a way of "call module foo by name bar, possibly with this further arguments". Why change that gratuitously?
I'm going to stop here, since I don't think you understand what I am proposing, nor how the current system works: this makes is extremely difficult to describe changes, and time consuming.
Sorry,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
PATCH 1/1 Restore module support.
Hi,
Quoted 3 lines · Rusty Russell
I'm going to stop here, since I don't think you understand what I am proposing, nor how the current system works: this makes is extremely difficult to describe changes, and time consuming.
Rusty, if you continue to ignore criticism, I have only one answer left:
http://www.xs4all.nl/~zippel/restore-modules-2.5.59.diff
These numbers are quite interesting:
$ diffstat restore-modules-2.5.59.diff arch/i386/kernel/Makefile | 1 arch/i386/kernel/cpu/mtrr/if.c | 1 arch/i386/kernel/entry.S | 6 arch/i386/kernel/module.c | 111 - arch/i386/mm/extable.c | 1 drivers/char/agp/Makefile | 2 drivers/char/misc.c | 1 drivers/eisa/eisa-bus.c | 1 drivers/input/serio/serport.c | 1 fs/filesystems.c | 27 fs/proc/proc_misc.c | 12 include/asm-generic/percpu.h | 1 include/asm-generic/vmlinux.lds.h | 15 include/asm-i386/module.h | 57 include/linux/init.h | 130 - include/linux/module.h | 817 ++++++------ include/linux/moduleloader.h | 43 include/linux/moduleparam.h | 126 - init/Kconfig | 40 init/main.c | 109 + kernel/Makefile | 8 kernel/extable.c | 41 kernel/intermodule.c | 182 -- kernel/kallsyms.c | 5 kernel/kmod.c | 2 kernel/ksyms.c | 7 kernel/module.c | 2448 +++++++++++++++++-------------------- kernel/params.c | 336 ----- net/ipv4/netfilter/ip_nat_helper.c | 2 scripts/Makefile.modinst | 8 sound/sound_core.c | 1 31 files changed, 1805 insertions(+), 2737 deletions(-)
$ size linux-2.5.59-org/vmlinux linux-2.5.59-mod/vmlinux text data bss dec hex filename 3403915 864229 338052 4606196 4648f4 linux-2.5.59-org/vmlinux 3361448 863393 342020 4566861 45af4d linux-2.5.59-mod/vmlinux
This patch still has modversion disabled, when Kai finishes the new modversion support, I'll add the support for it to modutils.
bye, Roman
Re: [PATCH] Restore module support.
Quoted 11 lines · Roman Zippel
Hi,
Quoted 3 lines · Rusty Russell
I'm going to stop here, since I don't think you understand what I am proposing, nor how the current system works: this makes is extremely difficult to describe changes, and time consuming.
Rusty, if you continue to ignore criticism, I have only one answer left:
But what are the modutils numbers? :)
Come on, what Rusty did was the "right thing to do" and has made life easier for all of the arch maintainers (or so says the ones that I've talked to), and has made my life easier with regards to MODULE_DEVICE_TABLE() logic, which will enable the /sbin/hotplug scripts/binary to shrink a _lot_.
thanks,
gre gk-h
Re: [PATCH] Restore module support.
Hi,
Quoted 1 line · Greg KH
But what are the modutils numbers? :)
There should be no real difference as I'd like to integrate Kai's patch too.
Quoted 5 lines
Come on, what Rusty did was the "right thing to do" and has made life easier for all of the arch maintainers (or so says the ones that I've talked to), and has made my life easier with regards to
MODULE_DEVICE_TABLE()logic, which will enable the/sbin/hotplugscripts/binaryto shrink a _lot_.
What was the "right thing to do"?
There were certainly a few interesting changes, but I'd like discuss them first. For example there is more than one solution to improve the MODULE_DEVICE_TABLE() logic (*), so how is Rusty's better?
bye, Roman
(*) http://marc.theaimsgroup.com/?l=linux-kernel&m=104405265719327&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=104437966220610&w=2
Re: [PATCH] Restore module support.
Quoted 7 lines · Roman Zippel
Hi,
Quoted 1 line · Greg KH
But what are the modutils numbers? :)
There should be no real difference as I'd like to integrate Kai's patch too.
Ok, I'm confused, you're advocating putting back the old modutils interface, but somehow not using the old modutils code? I don't understand.
Quoted 10 lines
Quoted 5 lines
Come on, what Rusty did was the "right thing to do" and has made life easier for all of the arch maintainers (or so says the ones that I've talked to), and has made my life easier with regards to
MODULE_DEVICE_TABLE()logic, which will enable the/sbin/hotplugscripts/binaryto shrink a _lot_.What was the "right thing to do"?
There were certainly a few interesting changes, but I'd like discuss them first. For example there is more than one solution to improve theMODULE_DEVICE_TABLE()logic (*), so how is Rusty's better?
Neither one of those proposals, no any others, were backed with working examples. Rusty had the only working example of getting rid of the userspace knowledge of the kernel data structures that I know of so far.
thanks,
greg k-h
Re: [PATCH] Restore module support.
Hi,
Quoted 5 lines · Greg KH
Quoted 1 line
There should be no real difference as I'd like to integrate Kai's patch too.
Ok, I'm confused, you're advocating putting back the old modutils interface, but somehow not using the old modutils code? I don't understand.
No, I'm advocating to break as little as possible. I'm certainly willing to port any interesting feature from Rusty's patches. If one feature requires changes to modutils, that's fine.
Quoted 3 lines
Neither one of those proposals, no any others, were backed with working examples. Rusty had the only working example of getting rid of the userspace knowledge of the kernel data structures that I know of so far.
1. In the past I posted enough example code, which was pretty much ignored, why should I think it would be any different this time?
2. Is hotplug that broken, that it wouldn't survive 2.6, so it required a complete new implementation? If that should be case I herewith volunteer to add module alias support to modutils.
bye, Roman
Re: [PATCH] Restore module support.
In reply to Greg KHHi,
Quoted 3 lines · Greg KH
Neither one of those proposals, no any others, were backed with working examples. Rusty had the only working example of getting rid of the userspace knowledge of the kernel data structures that I know of so far.
3. Somehow I hoped we could discuss this on a technical base, I didn't know we've reached already the "first post" level.
SCNR :)
bye, Roman
Re: [PATCH] Restore module support.
In reply to Greg KHQuoted 3 lines · Greg KH
Come on, what Rusty did was the "right thing to do" and has made life easier for all of the arch maintainers (or so says the ones that I've talked to)
And I'll promptly provide you with the other view. I'm still trying to sort out the best thing to do for ARM. We have the choice of:
1. load modules in the vmalloc region and build two jump tables, one for the init text and one for the core text.
2. fix vmalloc and /proc/kcore to be able to cope with a separate module region located below PAGE_OFFSET. Currently, neither play well with this option.
(1) has the advantage that it's all architecture code, its what we've done with the old modutils, and I've finally managed to implement it. However, it introduces an extra instruction and data cache line fetch to branches from modules into the kernel text.
(2) has the disadvantage that its touching non-architecture specific code, but this is the option I'd prefer due to the obvious performance advantage. However, I'm afraid that it isn't worth the effort to fix up vmalloc and /proc/kcore. vmalloc fix appears simple, but /proc/kcore has issues (anyone know what KCORE_BASE is all about?)
I've not made up my mind which option I'm going to take. If I don't get around to fixing /proc/kcore by this weekend, I'll probably just throw option (1) at Linus, which bring Linus' tree back to a buildable state for some ARM targets again.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Re: [PATCH] Restore module support.
In message <[email protected]> you write:
Quoted 5 lines
And I'll promptly provide you with the other view. I'm still trying to sort out the best thing to do for ARM. We have the choice of:
1. load modules in the vmalloc region and build two jump tables, one for the init text and one for the core text.
Yes. PPC and PPC64 have the same issues: currently this is done by
(1) putting nothing in the .init sections (on PPC64), and (2) with stubs when jumping outside the module code.
This gives the same effect as the previous userspace loader: for PPC64 noone cares about discarding init stuff, so it's firmly on the TODO list. ARM's priorities are obviously different.
Quoted 3 lines
2. fix vmalloc and
/proc/kcoreto be able to cope with a separate module region located belowPAGE_OFFSET. Currently, neither play well with this option.
x86_64 has this, as does sparc64: they do their own allocation. Does ARM require something special in this regard? I'd love to see what you've got...
Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Re: [PATCH] Restore module support.
Quoted 7 lines · Rusty Russell
Yes. PPC and PPC64 have the same issues: currently this is done by
(1) putting nothing in the .init sections (on PPC64), and (2) with stubs when jumping outside the module code.This gives the same effect as the previous userspace loader: for PPC64 noone cares about discarding init stuff, so it's firmly on the TODO list. ARM's priorities are obviously different.
As I say, I have this solution working, but its suboptimal, and I'll probably push this Linus-wards if I can't resolve (2) soon.
Quoted 7 lines
Quoted 3 lines
2. fix vmalloc and
/proc/kcoreto be able to cope with a separate module region located belowPAGE_OFFSET. Currently, neither play well with this option.
x86_64has this, as does sparc64: they do their own allocation. Does ARM require something special in this regard? I'd love to see what you've got...
There are two problems - one I mentioned during on LKML recently:
Message-ID: <[email protected]>
This seems simple to resolve. We just need to make get_vm_area() ignore mappings for invalid areas:
mm/vmalloc.c +2 -0
@@ -210,6 +210,8 @@write_lock (&vmlist_lock);for (p = &vmlist; (tmp = *p) ;p = &tmp->next) { +if (tmp->addr < addr) +continue ;if ((size + addr) < addr) goto out;if (size + addr <= (unsigned long )tmp->addr)
Since the vmlist is an ordered list, and we place the modules below VMALLOC_START, this change ensures that we will completely ignore any vmlist entries below the current minimum address (addr) we're looking for.
/proc/kcore currently assumes that:
1. all vmlist mappings are above PAGE_OFFSET.
2. all vmlist mappings are within VMALLOC_START to VMALLOC_END
Looking at fs/proc/kcore.c this morning, I have a couple of ideas to solve this problem. Patch will follow later today, hopefully without any ifdefs.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Re: [PATCH] Restore module support.
In reply to Russell KingQuoted 8 lines · Russell King
Quoted 3 lines · Greg KH
Come on, what Rusty did was the "right thing to do" and has made life easier for all of the arch maintainers (or so says the ones that I've talked to)
And I'll promptly provide you with the other view. I'm still trying to sort out the best thing to do for ARM. We have the choice of:
Quoted 6 lines
1. load modules in the vmalloc region and build two jump tables, one for the init text and one for the core text.
2. fix vmalloc and
/proc/kcoreto be able to cope with a separate module region located belowPAGE_OFFSET. Currently, neither play well with this option.
So you have the choice of either sticking to the solution which was previously used (only that it's now done in the kernel, not in modutils), or doing something new and more efficient.
Now, what's the reason you're not happy with that? You've got more flexibility than before, and you can even switch between different ways without having to teach an external package about it, so you avoid the compatibility issues when kernel and modutils are not in sync.
--Kai
Re: [PATCH] Restore module support.
Hi,
Quoted 3 lines · Kai Germaschewski
So you have the choice of either sticking to the solution which was previously used (only that it's now done in the kernel, not in modutils), or doing something new and more efficient.
Where is the problem to do the "new and more efficient" in modutils?
Quoted 4 lines
Now, what's the reason you're not happy with that? You've got more flexibility than before, and you can even switch between different ways without having to teach an external package about it, so you avoid the compatibility issues when kernel and modutils are not in sync.
Where is the problem with updating user space tools? We should certainly reduce dependencies, but moving everything into the kernel source can't be the answer either.
bye, Roman
Hi,
Quoted 10 lines
Quoted 4 lines
Consider another example: convenience aliases such as char-major-xxx. Now, I'm not convinced they're a great idea anyway, but if people are going to do this, I'd rather they did it in the kernel, rather than some random userspace program.
The module munging programs and their configuration are (logically) a part of the kernel (configuration). So this goes against the current wave of exporting as much as possible from the kernel. And IMHO it places policy into the kernel, where it has no place. Plus it enlarges modules, which is a consideration for installation/rescue media.
Maybe it helps to put this into a larger perspective, because you both have valid points.
Currently the kernel has two mechanisms to request a module (modprobe and hotplug) and these also have different ways to map the request to a module name. modprobe needs a hardcoded list of module names, so it e.g. knows that it should map net-pf-1 to unix. OTOH we generate such a mapping for hotplug, but here the mapping is very device specific and requires knowledge about kernel structures.
If module loading were the only problem, the alias mechanism would be a good solution. We could remove hotplug and let modprobe do the job. Unfortunately it's not that easy, as we might want to extend hotplug to a more generic event mechanism, which e.g. could be used to replace devfs. This means we not only have "load the driver for this new device on this bus" events, but also "generate the device nodes for this new driver" events. In this context the module alias encoding would be very limited. So what actually has to be discussed/decided, whether it's ok to special case module loading or if we want a generic kernel event mechanism, which can map any kind of event to some action. Until this isn't decided, it makes little sense to discuss details.
bye, Roman