Add a "pause" to busy wait loops in the cpu reset path.

This should not matter much when running on bare metal but it makes the guest
more friendly when running inside a virtual machine.

Discussed with:	jhb
Obtained from:	NetApp
This commit is contained in:
neel 2013-01-09 02:11:16 +00:00
parent 477199d02b
commit 0434c2a389

View File

@ -575,7 +575,8 @@ cpu_reset_proxy()
cpu_reset_proxy_active = 1;
while (cpu_reset_proxy_active == 1)
; /* Wait for other cpu to see that we've started */
ia32_pause(); /* Wait for other cpu to see that we've started */
CPU_SETOF(cpu_reset_proxyid, &tcrp);
stop_cpus(tcrp);
printf("cpu_reset_proxy: Stopped CPU %d\n", cpu_reset_proxyid);
@ -611,14 +612,17 @@ cpu_reset()
wmb();
cnt = 0;
while (cpu_reset_proxy_active == 0 && cnt < 10000000)
while (cpu_reset_proxy_active == 0 && cnt < 10000000) {
ia32_pause();
cnt++; /* Wait for BSP to announce restart */
}
if (cpu_reset_proxy_active == 0)
printf("cpu_reset: Failed to restart BSP\n");
enable_intr();
cpu_reset_proxy_active = 2;
while (1);
while (1)
ia32_pause();
/* NOTREACHED */
}