Re: [PATCH] x86: call machine_shutdown and stop all CPUs innative_machine_halt

From: Ingo Molnar
Date: Mon Oct 20 2008 - 12:01:27 EST

* Ivan Vecera <ivecera@xxxxxxxxxx> wrote:

> Function machine_halt (resp. native_machine_halt) is empty for x86
> architectures. When command 'halt -f' is invoked, the message "System
> halted." is displayed but this is not really true because all CPUs are
> still running. There are also similar inconsistencies for other arches
> (some uses power-off for halt or forever-loop with IRQs
> enabled/disabled). IMO there should be used the same approach for all
> architectures OR what does the message "System halted" really mean?

no fundamental objections, but could you please do it a bit cleaner:

> static void native_machine_halt(void)
> {
> + /* stop other cpus and apics */
> + machine_shutdown();
> +
> + /* stop this cpu */
> + local_irq_disable();
> + if (hlt_works(smp_processor_id()))
> + for (;;) halt();
> + for (;;);
> }

the code in arch/x86/kernel/smp.c::stop_this_cpu() is very similar to
this and could be shared. You could move the stop_this_cpu() function to
arch/x86/kernel/process.c (out of smp.c), so that it can be used by

furthermore, native_machine_power_off() should probably fall back to
native_machine_halt() as well - should pm_power_off() be disabled (or if
it fails to stop the machine).


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at