最終更新:2015-10-20 (火) 16:23:23 (3105d)  

linux/start_kernel.h?
start_kernel
Top / start_kernel

  • Linux/initが動作するまでの初期化処理を行う

http://lxr.free-electrons.com/source/init/main.c?v=4.0#L489

呼び出し元

  • x86_64_start_reservations?

実装

呼び出し

Need to run as early as possible, to initialize the lockdep hash:

  • lockdep_init?
  • set_task_stack_end_magic?
  • smp_setup_processor_id?
  • debug_objects_early_init?
  • boot_init_stack_canary?
  • cgroup_init_early?
  • local_irq_disable? - 割り込み禁止

Interrupts are still disabled. Do necessary setups, then enable them

  • boot_cpu_init?
  • page_address_init?
  • pr_notice?
  • setup_arch - 機種に依存する部分
  • mm_init_cpumask?
  • setup_command_line?
  • setup_nr_cpu_ids?
  • setup_per_cpu_areas?
  • smp_prepare_boot_cpu?
  • build_all_zonelists?
  • page_alloc_init?
  • pr_notice?
  • parse_early_param
  • parse_args?
  • jump_label_init?

These use large bootmem allocations and must precede kmem_cache_init()

  • setup_log_buf? - カーネルログバッファの初期化
  • pidhash_init? - PIDのハッシュテーブルの初期化
  • vfs_caches_init_early? - inodeハッシュエーブルの初期化
  • sort_main_extable?
  • trap_init?
  • mm_init? - page構造体とメモリアロケータの初期化

Set up the scheduler prior starting any interrupts (such as the timer interrupt). Full topology setup happens at smp_init() time - but meanwhile we still have a functioning scheduler.

  • sched_init?

Disable preemption - early bootup scheduling is extremely fragile until we cpu_idle() for the first time.

  • preempt_disable?
  • irqs_disabled?
  • local_irq_disable?
  • idr_init_cache?
  • rcu_init?

trace_printk() and trace points may be used after this

  • trace_init?
  • context_tracking_init?
  • radix_tree_init?

init some links before init_ISA_irqs()

  • early_irq_init?
  • init_IRQ?
  • tick_init?
  • rcu_init_nohz?
  • init_timers?
  • hrtimers_init?
  • softirq_init?
  • timekeeping_init - システム時刻の設定
  • time_init? - HPETのタイマ割り込みの設定とタイマ割り込みのハンドラの登録、CPUのクロック周波数の計算
  • sched_clock_postinit?
  • perf_event_init?
  • profile_init?
  • call_function_init?
  • irqs_disabled?
  • local_irq_enable? - 割り込み許可
  • kmem_cache_init_late?

HACK ALERT!

  • This is early. We're enabling the console before we've done PCI setups etc, and console_init() must be aware of this. But we do want output early, in case something goes wrong.
  • console_init?
  • panic?
  • lockdep_info?

Need to run this when irqs are enabled, because it wants to self-test [hard/soft]-irqs on/off lock inversion bugs too:

  • locking_selftest?
  • page_ext_init?
  • debug_objects_mem_init?
  • kmemleak_init?
  • setup_per_cpu_pageset?
  • numa_policy_init?
  • late_time_init?
  • sched_clock_init?
  • calibrate_delay?
  • pidmap_init?
  • anon_vma_init?
  • acpi_early_init?
  • efi_enter_virtual_mode?

Should be run before the first non-init thread is created

  • init_espfix_bsp?
  • thread_info_cache_init?
  • cred_init?
  • fork_init?
  • proc_caches_init?
  • buffer_init?
  • key_init?
  • security_init?
  • dbg_late_init?
  • vfs_caches_init
  • signals_init?

rootfs populating might need page-writeback

  • page_writeback_init?
  • proc_root_init - Linux/procを作成
  • nsfs_init?
  • cpuset_init?
  • cgroup_init?
  • taskstats_init_early?
  • delayacct_init?
  • check_bugs?
  • sfi_init_late?
  • efi_late_init?
  • efi_free_boot_services?
  • ftrace_init?

Do the rest non-__init'ed, we're now alive

関連