Linux system shutdown

I looked at reboot.c in the Linux kernel.

http://lxr.free-electrons.com/source/kernel/reboot.c

There is a kernel_halt call saying that this function will shut down everything and perform a clean system shutdown. What does a clean shutdown mean? Can someone explain what this stop is doing? I also wonder what kind of operations are considered as work based on SANSOR?

  0 void kernel_halt(void)
    161 {
    162         kernel_shutdown_prepare(SYSTEM_HALT);
    163         migrate_to_reboot_cpu();
    164         syscore_shutdown();
    165         pr_emerg("System halted\n");
    166         kmsg_dump(KMSG_DUMP_HALT);
    167         machine_halt();
    168 }
+4
source share
1 answer

syscore_shutdown() (drivers/base/syscore.c " ".) NULL shutdown . Syscore register_syscore_ops, resume suspend syscore_ops.

syscore shutdown Linux 3.13 x86/x86_64:

1) arch/x86/kernel/i8259.c: i8259A_shutdown

261         /* Put the i8259A into a quiescent state that
262          * the kernel initialization code can get it
263          * out of.
264          */
265         outb(0xff, PIC_MASTER_IMR);     /* mask all of 8259A-1 */
266         outb(0xff, PIC_SLAVE_IMR);      /* mask all of 8259A-2 */

2) arch/x86/kernel/cpu/mcheck/mce.c, mce_syscore_shutdown, mce_disable_error_reporting

2026  * Disable machine checks on suspend and shutdown. We can't really handle
2027  * them later.
 ....
2037                         wrmsrl(MSR_IA32_MCx_CTL(i), 0);

3) kernel/irq/generic-chip.c irq_gc_shutdown: gc_list, ct->chip.irq_pm_shutdown(data);; "@irq_pm_shutdown: , " ()

4) drivers/leds/trigger/ledtrig-cpu.c:

 84 static void ledtrig_cpu_syscore_shutdown(void)
 85 {
 86         ledtrig_cpu(CPU_LED_HALTED);
 87 }
...
 61         case CPU_LED_HALTED:
 62                 /* Will turn the LED off */
 63                 led_trigger_event(trig->_trig, LED_OFF);

?

, .

, ?

Syscore / . , : ( , , ( , ECC, ),...

- , ?

: ​​ 0, , , " " .

162         kernel_shutdown_prepare(SYSTEM_HALT);
163         migrate_to_reboot_cpu();
164         syscore_shutdown();
165         pr_emerg("System halted\n");
166         kmsg_dump(KMSG_DUMP_HALT);
167         machine_halt();
+2

Source: https://habr.com/ru/post/1541013/


All Articles