Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753095Ab3IJWtP (ORCPT ); Tue, 10 Sep 2013 18:49:15 -0400 Received: from mail-oa0-f49.google.com ([209.85.219.49]:55084 "EHLO mail-oa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470Ab3IJWtM (ORCPT ); Tue, 10 Sep 2013 18:49:12 -0400 MIME-Version: 1.0 In-Reply-To: References: From: Lucas De Marchi Date: Tue, 10 Sep 2013 19:48:52 -0300 Message-ID: Subject: Re: [PATCH] usb: ohci/uhci - add soft dependencies on ehci_hcd To: Tom Gundersen Cc: Alan Stern , linux-usb@vger.kernel.org, LKML , "linux-modules@vger.kernel.org" , Greg Kroah-Hartman Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3941 Lines: 95 On Tue, Sep 10, 2013 at 6:27 PM, Tom Gundersen wrote: > On Tue, Sep 10, 2013 at 7:31 PM, Alan Stern wrote: >> On Tue, 10 Sep 2013, Tom Gundersen wrote: >> >>> Hi Alan, >>> >>> On Tue, Sep 10, 2013 at 7:02 PM, Alan Stern wrote: >>> > On Tue, 10 Sep 2013, Tom Gundersen wrote: >>> > >>> >> Support for specifying soft dependencies in the modules themselves was >>> >> introduced in commit 7cb14ba. >>> >> >>> >> In Arch we have always been shipping a module.d(5) fragment ordering ohci/uhci >>> >> after ehci. If this ordering is really necessary, it would be great to move it >>> >> to the kernel and getting the correct fragment generated by depmod. >>> > >>> > The ordering is more of a recommendation than a necessity. Systems >>> > should work oksy if the modules are loaded in the wrong order. >>> > >>> > The only issue if the drivers are loaded in the wrong order is that >>> > full- and low-speed devices will end up being detected and enumerated >>> > twice, with a disconnection in between. This can result in >>> > disconcerting messages appearing in the system log. >>> > >>> > In theory, it is possible for a problem to arise. For example, suppose >>> > a full-speed flash drive is plugged in when the system starts up. >>> > When uhci-hcd or ohci-hcd gets loaded, the drive will be detected and >>> > it may even be mounted. Then when ehci-hcd loads, the drive will get >>> > disconnected and reconnected. Any open file references to the original >>> > mount will be orphaned. Then IMO it should not only be advised to have this dependency, but also require it. >>> >>> Thanks for the explanation. Sounds to me that a softdep is indeed appropriate: >>> >>> // >>> The softdep command allows you to specify soft, or optional, module >>> dependencies. modulename can be used without these optional modules Note that with this patch and another to kmod we are planning to change the behavior. It won't be optional anymore but required since depmod would then parse the modules.softdeps file and add them as dependencies automatically. >>> 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. >>> // >> >> So this means that before installing ohci-hcd, modprobe would attempt >> to install ehci-hcd? And if the attempt failed, it would go ahead and >> load ohci-hcd anyway? > > Exactly. Not really. If we try to load the module, but then fail we fail the operation altogether. Whereas if the module simply doesn't exist, then we carry on. In reality what we do is to assume the indexes and softdeps in configuration are correct) > >> What about during unloading? Would this mean that rmmod ohci-hcd would >> automatically cause ehci-hcd to be unloaded also? Or would unloading >> ehci-hcd cause ohci-hcd to be unloaded? > > No, unloading does not care about dependencies. modprobe -r will remove then as well, in the opposite order, i.e. post softdep, module, pre softdep. However this applies only to modprobe, not to the related function in libkmod since it would be weird to other programs using this library function. Try playing with this in /etc/modprobe.d/bla.conf (and replace echo with whatever unknown command to test a failure scenario): install bla echo install bla remove bla echo remove bla softdep sr_mod pre: bla Lucas De Marchi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/