diff options
author | neel <neel@FreeBSD.org> | 2013-01-09 02:11:16 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2013-01-09 02:11:16 +0000 |
commit | 0434c2a3894375b77811f28818162812e769b977 (patch) | |
tree | cbf8bf42bd18ddfe226f11254a7857a6087db9d0 | |
parent | 477199d02b1a51d8d54b062dc6da39337e31dde8 (diff) | |
download | FreeBSD-src-0434c2a3894375b77811f28818162812e769b977.zip FreeBSD-src-0434c2a3894375b77811f28818162812e769b977.tar.gz |
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
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 070d8c9..9883715 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -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 */ } |