linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@bytesex.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Gerd Knorr <kraxel@suse.de>, Takashi Iwai <tiwai@suse.de>,
	"Alexander E. Patrakov" <patrakov@ums.usu.ru>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: modprobe + request_module() deadlock
Date: Mon, 22 Nov 2004 11:25:02 +0100	[thread overview]
Message-ID: <20041122102502.GF29305@bytesex> (raw)
In-Reply-To: <1101026370.18919.32.camel@localhost.localdomain>

> > > 	MODULE_DEPENDS_ON("somemodule");
> > 
> > On the other hand I don't depend on request_module() waiting for the
> > modprobe being finished.  So maybe we can solve that with a
> > request_module_async()?
> 
> The problem is fairly simple: we don't let you get at the symbols from a
> module which hasn't finished initializing yet.  This means that a
> request_module() inside a module's init() will fail if the requested
> module depends on this one.  async() will race with init() finishing, so
> won't really help.

Hmm, so module loading is not serialized by a lock?  I assumed that
caused the deadlock in $subject which started this thread ...

> The traditional way to do this has been to have saa7134-empress do its
> own probe, and likewise saa7134-dvb.

They can't actually probe themself.  It's _one_ PCI device (driven by
the saa7134 module) which can handle (among other v4l-related things)
the DMA transfer of mpeg streams.  That can be used in different ways
(or not at all) and the different use cases are handled by the
sub-modules.

So the way it is intended to work is that saa7134 has the pci table and
gets autoloaded by hotplug, it will have a look at the hardware and then
load either saa7134-empress or saa7134-dvb or none of them, so you'll
get everything nicely autoloaded.

> Unfortunately, these days modules are not supposed to fail to load
> simply because there are no devices, so wild module loading has a real
> cost.

Yes, thats exactly the problem.  And this is especially true for the
saa7134-dvb module as this one has a bunch of dependencies to other
modules of the dvb subsystem.  Thats why I try to avoid loading them
if they are not needed.

> Otherwise I'd be tempted to make multiple aliases load *all* of them,
> and solve the problem that way.

Well, that will actually work.  You can simply load both saa7134-empress
and saa7134-dvb, the saa7134 core module will take care that they can
only attach to devices they can actually handle.  Drawback is the memory
footprint ...

  Gerd

-- 
#define printk(args...) fprintf(stderr, ## args)

  reply	other threads:[~2004-11-22 10:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 22:29 modprobe + request_module() deadlock Johannes Stezenbach
2004-11-18  3:48 ` Rusty Russell
2004-11-18 13:55   ` Johannes Stezenbach
2004-11-18 19:05     ` Takashi Iwai
2004-11-19  4:04       ` Alexander E. Patrakov
2004-11-19 11:10         ` Takashi Iwai
2004-11-19 11:50           ` Gerd Knorr
2004-11-19 12:42             ` Alexander E. Patrakov
2004-11-21  8:39             ` Rusty Russell
2004-11-22 10:25               ` Gerd Knorr [this message]
2004-11-22 14:16                 ` Johannes Stezenbach
2004-11-22 14:44                   ` Gerd Knorr
2004-11-22 15:36                     ` Johannes Stezenbach
2004-11-22 16:52                       ` Gerd Knorr
2004-11-24  5:02                         ` Rusty Russell
2004-11-24 12:11                           ` Gerd Knorr
2004-11-25 16:03                           ` Gerd Knorr
2004-11-26  0:34                             ` Rusty Russell

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=20041122102502.GF29305@bytesex \
    --to=kraxel@bytesex.org \
    --cc=kraxel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrakov@ums.usu.ru \
    --cc=rusty@rustcorp.com.au \
    --cc=tiwai@suse.de \
    /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).