From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
To: lucas.demarchi@intel.com
Cc: emil.velikov@collabora.com, gustavo.sousa@intel.com,
jtornosm@redhat.com, linux-modules@vger.kernel.org,
mcgrof@kernel.org, md@linux.it
Subject: Re: [PATCH kmod] libkmod: add user soft dependecies
Date: Wed, 20 Mar 2024 15:48:01 +0100 [thread overview]
Message-ID: <20240320144802.62801-1-jtornosm@redhat.com> (raw)
In-Reply-To: <7vowjj4oo64a2vquvqaszmzcdvbrlkntcze2btnogvkwwtuddv@uz72wpi2t55s>
> 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 :)
Ok, I like your dream :)
> Also, I don't think we should mix them with softdep like is done here
> after a quick scan through the patch.
Ok, understood, and if a new case for softdep is not going to be used,
it is clearer: better not mixing with softdep processing.
> 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.
Ok, thanks for completing this.
I will include this in my kmod patch (if it is ok for you).
> 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.
Agree, better to define in kernel code, that's the reason for the patch.
Ok, I will implement in that way and I will create a kernel patch too for
this.
Indeed (with a different name), it was also in my mind but I didn't dare to
create something "new".
Thanks for you comments and help
Best regards
José Ignacio
next prev parent reply other threads:[~2024-03-20 14:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 16:15 [PATCH kmod] libkmod: add user soft dependecies Jose Ignacio Tornos Martinez
2024-03-20 7:16 ` Lucas De Marchi
2024-03-20 9:05 ` Jose Ignacio Tornos Martinez
2024-03-20 13:57 ` Lucas De Marchi
2024-03-20 14:48 ` Jose Ignacio Tornos Martinez [this message]
2024-03-27 14:11 ` [PATCH v2 patch] libkmod: add weak dependecies Jose Ignacio Tornos Martinez
2024-04-09 15:10 ` Lucas De Marchi
2024-04-09 15:50 ` Jose Ignacio Tornos Martinez
2024-05-06 12:36 ` Jose Ignacio Tornos Martinez
2024-05-09 4:22 ` Lucas De Marchi
2024-05-09 4:41 ` Lucas De Marchi
2024-05-09 9:57 ` Jose Ignacio Tornos Martinez
2024-03-27 14:13 ` [PATCH v2 kmod] " Jose Ignacio Tornos Martinez
2024-03-27 14:18 ` [PATCH] module: create " Jose Ignacio Tornos Martinez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240320144802.62801-1-jtornosm@redhat.com \
--to=jtornosm@redhat.com \
--cc=emil.velikov@collabora.com \
--cc=gustavo.sousa@intel.com \
--cc=linux-modules@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=mcgrof@kernel.org \
--cc=md@linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).