machine_halt(), in xen/arch/x86/shutdown.c, uses
smp_call_function(__machine_halt, NULL, 1, 0) to stop all APs.
__machine_halt() is just an infinite for loop of __asm__ __volatile__ (
"hlt" );
machine_restart(), also in shudown.c, uses smp_send_stop() which ends up
doing the same thing with a few additional cleanup procedures.
Other than the fact that smp_send_stop() does a few extra cleanup steps
that aren't strictly necessary (but shouldn't be harmful) if the system
is really going to be shutdown (as opposed to restarted), is there any
reason that these two fns that both need to halt APs shouldn't use the
same code--i.e. smp_send_stop()? IMHO, the more shared shutdown code
and common paths the better.
Also, in machine_restart() there is the following:
...
/* Ensure we are the boot CPU. */
if ( GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid )
{
/* Send IPI to the boot CPU (logical cpu 0). */
on_selected_cpus(cpumask_of_cpu(0), (void *)machine_restart,
NULL, 1, 0);
for ( ; ; )
safe_halt();
}
/*
* Stop all CPUs and turn off local APICs and the IO-APIC, so
* other OSs see a clean IRQ state.
*/
smp_send_stop();
...
If this fn is entered on an AP, it appears that the AP will just do a
safe_halt(), which does not do some cleanup steps (e.g. hvm_disable()).
However, if it is entered on the BSP then it will use smp_send_stop() to
halt the APs and they will all go through these cleanup steps (incl.
hvm_disable()). Shouldn't the APs all be put into the same state
regardless of whether machine_restart() was called on an AP or BSP?
Joe
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|