mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Linus Torvalds <torvalds@osdl.org>
Cc: James Courtier-Dutton <James@superbug.co.uk>,
	Adrian Bunk <bunk@stusta.de>, Sergey Vlasov <vsu@altlinux.ru>,
	Ricardo Cerqueira <v4l@cerqueira.org>,
	mchehab@brturbo.com.br,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	video4linux-list@redhat.com, perex@suse.cz,
	alsa-devel@alsa-project.org
Subject: Re: [Alsa-devel] 2.6.15-rc6: boot failure in saa7134-alsa.c
Date: Wed, 21 Dec 2005 15:39:37 +0100	[thread overview]
Message-ID: <s5hpsnqzf86.wl%tiwai@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0512201248481.4827@g5.osdl.org>

At Tue, 20 Dec 2005 13:03:10 -0800 (PST),
Linus Torvalds wrote:
> 
> 
> 
> On Tue, 20 Dec 2005, James Courtier-Dutton wrote:
> >
> > They all load in the correct order if they are modules. The problem comes when
> > one compiles them into the kernel. They then load in the wrong order and bad
> > things happen, resulting in the recommendation that alsa should always be
> > modules.
> 
> Which, as a recommendation, is pure and utter crap.
> 
> > In this basis, we should not have to change the code in alsa at all, but
> > instead change the kernel to understand the load order, even if compiled into
> > the kernel and not as modules.
> 
> NO.
> 
> The kernel does support this (and has supported for a long time).
> 
> First off, load order matters, even in the kernel. Within one "class" of 
> initializers, you can just specify the right order in the Makefile, and it 
> will honor them. Of course, that ends up often being hard to do across 
> different directories, which is why there's another facility:
> 
> The kernel has several different classes of ordering. Anybody who thinks 
> that "module_init()" is it, just hasn't looked at <linux/init.h>. There's 
> seven different levels:
> 
> 	#define core_initcall(fn)               __define_initcall("1",fn)
> 	#define postcore_initcall(fn)           __define_initcall("2",fn)
> 	#define arch_initcall(fn)               __define_initcall("3",fn)
> 	#define subsys_initcall(fn)             __define_initcall("4",fn)
> 	#define fs_initcall(fn)                 __define_initcall("5",fn)
> 	#define device_initcall(fn)             __define_initcall("6",fn)
> 	#define late_initcall(fn)               __define_initcall("7",fn)
> 
> where the next-to-last one is the regular "device_initcall()" (and this is 
> what a "module_init()" in a compiled-in driver will use).
> 
> Now, something like the basic sound subsystem initialization should 
> obviously NOT be a "device initcall". It's not a device. It's a subsystem 
> that serves devices, and thus the basic sound initialization should 
> probably use "subsys_initcall()" instead.
> 
> Now, if it's built as a module, that "subsys_initcall()" ends up doing 
> exactly the same thing as a plain "module_init()", and you'll never see 
> any difference. But when it's built into the kernel, it means that it gets 
> initialized with the other subsystems.
> 
> Now, one thing to look out for is that if your "core sound initialization" 
> depends on PCI probing having completed (ie it's not a pure subsystem with 
> no dependencies on anything else), the common hack for that is to just use 
> the "fs_initicall()" instead. But a truly independent subsystem (which 
> sound hopefully is) should just use subsys_initcall(), and then, if that 
> subsystem internally has more complex ordering, just use the link order in 
> the Makefiles to indicate that.

As far as looking at the codes, it's OK for PCI.  PCI is initialized
in postcore, and the only device_initcall is for pci_init(), which
calls fixup for each PCI device.  This is no problem because fixup is
called in pci_enable(), too.

But for other subsystems like ISA PnP, it may be broken since some
codes are still using module_init().
(And, interestingly, fs_initcall() is rarely used in the whole fs/
 codes!  "grep -r fs_initcall linux/fs" hits only one file.)

So, a "safe" solution for the time being appears to be either
- to look through the whole codes and adjust *_initcall() levels,
- to force to build saa7134-alsa as a module, or
- to move saa7134-alsa.c to sound/ directory.


> > I have no idea how to get the kernel to do this though. Any pointers?
> 
> The above should hopefully make the kernel support for this obvious.
> 
> I thought more people knew about all this. Forcing (or even just 
> encouraging) people to use loadable modules is just horrible. I personally 
> run a kernel with no modules at all: it makes for a simpler bootup, and in 
> some situations (embedded) it has both security and size advantages.

Yep.  The driver must work both for modules and built-in.  If it
doesn't work, it's called a bug, as we all know :)


