Re: [PATCH kmod] libkmod: add user soft dependecies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 20, 2024 at 10:05:56AM +0100, Jose Ignacio Tornos Martinez wrote:
so it's basically a pre softdep, but without libkmod (userspace) trying
to load it before the module requested. So, it's "softer than soft" or
even "something before pre".

Thinking this way I find the name chosen odd, as the *user*space side of
module loading will actually *not* look into those deps.

Cc'ing some more people for suggestions, as I only know I don't like
"user", but my suggestions may considered equally bad too:

       dull / still / early / runtime_request / maybe
Ok, I thought of "user" because it was only going to be used by user
applications but it could have other interpretations.
Maybe another idea: "internal" to inform that there are dependencies and
these are going to be solved internally?

a night of sleep and I had a dream in which libkmod had the concept of
"weak dependency". Borrowing the concept from weak symbols, I think it
makes perfect sense... the symbol is there and it may or may not be used
by the linker at the end, but the symbol needs to be there until the
linking phase. At least the parallel makes sense in my head :)

Also, I don't think we should mix them with softdep like is done here
after a quick scan through the patch.

From man page:

       softdep modulename pre: modules... post: modules...
	   The softdep command allows you to specify soft, or optional,
	   module dependencies.  modulename can be used without these
	   optional modules installed, but usually with some features
	   missing. For example, a driver for a storage HBA might
	   require another module be loaded in order to use management
	   features.

	   pre-deps and post-deps modules are lists of names and/or
	   aliases of other modules that modprobe will attempt to
	   install (or remove) in order before and after the main module
	   given in the modulename argument.

	   Example: Assume "softdep c pre: a b post: d e" is provided in
	   the configuration. Running "modprobe c" is now equivalent to
	   "modprobe a b c d e" without the softdep. Flags such as
	   --use-blacklist are applied to all the specified modules,
	   while module parameters only apply to module c.

	   Note: if there are install or remove commands with the same
	   modulename argument, softdep takes precedence.

	weakdep modulename modules...
	   The weakdep command allows you to specify weak module
	   dependecies. Those are similar to pre softdep, with the
	   difference that userspace doesn't attempt to load that
	   dependency before the specified module. Instead the kernel
	   may request one or multiple of them during module probe,
	   depending on the hardware it's binding to. The purpose of
	   weak module is to allow a driver to specify that a certain
	   dependency may be needed, so it should be present in the
	   filesystem (e.g. in initramfs) when that module is probed.

	   Example: Assume "weakdep c a b". A program creating an
	   initramfs knows it should add a, b, and c to the filesystem
	   since a and b may be required/desired at runtime. When c is
	   loaded and is being probed, it may issue calls to
	   request_module() causing a or b to also be loaded.

Also instead of delegating this to the distros, it'd be good if we start
adding those to the ELF section of the modules with

	MODULE_WEAKDEP("...");

... to be defined in the kernel in a similar way that MODULE_SOFTDEP()
is.


Anyway, we will need to explain exactly what this is about in
modprobe.d(5).
Ok, I will complete it when the dependency name is decided.

Other than the use case of creating a initramfs and not
missing any module, I don't think there would be any, right?
Yes, my purpose is only that, I don't have detected any other case.


thanks
Lucas De Marchi


Thanks

Best regards
José Ignacio





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux