Boot Time

From eLinux.org
Revision as of 02:47, 9 November 2008 by FransMeulenbroeks (talk | contribs) (User-space and application speedups: added: avoid udev)
Jump to: navigation, search

Introduction

Boot Time includes topics such as measurement, analysis, human factors, initialization techniques, and reduction techniques. The time that a product takes to boot directly impacts the first perception an end user has of the product. Regardless of how attractive or well designed a consumer electronic device is, the time required to move the device from off to an interactive, usable state is critical to obtaining a positive end user experience. Turning on a device is Use Case #1.

Booting up a device involves numerous steps and sequences of events. In order to use consistent terminology, the Bootup Time Working of the CE Linux Forum came up with a list of terms and their widely accepted definitions for this functionality area. See the following page for these terms:

Technology/Project Pages

The following are individual pages with information about various technologies relevant to improving Boot Time for Linux. Some of these describe local patches available on this site. Others point to projects or patches maintained elsewhere.

Measuring Boot-up Time

  • Printk Times - simple system for showing timing information for each printk.
  • Kernel Function Trace - system for reporting function timings in the kernel.
  • Linux Trace Toolkit - system for reporting timing data for certain kernel and process events.
  • Oprofile - system-wide profiler for Linux.
  • Bootchart - a tool for performance analysis and visualization of the Linux boot process. Resource utilization and process information are collected during the user-space portion of the boot process and are later rendered in a PNG, SVG or EPS encoded chart.
  • Bootprobe - a set of System Tap scripts for analyzing system bootup.
  • and, let us not forget: "cat /proc/uptime"

[ FIXTHIS - should mention (and publish) sstream or grabserial here ]

[ FIXTHIS - should also mention initcall_debug (kernel command line option) here - it shows driver init times for many drivers]

  • See also: Kernel Instrumentation which lists some known kernel instrumentation tools. These are of interest for measuring kernel startup time.

Technologies and Techniques for Reducing Boot Time

Bootloader speedups

Kernel speedups

File System issues

Different file systems have different initialization (mounting) times, for the same data sets. This is a function of whether meta-data must be read from storage into RAM or not, and what algorithms are used during the mount procedure.

  • Filesystem Information - has information about boot-up times of various file systems
  • File Systems - has information on various file systems that are interesting for embedded systems
  • Avoid Initramfs - explains on why intramfs should be avoided if you want to minimize boot time

User-space and application speedups

  • Optimize RC Scripts - Reduce overhead of running RC scripts
  • Parallel RC Scripts - Run RC scripts in parallel instead of sequentially
  • Application XIP - Allow programs and libraries to be executed in-place in ROM or FLASH
  • Pre Linking - Avoid cost of runtime linking on first program load
  • GNU_HASH: ~ 50% speed improvement in dynamic linking
  • Application Init Optimizations - Improvements in program load and init time via:
    • use of mmap vs. read
    • control over page mapping characteristics.
  • Include modules in kernel image - Avoid extra overhead of module loading by adding the modules to the kernel image
  • Avoid udev. Udev takes quite some time to populate the /dev directory. In an embedded system it is often known what devices are present and in any case you know what drivers are available, so you know what device entries might be needed in /dev. These should be created statically, not dynamically. mknod is your friend, udev is your enemy.

Uninvestigated speedups

This section is a holding pen for ideas for improvement that are not implemented yet but that could result in a boot time gain. Please leave a note here if you are working on one of these items to avoid duplicate work.

  • prepopulated buffer cache. As initramfs performs an additional copy of the data the idea is to have a prepopulated buffer cache. A simplistic scenario would allow dumping the buffer cache when the booting is completed and the user applications have initialised. This data then could be used in a subsequent boot to initialize the buffer cache (of course without copying). A possible approach would be to have those data to reside into the kernel image and use them directly. Alternately they could be loaded separately.
    Unfortunately my knowledge of the internals in this section is not yet good enough to do a trial implementation.
    Caveats:
    • is it possible to have the buffer cache split into two different parts, one which is statically allocated, one which is dynamically allocated?
    • the pages in the prepopulated buffer cache probably cannot be discarded, so they should be pinned
    • apart from the buffer cache data itself also some other variables might need restoring
    • a similar approach could also be used for the cached file data.

Articles and Presentations

Case Studies

Splash Screen projects

  • Splashy - Technology to put up a spalsh screen early in the boot sequence. This is

user-space code.

    • This seems to be the most current splash screen technology, for major distributions. A framebuffer driver for the kernel is required.
  • Gentoo Splashscreen - newer technology to put a splash screen early in the boot sequence
  • PSplash - PSplash is a userspace graphical boot splash screen for mainly

embedded Linux devices supporting a 16bpp or 32bpp framebuffer.

  • bootsplash.org - put up a splash screen early in boot sequence
    • This project requires kernel patches
    • This project is now abandoned, and work is being done on Splashy.

Additional Projects/Mailing Lists/Resources

Kexec

  • Kexec is a system which allows a system to be rebooted without going through BIOS. That is, a Linux kernel can directly boot into another Linux kernel, without going through firmware. See the white paper at: kexec.pdf

Others

  • FSMLabs Fastboot - press release by FSMLabs about fast booting of their product. Is any of this published?
  • snapshot boot - a technology uses software resume to boot up the system quickly.

Apparently obsolete or abandoned material

  • Alert.gif in progress - Boot-up Time Reduction Howto - this is a project to catalog existing boot-up time reduction techniques.
    • Was originally intended to be the authoritative source for bootup time reduction information.
    • No one maintains it any more (as of Aug, 2008)
  • Alert.gifno content yet - Boot-up Time Delay Taxonomy - list of delays categorized by boot phase, type and magnitude
    • Was to be a survey of common bootup delays found in embedded devices.
    • Was never really written.