Takashi

  parent reply	other threads:[~2005-12-21 14:36 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-19  0:47 Linux 2.6.15-rc6 Linus Torvalds
2005-12-19  1:30 ` Diego Calleja
2005-12-19  5:41   ` Willy Tarreau
2005-12-20 13:18 ` 2.6.15-rc6: boot failure in saa7134-alsa.c Adrian Bunk
2005-12-20 15:52   ` [Alsa-devel] " Sergey Vlasov
2005-12-20 18:24     ` Linus Torvalds
     [not found]       ` <20051220183455.GC19797@master.mivlgu.local>
2005-12-20 18:57         ` Linus Torvalds
2005-12-20 19:14       ` Adrian Bunk
2005-12-20 19:23         ` Mauro Carvalho Chehab
2005-12-20 19:59         ` Linus Torvalds
2005-12-20 20:23           ` Adrian Bunk
2005-12-20 20:41             ` Linus Torvalds
2005-12-20 20:47               ` James Courtier-Dutton
2005-12-20 21:06                 ` Linus Torvalds
2005-12-20 21:13                 ` [RFC: 2.6 patch] Makefile: sound/ must come before drivers/ Adrian Bunk
2005-12-20 21:24                   ` [Alsa-devel] " Jaroslav Kysela
2005-12-20 22:09                   ` Linus Torvalds
2005-12-21 14:21                     ` Takashi Iwai
2005-12-21 20:49                       ` Mauro Carvalho Chehab
2005-12-22 15:32                         ` Takashi Iwai
2005-12-22 16:06                           ` Mauro Carvalho Chehab
2005-12-22 16:17                             ` Takashi Iwai
2005-12-22 16:38                               ` Mauro Carvalho Chehab
2005-12-21 14:23             ` [Alsa-devel] 2.6.15-rc6: boot failure in saa7134-alsa.c Takashi Iwai
2005-12-21 18:22               ` Adrian Bunk
2005-12-21 18:38                 ` Takashi Iwai
2005-12-21 22:40                   ` Adrian Bunk
2005-12-22 11:39                     ` Takashi Iwai
2005-12-20 20:35           ` James Courtier-Dutton
2005-12-20 21:03             ` Linus Torvalds
2005-12-20 22:17               ` Lee Revell
2005-12-21  1:29                 ` Linus Torvalds
2005-12-21 13:29                 ` Stephen Clark
2005-12-21 14:39               ` Takashi Iwai [this message]
2005-12-21 18:32                 ` Linus Torvalds
2005-12-21 18:52                   ` Takashi Iwai
2005-12-21 22:42                     ` Adrian Bunk
2005-12-21 22:50                     ` R C
2005-12-21 16:58               ` Steve deRosier
2005-12-21 18:32                 ` Linus Torvalds
2005-12-21 18:41                   ` Takashi Iwai
2005-12-20 20:35         ` Mauro Carvalho Chehab
2005-12-22  0:59           ` Adrian Bunk
2005-12-22 11:15             ` Mauro Carvalho Chehab
2005-12-22  1:13 ` 2.6.15-rc6: known regressions in the kernel Bugzilla Adrian Bunk
2005-12-22  7:15   ` Greg KH
2005-12-22 12:04     ` Takashi Iwai
2005-12-29 13:23       ` Adrian Bunk
2005-12-30 19:31         ` Lee Revell
2005-12-22  8:52   ` Andrew Morton
2005-12-22 13:57     ` Adrian Bunk
2005-12-22 14:08       ` Andrew Morton
2005-12-22 23:12         ` Adrian Bunk
2005-12-23 15:28         ` Bill Davidsen
2005-12-23 17:32           ` Michael Krufky
2005-12-24  3:54             ` Andrew Morton
2005-12-25 20:25               ` Bill Davidsen
2005-12-26  1:59               ` Michael Krufky
2005-12-26  2:21               ` Lee Revell
2005-12-22 17:11       ` Brice Goglin
     [not found]       ` <200512222152.05427.p_christ@hol.gr>
     [not found]         ` <1135291436.14685.7.camel@localhost>
2005-12-22 22:55           ` Mike Krufky
     [not found]             ` <200512230121.48882.p_christ@hol.gr>
2005-12-23  1:07               ` Michael Krufky
2005-12-23 11:50       ` Gottfried Haider
2006-01-02 16:00         ` Adrian Bunk
2006-01-04 16:38           ` Greg KH
2005-12-22 15:16     ` David S. Miller

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=s5hpsnqzf86.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=James@superbug.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=bunk@stusta.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@brturbo.com.br \
    --cc=perex@suse.cz \
    --cc=torvalds@osdl.org \
    --cc=v4l@cerqueira.org \
    --cc=video4linux-list@redhat.com \
    --cc=vsu@altlinux.ru \
    /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

all inboxes | Powered by JetHome®