linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] modules: add support for soft module dependencies
@ 2013-07-24  7:17 Herbert Xu
       [not found] ` <87siz38q2t.fsf@rustcorp.com.au>
  0 siblings, 1 reply; 10+ messages in thread
From: Herbert Xu @ 2013-07-24  7:17 UTC (permalink / raw)
  To: Andreas Robinson, Rusty Russell
  Cc: Linux Kernel Mailing List, Zhao Hongjiang, davem, tim.c.chen,
	Andrew Morton, gregkh@linuxfoundation.org, linux-crypto

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Hi Rusty:

I don't know why this patch never went into the kernel, even
though the corresponding features have been added to modprobe
in most if not all distros.

This is required for dependencies on crypto modules such as
crc32c where the dependency is only visible at run-time, which
means that depmod fails to list the necessary dependencies
causing modules to go missing in the initrd.

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: Type: message/rfc822, Size: 1034 bytes --]

From: Andreas Robinson <andr345@gmail.com>
Subject: [PATCH 1/2] modules: add support for soft module dependencies
Date: Thu, 5 Nov 2009 14:01:44 +0100

Additional and optional dependencies not found while building the kernel and
modules, can now be declared explicitly.

Signed-off-by: Andreas Robinson <andr345@gmail.com>
---
 include/linux/module.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 482efc8..0a97fe2 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -98,6 +98,11 @@ extern struct module __this_module;
 /* For userspace: you can also call me... */
 #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
 
+/* Soft module dependencies. See man modprobe.d for details.
+ * Example: MODULE_SOFTDEP("pre: module-foo post: module-bar")
+ */
+#define MODULE_SOFTDEP(_softdep) MODULE_INFO(softdep, _softdep)
+
 /*
  * The following license idents are currently accepted as indicating free
  * software modules
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
       [not found] ` <87siz38q2t.fsf@rustcorp.com.au>
@ 2013-07-25  2:03   ` Herbert Xu
  2013-09-10 14:01     ` Lucas De Marchi
  0 siblings, 1 reply; 10+ messages in thread
From: Herbert Xu @ 2013-07-25  2:03 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Andreas Robinson, Linux Kernel Mailing List, Zhao Hongjiang,
	davem, tim.c.chen, Andrew Morton, gregkh@linuxfoundation.org,
	linux-crypto

On Thu, Jul 25, 2013 at 09:32:02AM +0930, Rusty Russell wrote:
> Herbert Xu <herbert@gondor.apana.org.au> writes:
> > Hi Rusty:
> >
> > I don't know why this patch never went into the kernel, even
> > though the corresponding features have been added to modprobe
> > in most if not all distros.
> 
> Because Andreas never sent me the patch?  This is the first I've *heard*
> of this feature.  Looks like it didn't hit lkml either.  And what was
> 2/2?

2/2 was the patch to actually use this in crc32c.

> It's not how I would have done this: post-deps are more flexibly done at
> runtime, because the module may have to do work to figure out what to
> pull in.  But since it already exists, I'll apply this patch: it doesn't
> cost the kernel anything.
> 
> And I've fixed the example, so we know how to list multiple modules!

