I would think we need to at least patch current for this case. Enclosed is a possible implementation. Comments?
- JimP On Friday 11 October 2002 07:53 am, Tim Robbins wrote: > On Fri, Oct 11, 2002 at 07:07:36AM -0700, Jim Pirzyk wrote: > > Does anyone have experience running a recient -CURRENT as > > a vmware2 guest OS? I have tried -DP1 and a version from this > > week and both just die a slow death. I first tried to install a > > 4.6.2-RELEASE, and that worked. Then I tried to upgrade the > > system to -CURRENT via a make world (mergemaster, etc). and > > the 'make installworld' has not finished after 24 hours. The load > > goes up to ~ 5 during the install. I have tried this in multi user mode > > as well as in single user mode, no difference. > > > > When I install -DP1 and reboot, the system does the same thing processing > > the /etc/rc* scripts and never makes multi user mode. If I boot single > > user, the fsck has the same problem. > > This patch makes FreeBSD much faster under VMware by avoiding the CMPXCHG > instruction, which VMware seems to emulate very slowly. Someone posted it > to this list a while back, but I've forgotten who it was. I'm using it > at the moment.. it's still less than half the speed it would be on real > hardware, but it makes a big difference :-) > > (in /sys/i386/include) > > Index: atomic.h > =================================================================== > RCS file: /home/tim/freebsd/src/sys/i386/include/atomic.h,v > retrieving revision 1.28 > diff -u -r1.28 atomic.h > --- atomic.h 18 Jul 2002 15:56:46 -0000 1.28 > +++ atomic.h 12 Sep 2002 08:28:12 -0000 > @@ -117,7 +117,7 @@ > > #if defined(__GNUC__) > > -#if defined(I386_CPU) > +#if defined(I386_CPU) || 1 > > static __inline int > atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) > > > I've done no benchmarks, but compiling with CPUTYPE set to something > conservative like i386 or i486 also seems to help. > > Also keep in mind that there are a bunch of debugging features enabled by > default in GENERIC and the base system (witness, malloc() debugging etc.) > that you could disable. > > > Tim -- --- @(#) $Id: dot.signature,v 1.10 2001/05/17 23:38:49 Jim.Pirzyk Exp $ __o [EMAIL PROTECTED] ----------------------------------------------- _'\<,_ (*)/ (*)
--- sys/conf/options.i386.orig Sat Oct 12 11:20:35 2002 +++ sys/conf/options.i386 Sat Oct 12 11:32:14 2002 @@ -64,6 +64,7 @@ CPU_ENABLE_SSE opt_cpu.h CPU_ATHLON_SSE_HACK opt_cpu.h CPU_DISABLE_SSE opt_cpu.h +CPU_DISABLE_CMPXFHG opt_cpu.h # The CPU type affects the endian conversion functions all over the kernel. I386_CPU opt_global.h --- sys/i386/conf/NOTES.orig Sat Oct 12 11:18:47 2002 +++ sys/i386/conf/NOTES Sat Oct 12 11:30:50 2002 @@ -142,6 +142,10 @@ # which indicates that the 15-16MB range is *definitely* not being # occupied by an ISA memory hole. # +# CPU_DISABLE_CMPXFHG disables the CMPXFHG instruction on > i386 machines. +# VmWare seems to emulate this instruction poorly, causing the guest OS to +# run very slowly. +# # NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, # CPU_LOOP_EN and CPU_RSTK_EN should not be used because of CPU bugs. # These options may crash your system. @@ -175,6 +179,7 @@ options CYRIX_CACHE_WORKS options CYRIX_CACHE_REALLY_WORKS #options NO_F00F_HACK +options VMWARE # # A math emulator is mandatory if you wish to run on hardware which --- sys/i386/include/atomic.h.orig Sat Oct 12 11:17:39 2002 +++ sys/i386/include/atomic.h Sat Oct 12 11:31:09 2002 @@ -117,7 +117,7 @@ #if defined(__GNUC__) -#if defined(I386_CPU) +#if defined(I386_CPU) || defined(CPU_DISABLE_CMPXFHG) static __inline int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)