Date: Wed, 9 Jan 2013 02:11:17 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245204 - head/sys/amd64/amd64 Message-ID: <201301090211.r092BHxV093541@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Wed Jan 9 02:11:16 2013 New Revision: 245204 URL: http://svnweb.freebsd.org/changeset/base/245204 Log: 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 Modified: head/sys/amd64/amd64/vm_machdep.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Wed Jan 9 01:54:17 2013 (r245203) +++ head/sys/amd64/amd64/vm_machdep.c Wed Jan 9 02:11:16 2013 (r245204) @@ -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 */ }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301090211.r092BHxV093541>