Thanks!
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-07-25  2:03   ` Herbert Xu
@ 2013-09-10 14:01     ` Lucas De Marchi
  2013-09-10 14:18       ` Tom Gundersen
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Lucas De Marchi @ 2013-09-10 14:01 UTC (permalink / raw)
  To: Herbert Xu
  Cc: Rusty Russell, Andreas Robinson, Linux Kernel Mailing List,
	Zhao Hongjiang, David Miller, tim.c.chen, Andrew Morton,
	gregkh@linuxfoundation.org, linux-crypto, linux-modules,
	Tom Gundersen

On Wed, Jul 24, 2013 at 11:03 PM, Herbert Xu
<herbert@gondor.apana.org.au> wrote:
> On Thu, Jul 25, 2013 at 09:32:02AM +0930, Rusty Russell wrote:
>> Herbert Xu <herbert@gondor.apana.org.au> writes:
>> > Hi Rusty:
>> >
>> > I don't know why this patch never went into the kernel, even
>> > though the corresponding features have been added to modprobe
>> > in most if not all distros.
>>
>> Because Andreas never sent me the patch?  This is the first I've *heard*
>> of this feature.  Looks like it didn't hit lkml either.  And what was
>> 2/2?
>
> 2/2 was the patch to actually use this in crc32c.
>
>> It's not how I would have done this: post-deps are more flexibly done at
>> runtime, because the module may have to do work to figure out what to
>> pull in.  But since it already exists, I'll apply this patch: it doesn't
>> cost the kernel anything.

But it did cause boot failures. The file modules.softdep file was
supposed to be informational until now. That's why depmod put a
comment saying to "copy on user's discretion to /etc/modules.d"
instead of parsing it directly.

If dependencies expressed with softdeps can be required dependencies
now, depmod needs to be updated to work it out otherwise we will get
missing dependencies as happened with the crypto stuff after this
patch. I'm CC'ing Tom who had the boot failure; it looks like the same
boot failure that caused this feature to get reverted the first time
(the deps being required by sd_mod).

Even if it is an optional module, it would be great to have depmod
updated so it parses the file directly now that we are exporting this
info. I can do that once we agree what we want to do with softdeps
coming directly from kernel itself.

However looking at the only user right now, crct10dif: couldn't we
detect at runtime if this module can be used instead of just trying to
load it as a pre softdep and possibly failing?


Lucas De Marchi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-09-10 14:01     ` Lucas De Marchi
@ 2013-09-10 14:18       ` Tom Gundersen
  2013-09-11  4:40       ` Herbert Xu
  2013-09-13  0:07       ` Rusty Russell
  2 siblings, 0 replies; 10+ messages in thread
From: Tom Gundersen @ 2013-09-10 14:18 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Herbert Xu, Rusty Russell, Andreas Robinson,
	Linux Kernel Mailing List, Zhao Hongjiang, David Miller,
	tim.c.chen, Andrew Morton, gregkh@linuxfoundation.org,
	linux-crypto, linux-modules

On Tue, Sep 10, 2013 at 4:01 PM, Lucas De Marchi
<lucas.de.marchi@gmail.com> wrote:
> On Wed, Jul 24, 2013 at 11:03 PM, Herbert Xu
> <herbert@gondor.apana.org.au> wrote:
>> On Thu, Jul 25, 2013 at 09:32:02AM +0930, Rusty Russell wrote:
>>> Herbert Xu <herbert@gondor.apana.org.au> writes:
>>> > Hi Rusty:
>>> >
>>> > I don't know why this patch never went into the kernel, even
>>> > though the corresponding features have been added to modprobe
>>> > in most if not all distros.
>>>
>>> Because Andreas never sent me the patch?  This is the first I've *heard*
>>> of this feature.  Looks like it didn't hit lkml either.  And what was
>>> 2/2?
>>
>> 2/2 was the patch to actually use this in crc32c.
>>
>>> It's not how I would have done this: post-deps are more flexibly done at
>>> runtime, because the module may have to do work to figure out what to
>>> pull in.  But since it already exists, I'll apply this patch: it doesn't
>>> cost the kernel anything.
>
> But it did cause boot failures. The file modules.softdep file was
> supposed to be informational until now. That's why depmod put a
> comment saying to "copy on user's discretion to /etc/modules.d"
> instead of parsing it directly.
>
> If dependencies expressed with softdeps can be required dependencies
> now, depmod needs to be updated to work it out otherwise we will get
> missing dependencies as happened with the crypto stuff after this
> patch. I'm CC'ing Tom who had the boot failure; it looks like the same
> boot failure that caused this feature to get reverted the first time
> (the deps being required by sd_mod).

For the record: what happened was that I didn't get the "softdep'ed"
modules  in my initrd and when trying to modprobe sd_mod in the initrd
I got an error message about missing symbols (I forget the precise
wording). We cold certainly fix the initrd generation to include the
softdep modules, but it seems unexpected that missing softdeps should
cause failures like this.

> Even if it is an optional module, it would be great to have depmod
> updated so it parses the file directly now that we are exporting this
> info. I can do that once we agree what we want to do with softdeps
> coming directly from kernel itself.

I just submitted a patch to do this, I think it is much more useful
than expecting the packager/admin to copy modules.softdep to the
correct location.

> However looking at the only user right now, crct10dif: couldn't we
> detect at runtime if this module can be used instead of just trying to
> load it as a pre softdep and possibly failing?

Having softdeps statically specified is useful for inird generation.
Even if it turns out that the modules are truly optional, having the
possibility of automatically including all optional modules would
surely be useful.

Cheers,

Tom

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-09-10 14:01     ` Lucas De Marchi
  2013-09-10 14:18       ` Tom Gundersen
@ 2013-09-11  4:40       ` Herbert Xu
  2013-09-13  0:07       ` Rusty Russell
  2 siblings, 0 replies; 10+ messages in thread
From: Herbert Xu @ 2013-09-11  4:40 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Rusty Russell, Andreas Robinson, Linux Kernel Mailing List,
	Zhao Hongjiang, David Miller, tim.c.chen, Andrew Morton,
	gregkh@linuxfoundation.org, linux-crypto, linux-modules,
	Tom Gundersen

On Tue, Sep 10, 2013 at 11:01:38AM -0300, Lucas De Marchi wrote:
>
> However looking at the only user right now, crct10dif: couldn't we
> detect at runtime if this module can be used instead of just trying to
> load it as a pre softdep and possibly failing?

No as sd_mod requires crct10dif to be present.  The use of softdep
as opposed to just a symbolic dependency is due to there being two
modules for crct10dif, a generic version and an arch-specific one.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-09-10 14:01     ` Lucas De Marchi
  2013-09-10 14:18       ` Tom Gundersen
  2013-09-11  4:40       ` Herbert Xu
