fastboot tree for v2.6.28
Linus,
Please pull the latest fastboot-v28-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git fastboot-v28-for-linus
the (opt-in) fastboot async bootup feature, as described by Arjan in his v2.6.28 announcement:
http://lwn.net/Articles/299591/
tested and maintained in -tip because tip/tracing embedd-merges this topic. (for the fastboot tracer)
Thanks,
Ingo
------------------>
Arjan van de Ven (16):
fastboot: create a "asynchronous" initlevel
fastboot: turn the USB hostcontroller initcalls into async initcalls
fastboot: convert a few non-critical ACPI drivers to async initcalls
fastboot: hold the BKL over the async init call sequence
fastboot: sync the async execution before late_initcall and move level 6s (sync) first
fastboot: make fastboot a config option
modules: extend initcall_debug functionality to the module loader
fastboot: retry mounting the root fs if we can't find init
fastboot: make the raid autodetect code wait for all devices to init
fastboot: remove "wait for all devices before mounting root" delay
fastboot: make the RAID autostart code print a message just before waiting
fastboot: fix blackfin breakage due to vmlinux.lds change
Add a script to visualize the kernel boot process / time
fastboot: fix issues and improve output of bootgraph.pl
use the fancy new printk flags to print the function pointer
raid: make RAID autodetect default a KConfig option
Arnaud Patard (1):
fastboot: Fix bootgraph.pl initcall name regexp
Ingo Molnar (2):
fastboot: fix typo in init/Kconfig text
warning: fix init do_mounts_md c
KOSAKI Motohiro (1):
fastboot: fix build error of autodetect_raid()
Li, Shaohua (1):
fastboot: remove duplicate unpack_to_rootfs()
Steven Noonan (1):
init/initramfs.c: unused function when compiling without CONFIG_BLK_DEV_RAM
drivers/acpi/battery.c | 2 +- drivers/acpi/button.c | 2 +- drivers/acpi/thermal.c | 2 +- drivers/md/Kconfig | 14 ++++ drivers/pci/pci.c | 2 +- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/host/ohci-hcd.c | 2 +- drivers/usb/host/uhci-hcd.c | 2 +- include/asm-generic/vmlinux.lds.h | 6 +- include/linux/init.h | 8 ++ init/Kconfig | 11 +++ init/do_mounts.c | 2 + init/do_mounts_md.c | 41 ++++++++-- init/initramfs.c | 73 +++++++++++++++---- init/main.c | 84 +++++++++++++++++++-- scripts/bootgraph.pl | 147 +++++++++++++++++++++++++++++++++++++ 16 files changed, 361 insertions(+), 39 deletions(-) create mode 100644 scripts/bootgraph.pl
drivers/acpi/battery.c +1 -1
@@ -904,5 +904,5 @@ static void __exit acpi_battery_exit(void)#endif } -module_init (acpi_battery_init); +module_init_async (acpi_battery_init);module_exit (acpi_battery_exit);
drivers/acpi/button.c +1 -1
@@ -545,5 +545,5 @@ static void __exit acpi_button_exit(void)remove_proc_entry (ACPI_BUTTON_CLASS , acpi_root_dir); } -module_init (acpi_button_init); +module_init_async (acpi_button_init);module_exit (acpi_button_exit);
drivers/acpi/thermal.c +1 -1
@@ -1876,5 +1876,5 @@ static void __exit acpi_thermal_exit(void)return ; } -module_init (acpi_thermal_init); +module_init_async (acpi_thermal_init);module_exit (acpi_thermal_exit);
drivers/md/Kconfig +14 -0
@@ -30,6 +30,20 @@ config BLK_DEV_MD If unsure, say N. +config MD_AUTODETECT + bool "Autodetect RAID arrays during kernel boot" + depends on BLK_DEV_MD + default y + ---help--- + If you say Y here, then the kernel will try to autodetect raid + arrays as part of its boot process. + + If you don't use raid and say Y, this autodetection can cause + a several-second delay in the boot time due to various + synchronisation steps that are part of this step. + + If unsure, say Y. + config MD_LINEAR tristate "Linear (append) mode" depends on BLK_DEV_MD
drivers/pci/pci.c +1 -1
@@ -1909,7 +1909,7 @@ static int __devinit pci_setup(char *str) }early_param ("pci" , pci_setup); -device_initcall (pci_init); +device_initcall_sync (pci_init);EXPORT_SYMBOL (pci_reenable_device);EXPORT_SYMBOL (pci_enable_device_io);
drivers/usb/host/ehci-hcd.c +1 -1
@@ -1107,7 +1107,7 @@ clean0:#endif return retval; } -module_init (ehci_hcd_init); +module_init_async (ehci_hcd_init); static void __exit ehci_hcd_cleanup(void) {
drivers/usb/host/ohci-hcd.c +1 -1
@@ -1186,7 +1186,7 @@ static int __init ohci_hcd_mod_init(void)return retval; } -module_init (ohci_hcd_mod_init); +module_init_async (ohci_hcd_mod_init); static void __exit ohci_hcd_mod_exit(void) {
drivers/usb/host/uhci-hcd.c +1 -1
@@ -999,7 +999,7 @@ static void __exit uhci_hcd_cleanup(void)kfree (errbuf); } -module_init (uhci_hcd_init); +module_init_async (uhci_hcd_init);module_exit (uhci_hcd_cleanup);MODULE_AUTHOR (DRIVER_AUTHOR );
include/asm-generic/vmlinux.lds.h +5 -1
@@ -376,8 +376,12 @@ *(.initcall5.init) \ *(.initcall5s.init) \ *(.initcallrootfs.init) \ + *(.initcall6s.init) \ + VMLINUX_SYMBOL(__async_initcall_start) = .; \ + *(.initcall6a.init) \ + VMLINUX_SYMBOL(__async_initcall_end) = .; \ *(.initcall6.init) \ - *(.initcall6s.init) \ + VMLINUX_SYMBOL(__device_initcall_end) = .; \ *(.initcall7.init) \ *(.initcall7s.init)
include/linux/init.h +8 -0
@@ -143,6 +143,8 @@ extern int do_one_initcall(initcall_t fn);extern char __initdata boot_command_line[];extern char *saved_command_line;extern unsigned int reset_devices; +extern int do_one_initcall (initcall_t fn); +/* used by init/main.c */ void setup_arch (char **);
@@ -197,11 +199,13 @@ extern void (*late_time_init)(void);#define fs_initcall_sync (fn) __define_initcall("5s",fn,5s)#define rootfs_initcall (fn) __define_initcall("rootfs",fn,rootfs)#define device_initcall (fn) __define_initcall("6",fn,6) +#define device_initcall_async (fn) __define_initcall("6a", fn, 6a)#define device_initcall_sync (fn) __define_initcall("6s",fn,6s)#define late_initcall (fn) __define_initcall("7",fn,7)#define late_initcall_sync (fn) __define_initcall("7s",fn,7s)#define __initcall (fn) device_initcall(fn) +#define __initcall_async (fn) device_initcall_async(fn)#define __exitcall (fn) \ static exitcall_t __exitcall_##fn __exit_call = fn
@@ -257,6 +261,7 @@ void __init parse_early_param(void);* be one per module. */ #define module_init (x) __initcall(x); +#define module_init_async (x) __initcall_async(x);/** * module_exit() - driver exit entry point
@@ -279,10 +284,13 @@ void __init parse_early_param(void);#define subsys_initcall (fn) module_init(fn)#define fs_initcall (fn) module_init(fn)#define device_initcall (fn) module_init(fn) +#define device_initcall_async (fn) module_init(fn)#define late_initcall (fn) module_init(fn)#define security_initcall (fn) module_init(fn) +#define module_init_async (fn) module_init(fn) +/* Each module must use one module_init(). */ #define module_init (initfn) \ static inline initcall_t __inittest(void) \
init/Kconfig +11 -0
@@ -524,6 +524,17 @@ config CC_OPTIMIZE_FOR_SIZE If unsure, say Y. +config FASTBOOT + bool "Fast boot support" + help + The fastboot option will cause the kernel to try to optimize + for faster boot. + + This includes doing some of the device initialization asynchronously + as well as opportunistically trying to mount the root fs early. + + If unsure, say N. + config SYSCTL bool
init/do_mounts.c +2 -0
@@ -365,9 +365,11 @@ void __init prepare_namespace(void)ssleep (root_delay); } +#ifndef CONFIG_FASTBOOT /* wait for the known devices to complete their probing */ while (driver_probe_done () !=0 )msleep (100 ); +#endif md_run_setup ();
init/do_mounts_md.c +32 -9
67 lines not on this page · raw message
init/initramfs.c +58 -15
130 lines not on this page · raw message
init/main.c +77 -7
127 lines not on this page · raw message
scripts/bootgraph.pl new file +147 -0
147 lines not on this page · raw message
Quoted 5 lines · Ingo Molnar
Please pull the latest fastboot-v28-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git fastboot-v28-for-linus
Quoted 7 lines
the (opt-in) fastboot async bootup feature, as described by Arjan in his v2.6.28 announcement:
http://lwn.net/Articles/299591/tested and maintained in -tip because tip/tracing embedd-merges this topic. (for the fastboot tracer)
Ok, so I finally looked at the patch, I quite frankly, I think it's fundamentally wrong.
This is just an example of the wrongness:
-module_init(uhci_hcd_init); +module_init_async(uhci_hcd_init); -module_init(ehci_hcd_init); +module_init_async(ehci_hcd_init); -module_init(ohci_hcd_mod_init); +module_init_async(ohci_hcd_mod_init); -device_initcall(pci_init); +device_initcall_sync(pci_init);
because there is absolutely _no_ excuse for doing the PCI part of the probing asynchronously.
The "ohci_hcd_mod_init" part is _especially_ dangerous, because clearly nobody looked at the OHCI setup sequence, which includes a lot of odd devices and not all of them at all PCI-related etc. Making it asynchronous is not safe, nor is it appropriate.
The fact is, those things all have one thing in common:
- they call usb_add_hcd, and usb_add_hcd is a horrible and slow piece of crap that doesn't just add the host controller, but does all the probing too.
In other words, what should be fixed is not the initcall sequence, and certainly not make PCI device probing (or other random buses) be partly asynchronous, but simply make that USB host controller startup function be asynchronous.
There are other devices too that may need synchronous core hub discovery (eg the actual controller), but that want to do the "devices hanging off this controller" asynchronously. Disks come to mind. That shouldn't mean that the IDE driver discovery should be asynchronous, it should just mean that the driver has some simple way to execute something asynchronously.
In other words, I really think it's very wrong to make that "async_init_wq" be somethign that is internal to do_initcalls. It should be a workqueue that the initcalls can _choose_ to use at the appropriate level (which may be deeper down, like 'usb_add_hcd()'), not be forced to use at the outermost one.
You can try to convince me otherwise, but I really do think this patch is fundamentally the wrong approach.
Linus
Quoted 22 lines · On Fri, 10 Oct 2008 13:10:30 -0700 (PDT) Linus Torvalds…
Quoted 6 lines · Ingo Molnar
Please pull the latest fastboot-v28-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.gitfastboot-v28-for-linus
Quoted 7 lines
the (opt-in) fastboot async bootup feature, as described by Arjan in his v2.6.28 announcement:
http://lwn.net/Articles/299591/tested and maintained in -tip because tip/tracing embedd-merges this topic. (for the fastboot tracer)
Ok, so I finally looked at the patch, I quite frankly, I think it's fundamentally wrong.
This is just an example of the wrongness:
Quoted 9 lines
-module_init(uhci_hcd_init); +module_init_async(uhci_hcd_init); -module_init(ehci_hcd_init); +module_init_async(ehci_hcd_init); -module_init(ohci_hcd_mod_init); +module_init_async(ohci_hcd_mod_init); -device_initcall(pci_init); +device_initcall_sync(pci_init);
(I know you saw this, but I want to just point out to more casual readers that the pci_init call above is not "async", there's deliberately no "a" there)
Quoted 3 lines
because there is absolutely _no_ excuse for doing the PCI part of the probing asynchronously.
The PCI layer is absolutely not asychronous indeed, that would be totally insane, and I really don't want to go there (nor do I think we would need to to get to a fast boot). The initcall_sync above is to fix a bug in the PCI layer where there was a subsystem level required call stuck in the device level, and by sticking it in device_initcall_sync it is at least guaranteed to run before any device initcalls.
Quoted 8 lines
The "
ohci_hcd_mod_init" part is _especially_ dangerous, because clearly nobody looked at the OHCI setup sequence, which includes a lot of odd devices and not all of them at all PCI-related etc. Making it asynchronous is not safe, nor is it appropriate.The fact is, those things all have one thing in common:
Quoted 8 lines
- they call
usb_add_hcd, andusb_add_hcdis a horrible and slow
piece of crap that doesn't just add the host controller, but does all the probing too.In other words, what should be fixed is not the initcall sequence, and certainly not make PCI device probing (or other random buses) be partly asynchronous, but simply make that USB host controller startup function be asynchronous.
You are right and when you pull the USB tree later this week you'll get that into your tree. You are right that for subsystem level components that that is absolutely the right approach
Quoted 9 lines
In other words, I really think it's very wrong to make that "
async_init_wq" be somethign that is internal todo_initcalls. It should be a workqueue that the initcalls can _choose_ to use at the appropriate level (which may be deeper down, like 'usb_add_hcd()'), not be forced to use at the outermost one.You can try to convince me otherwise, but I really do think this patch is fundamentally the wrong approach.
there's an angle here which I would like to bring up. There is a fundamental difference between a spider functionality like USB, and "leaf drivers". Yes USB should do it right, it's drivers are effectively a midlayer. (and again, pull gregkh's tree and you'll get that; although even with that there's a noticeable amount of time spent there).
For leaf drivers, it's a matter of where you want to push the functionality. With leaf drivers I mean things like the ACPI battery driver (or other ACPI drivers), but also various PCI drivers that don't have or are elaborate subsystems or boot dependencies. We could make all their probing functions async in each driver, or we could provide the most simple interface as is done in this case, they just change how they declare their initcall.
(I'll grant you that we could also do a pci_register_device_async() like of helper, but that's just solving part of the same problem)
Personally for leaf drivers, I think the initcall-level approach is much less error prone.
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 20 lines · Arjan van de Ven
Quoted 2 lines
You can try to convince me otherwise, but I really do think this patch is fundamentally the wrong approach.
there's an angle here which I would like to bring up. There is a fundamental difference between a spider functionality like USB, and "leaf drivers". Yes USB should do it right, it's drivers are effectively a midlayer. (and again, pull gregkh's tree and you'll get that; although even with that there's a noticeable amount of time spent there).
For leaf drivers, it's a matter of where you want to push the functionality. With leaf drivers I mean things like the ACPI battery driver (or other ACPI drivers), but also various PCI drivers that don't have or are elaborate subsystems or boot dependencies. We could make all their probing functions async in each driver, or we could provide the most simple interface as is done in this case, they just change how they declare their initcall. (I'll grant you that we could also do a
pci_register_device_async()like of helper, but that's just solving part of the same problem)
Quoted 2 lines
Personally for leaf drivers, I think the initcall-level approach is much less error prone.
i'd like to inject my first-hand testing experience with your patches:
When i saw your patches then initially my impression was "oh my, this will break a ton of stuff", so i asked you to: make it default-off (against Andrew's suggestion to just remove the config and make it a compulsory feature), to add various mechanisms to disable and isolate it, should it break something - which i expected to be a near certainty.
But i was wrong. We had only a single bug in fastboot-v1 three months ago which i bisected back to this series, and you fixed that quickly. And CONFIG_FASTBOOT=y is definitely one of the popular features that testers enable and there's all sorts of weird systems that are being tested with tip/master.
So tip/fastboot has certainly been a problem free topic in its 3 months of lifetime - and it got propagated to linux-next early on as well.
Our -tip testsystems boot with CONFIG_FASTBOOT=y about 50% of the time, once every couple of minutes on this test-system:
config-Fri_Oct_10_23_06_21_CEST_2008.good:CONFIG_FASTBOOT=y config-Fri_Oct_10_23_07_54_CEST_2008.good:CONFIG_FASTBOOT=y config-Fri_Oct_10_23_14_08_CEST_2008.good:CONFIG_FASTBOOT=y config-Fri_Oct_10_23_15_54_CEST_2008.good:CONFIG_FASTBOOT=y config-Fri_Oct_10_23_21_37_CEST_2008.good:CONFIG_FASTBOOT=y config-Fri_Oct_10_23_22_56_CEST_2008.good:CONFIG_FASTBOOT=y config-Fri_Oct_10_23_27_14_CEST_2008.good:CONFIG_FASTBOOT=y
i checked the logs, just yesterday that meant 354 fastboot-enabled bootups on just that single test-system. So while i fully expected fragility from this topic, neither our testing nor our testers saw fragility in practice.
Ingo
Quoted 4 lines · On Sat, 11 Oct 2008 08:47:12 +0200 Ingo Molnar <[email protected]> wrote:
When i saw your patches then initially my impression was "oh my, this will break a ton of stuff", so i asked you to: make it default-off (against Andrew's suggestion to just remove the config and make it a compulsory feature)
hm, that must have been the other Andrew.
A feature like this I think should not have a config option but should be enabled by a boot option.
We can waffle about the default setting of that option. Maybe turn it on for a few weeks and see what happens.
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Sat, 11 Oct 2008 08:47:12 +0200 Ingo Molnar <[email protected]> wrote:
When i saw your patches then initially my impression was "oh my, this will break a ton of stuff", so i asked you to: make it default-off (against Andrew's suggestion to just remove the config and make it a compulsory feature)
hm, that must have been the other Andrew.
on 14th August you wrote:
|| Making it a config options seems a bad idea - it'll split our || testing/debugging space yet again. If this stuff works, then || everyone should be able to use it. If it doesn't work, well....
this i understood as: "if we take this stuff then it should be always-on". [You didnt say whether we should take it though.]
Quoted 5 lines
A feature like this I think should not have a config option but should be enabled by a boot option.
We can waffle about the default setting of that option. Maybe turn it on for a few weeks and see what happens.
a config option is definitely useful for users and distros. Having the boot option is a good idea. Arjan, i thought we had a fastboot=0/1 boot option but i cannot find it - could you please add it?
Ingo
Quoted 3 lines · Ingo Molnar
a config option is definitely useful for users and distros. Having the boot option is a good idea. Arjan, i thought we had a fastboot=0/1 boot option but i cannot find it - could you please add it?
In general, boolean options should be fastboot/nofastboot. We have plenty of inconsistency in that area, but we really don't need to add more.
-hpa
Quoted 10 lines · H. Peter Anvin
Quoted 5 lines · Ingo Molnar
a config option is definitely useful for users and distros. Having the boot option is a good idea. Arjan, i thought we had a fastboot=0/1 boot option but i cannot find it - could you please add it?
In general, boolean options should be fastboot/nofastboot. We have plenty of inconsistency in that area, but we really don't need to add more.
Actually, the fastboot boot option is already used in RedHat's rc.sysinit (to skip fsck). Can't we have async_init/sync_init boot options to control this feature?
BTW, is there already some patch available for this option?
Signature · 1 line
Olivier Blin (blino) - Mandriva