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 */
                }
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to