@ 2013-09-13  0:07       ` Rusty Russell
  2013-09-17 22:27         ` Lucas De Marchi
  2 siblings, 1 reply; 10+ messages in thread
From: Rusty Russell @ 2013-09-13  0:07 UTC (permalink / raw)
  To: Lucas De Marchi, Herbert Xu
  Cc: Andreas Robinson, Linux Kernel Mailing List, Zhao Hongjiang,
	David Miller, tim.c.chen, Andrew Morton,
	gregkh@linuxfoundation.org, linux-crypto, linux-modules,
	Tom Gundersen

Lucas De Marchi <lucas.de.marchi@gmail.com> writes:
> On Wed, Jul 24, 2013 at 11:03 PM, Herbert Xu
> <herbert@gondor.apana.org.au> wrote:
>> On Thu, Jul 25, 2013 at 09:32:02AM +0930, Rusty Russell wrote:
>>> Herbert Xu <herbert@gondor.apana.org.au> writes:
>>> > Hi Rusty:
>>> >
>>> > I don't know why this patch never went into the kernel, even
>>> > though the corresponding features have been added to modprobe
>>> > in most if not all distros.
>>>
>>> Because Andreas never sent me the patch?  This is the first I've *heard*
>>> of this feature.  Looks like it didn't hit lkml either.  And what was
>>> 2/2?
>>
>> 2/2 was the patch to actually use this in crc32c.
>>
>>> It's not how I would have done this: post-deps are more flexibly done at
>>> runtime, because the module may have to do work to figure out what to
>>> pull in.  But since it already exists, I'll apply this patch: it doesn't
>>> cost the kernel anything.
>
> But it did cause boot failures. The file modules.softdep file was
> supposed to be informational until now. That's why depmod put a
> comment saying to "copy on user's discretion to /etc/modules.d"
> instead of parsing it directly.

I'm happy to change this macro to create a modinfo line like
"softdep:<modname>"

ie. tools like mkinitrd could pick it up and try to find a matching
module, but depmod would ignore it.

It's really up to Lucas, since this affects him.

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-09-13  0:07       ` Rusty Russell
@ 2013-09-17 22:27         ` Lucas De Marchi
  2013-09-18  2:10           ` Rusty Russell
  0 siblings, 1 reply; 10+ messages in thread
From: Lucas De Marchi @ 2013-09-17 22:27 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Herbert Xu, Andreas Robinson, Linux Kernel Mailing List,
	Zhao Hongjiang, David Miller, tim.c.chen, Andrew Morton,
	gregkh@linuxfoundation.org, linux-crypto, linux-modules,
	Tom Gundersen

On Thu, Sep 12, 2013 at 9:07 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> Lucas De Marchi <lucas.de.marchi@gmail.com> writes:
>> On Wed, Jul 24, 2013 at 11:03 PM, Herbert Xu
>> <herbert@gondor.apana.org.au> wrote:
>>> On Thu, Jul 25, 2013 at 09:32:02AM +0930, Rusty Russell wrote:
>>>> Herbert Xu <herbert@gondor.apana.org.au> writes:
>>>> > Hi Rusty:
>>>> >
>>>> > I don't know why this patch never went into the kernel, even
>>>> > though the corresponding features have been added to modprobe
>>>> > in most if not all distros.
>>>>
>>>> Because Andreas never sent me the patch?  This is the first I've *heard*
>>>> of this feature.  Looks like it didn't hit lkml either.  And what was
>>>> 2/2?
>>>
>>> 2/2 was the patch to actually use this in crc32c.
>>>
>>>> It's not how I would have done this: post-deps are more flexibly done at
>>>> runtime, because the module may have to do work to figure out what to
>>>> pull in.  But since it already exists, I'll apply this patch: it doesn't
>>>> cost the kernel anything.
>>
>> But it did cause boot failures. The file modules.softdep file was
>> supposed to be informational until now. That's why depmod put a
>> comment saying to "copy on user's discretion to /etc/modules.d"
>> instead of parsing it directly.
>
> I'm happy to change this macro to create a modinfo line like
> "softdep:<modname>"

how is that solving the issue that this macro can be used to designate
a mandatory or optional dependency
(https://lkml.org/lkml/2013/9/10/371)? If we decide the dependency is
mandatory we can very well let modprobe use that dependency during
module load

>
> ie. tools like mkinitrd could pick it up and try to find a matching
> module, but depmod would ignore it.

Some mkinitrd-like use whatever depmod/modprobe tells them it's
needed. So kmod still needs to know about it.


>
> It's really up to Lucas, since this affects him.

IMO  saying "this is an optional dependency and we can work without"
doesn't buy us much. Distros will end up putting the soft dep in
/etc/modules.d, kmod will always use them anyway and failing to load
the soft dep will fail the module load. I'd like to have no distro
files in /etc/modules.d in future.


Lucas De Marchi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-09-17 22:27         ` Lucas De Marchi
@ 2013-09-18  2:10           ` Rusty Russell
  2013-09-18  5:32             ` Lucas De Marchi
  0 siblings, 1 reply; 10+ messages in thread
From: Rusty Russell @ 2013-09-18  2:10 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Herbert Xu, Andreas Robinson, Linux Kernel Mailing List,
	Zhao Hongjiang, David Miller, tim.c.chen, Andrew Morton,
	gregkh@linuxfoundation.org, linux-crypto, linux-modules,
	Tom Gundersen

Lucas De Marchi <lucas.de.marchi@gmail.com> writes:
> On Thu, Sep 12, 2013 at 9:07 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
>> Lucas De Marchi <lucas.de.marchi@gmail.com> writes:
>>> On Wed, Jul 24, 2013 at 11:03 PM, Herbert Xu
>>> <herbert@gondor.apana.org.au> wrote:
>>>> On Thu, Jul 25, 2013 at 09:32:02AM +0930, Rusty Russell wrote:
>>>>> Herbert Xu <herbert@gondor.apana.org.au> writes:
>>>>> > Hi Rusty:
>>>>> >
>>>>> > I don't know why this patch never went into the kernel, even
>>>>> > though the corresponding features have been added to modprobe
>>>>> > in most if not all distros.
>>>>>
>>>>> Because Andreas never sent me the patch?  This is the first I've *heard*
>>>>> of this feature.  Looks like it didn't hit lkml either.  And what was
>>>>> 2/2?
>>>>
>>>> 2/2 was the patch to actually use this in crc32c.
>>>>
>>>>> It's not how I would have done this: post-deps are more flexibly done at
>>>>> runtime, because the module may have to do work to figure out what to
>>>>> pull in.  But since it already exists, I'll apply this patch: it doesn't
>>>>> cost the kernel anything.
>>>
>>> But it did cause boot failures. The file modules.softdep file was
>>> supposed to be informational until now. That's why depmod put a
>>> comment saying to "copy on user's discretion to /etc/modules.d"
>>> instead of parsing it directly.
>>
>> I'm happy to change this macro to create a modinfo line like
>> "softdep:<modname>"
>
> how is that solving the issue that this macro can be used to designate
> a mandatory or optional dependency
> (https://lkml.org/lkml/2013/9/10/371)? If we decide the dependency is
> mandatory we can very well let modprobe use that dependency during
> module load

I'm very close to sending Linus a revert commit at this point, since
there's no consensus on what it's for.

*Clearly* softdep shouldn't indicate a mandatory dependency.  We already
have a way (several) to make mandatory dependencies!

And the "pre:" vs "post:" thing is just weird.  If a module wants a post
dependency, you can request_module() it from a workqueue.

>> ie. tools like mkinitrd could pick it up and try to find a matching
>> module, but depmod would ignore it.
>
> Some mkinitrd-like use whatever depmod/modprobe tells them it's
> needed. So kmod still needs to know about it.

It sounds like we should create a separate tool, which takes a list of
modules and spits out the full pathname of all dependencies.  *That*
tool should include soft dependencies.

>> It's really up to Lucas, since this affects him.
>
> IMO  saying "this is an optional dependency and we can work without"
> doesn't buy us much. Distros will end up putting the soft dep in
> /etc/modules.d, kmod will always use them anyway and failing to load
> the soft dep will fail the module load. I'd like to have no distro
> files in /etc/modules.d in future.

I assumed modprobe would handle soft dependencies in modules and try to
pull them in, but *not* fail if they don't work.

The previous way of doing this was:
        install foo modprobe foo_softdep 2>/dev/null; modprobe --ignore-install foo $CMDLINE_OPTS

I agree this logic belongs in the kernel, we just have to figure out
exactly how.

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-09-18  2:10           ` Rusty Russell
@ 2013-09-18  5:32             ` Lucas De Marchi
  2013-09-18  7:17               ` Rusty Russell
  0 siblings, 1 reply; 10+ messages in thread
From: Lucas De Marchi @ 2013-09-18  5:32 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Lucas De Marchi, Herbert Xu, Andreas Robinson,
	Linux Kernel Mailing List, Zhao Hongjiang, David Miller,
	tim.c.chen, Andrew Morton, gregkh@linuxfoundation.org,
	linux-crypto, linux-modules, Tom Gundersen

On Tue, Sep 17, 2013 at 11:10 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> Lucas De Marchi <lucas.de.marchi@gmail.com> writes:
>> On Thu, Sep 12, 2013 at 9:07 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
>>> Lucas De Marchi <lucas.de.marchi@gmail.com> writes:
>>>> On Wed, Jul 24, 2013 at 11:03 PM, Herbert Xu
>>>> <herbert@gondor.apana.org.au> wrote:
>>>>> On Thu, Jul 25, 2013 at 09:32:02AM +0930, Rusty Russell wrote:
>>>>>> Herbert Xu <herbert@gondor.apana.org.au> writes:
>>>>>> > Hi Rusty:
>>>>>> >
>>>>>> > I don't know why this patch never went into the kernel, even
>>>>>> > though the corresponding features have been added to modprobe
>>>>>> > in most if not all distros.
>>>>>>
>>>>>> Because Andreas never sent me the patch?  This is the first I've *heard*
>>>>>> of this feature.  Looks like it didn't hit lkml either.  And what was
>>>>>> 2/2?
>>>>>
>>>>> 2/2 was the patch to actually use this in crc32c.
>>>>>
>>>>>> It's not how I would have done this: post-deps are more flexibly done at
>>>>>> runtime, because the module may have to do work to figure out what to
>>>>>> pull in.  But since it already exists, I'll apply this patch: it doesn't
>>>>>> cost the kernel anything.
>>>>
>>>> But it did cause boot failures. The file modules.softdep file was
>>>> supposed to be informational until now. That's why depmod put a
>>>> comment saying to "copy on user's discretion to /etc/modules.d"
>>>> instead of parsing it directly.
>>>
>>> I'm happy to change this macro to create a modinfo line like
>>> "softdep:<modname>"
>>
>> how is that solving the issue that this macro can be used to designate
>> a mandatory or optional dependency
>> (https://lkml.org/lkml/2013/9/10/371)? If we decide the dependency is
>> mandatory we can very well let modprobe use that dependency during
>> module load
>
> I'm very close to sending Linus a revert commit at this point, since
> there's no consensus on what it's for.
>
> *Clearly* softdep shouldn't indicate a mandatory dependency.  We already
> have a way (several) to make mandatory dependencies!
>
> And the "pre:" vs "post:" thing is just weird.  If a module wants a post
> dependency, you can request_module() it from a workqueue.
>
>>> ie. tools like mkinitrd could pick it up and try to find a matching
>>> module, but depmod would ignore it.
>>
>> Some mkinitrd-like use whatever depmod/modprobe tells them it's
>> needed. So kmod still needs to know about it.
>
> It sounds like we should create a separate tool, which takes a list of
> modules and spits out the full pathname of all dependencies.  *That*
> tool should include soft dependencies.
>
>>> It's really up to Lucas, since this affects him.
>>
>> IMO  saying "this is an optional dependency and we can work without"
>> doesn't buy us much. Distros will end up putting the soft dep in
>> /etc/modules.d, kmod will always use them anyway and failing to load
>> the soft dep will fail the module load. I'd like to have no distro
>> files in /etc/modules.d in future.
>
> I assumed modprobe would handle soft dependencies in modules and try to
> pull them in, but *not* fail if they don't work.

Iff the module doesn't *exist*. If it failed to load or failed for any
other reason then we will abort trying to load the other module.
However this is one thing we can change in modprobe to make it
consistent and more predictable. But we really need to reach a
consensus.

>
> The previous way of doing this was:
>         install foo modprobe foo_softdep 2>/dev/null; modprobe --ignore-install foo $CMDLINE_OPTS

I just hope this is in no way an incentive for people using install commands ;-)


Lucas De Marchi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] modules: add support for soft module dependencies
  2013-09-18  5:32             ` Lucas De Marchi
@ 2013-09-18  7:17               ` Rusty Russell
  0 siblings, 0 replies; 10+ messages in thread
From: Rusty Russell @ 2013-09-18  7:17 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Lucas De Marchi, Herbert Xu, Andreas Robinson,
	Linux Kernel Mailing List, Zhao Hongjiang, David Miller,
	tim.c.chen, Andrew Morton, gregkh@linuxfoundation.org,
	linux-crypto, linux-modules, Tom Gundersen

Lucas De Marchi <lucas.demarchi@profusion.mobi> writes:
> On Tue, Sep 17, 2013 at 11:10 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
>> Lucas De Marchi <lucas.de.marchi@gmail.com> writes:
>>> On Thu, Sep 12, 2013 at 9:07 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
>>>> I'm happy to change this macro to create a modinfo line like
>>>> "softdep:<modname>"
>>>
>>> how is that solving the issue that this macro can be used to designate
>>> a mandatory or optional dependency
>>> (https://lkml.org/lkml/2013/9/10/371)? If we decide the dependency is
>>> mandatory we can very well let modprobe use that dependency during
>>> module load
>>
>> I'm very close to sending Linus a revert commit at this point, since
>> there's no consensus on what it's for.
>>
>> *Clearly* softdep shouldn't indicate a mandatory dependency.  We already
>> have a way (several) to make mandatory dependencies!
>>
>> And the "pre:" vs "post:" thing is just weird.  If a module wants a post
>> dependency, you can request_module() it from a workqueue.
>>
>>>> ie. tools like mkinitrd could pick it up and try to find a matching
>>>> module, but depmod would ignore it.
>>>
>>> Some mkinitrd-like use whatever depmod/modprobe tells them it's
>>> needed. So kmod still needs to know about it.
>>
>> It sounds like we should create a separate tool, which takes a list of
>> modules and spits out the full pathname of all dependencies.  *That*
>> tool should include soft dependencies.
>>
>>>> It's really up to Lucas, since this affects him.
>>>
>>> IMO  saying "this is an optional dependency and we can work without"
>>> doesn't buy us much. Distros will end up putting the soft dep in
>>> /etc/modules.d, kmod will always use them anyway and failing to load
>>> the soft dep will fail the module load. I'd like to have no distro
>>> files in /etc/modules.d in future.
>>
>> I assumed modprobe would handle soft dependencies in modules and try to
>> pull them in, but *not* fail if they don't work.
>
> Iff the module doesn't *exist*. If it failed to load or failed for any
> other reason then we will abort trying to load the other module.
> However this is one thing we can change in modprobe to make it
> consistent and more predictable. But we really need to reach a
> consensus.

It is a bit of a corner case, but there are other conceivable reasons
why a module wouldn't load.  The hardware it wants might not be present,
or busy, or it conflicts with an existing module, or needs user
configuration (eg. commandline params).

It might be worth reporting, but I wouldn't stop loading on softdep fails.

>> The previous way of doing this was:
>>         install foo modprobe foo_softdep 2>/dev/null; modprobe --ignore-install foo $CMDLINE_OPTS
>
> I just hope this is in no way an incentive for people using install commands ;-)

Agreed.  install commands were implemented because I had no idea what
people wanted to do in future.  They definitely provide enough rope...

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-09-18  7:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-24  7:17 [PATCH] modules: add support for soft module dependencies Herbert Xu
     [not found] ` <87siz38q2t.fsf@rustcorp.com.au>
2013-07-25  2:03   ` Herbert Xu
2013-09-10 14:01     ` Lucas De Marchi
2013-09-10 14:18       ` Tom Gundersen
2013-09-11  4:40       ` Herbert Xu
2013-09-13  0:07       ` Rusty Russell
2013-09-17 22:27         ` Lucas De Marchi
2013-09-18  2:10           ` Rusty Russell
2013-09-18  5:32             ` Lucas De Marchi
2013-09-18  7:17               ` Rusty Russell

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).