Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Oct 2002 12:04:57 -0700
From:      Jim Pirzyk <jim@pirzyk.org>
To:        Tim Robbins <tjr@FreeBSD.ORG>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: -CURRENT running really slow under vmware2
Message-ID:  <200210121204.57782.jim@pirzyk.org>
In-Reply-To: <20021012005316.A42210@dilbert.robbins.dropbear.id.au>
References:  <200210110707.36650.jim@pirzyk.org> <20021012005316.A42210@dilbert.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help

--------------Boundary-00=_9CUV7Z6LSNKL5YY5ETYH
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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 m=
ode
> > as well as in single user mode, no difference.
> >
> > When I install -DP1 and reboot, the system does the same thing proces=
sing
> > the /etc/rc* scripts and never makes multi user mode.  If I boot sing=
le
> > user, the fsck has the same problem.
>
> This patch makes FreeBSD much faster under VMware by avoiding the CMPXC=
HG
> 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
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /home/tim/freebsd/src/sys/i386/include/atomic.h,v
> retrieving revision 1.28
> diff -u -r1.28 atomic.h
> --- atomic.h=0918 Jul 2002 15:56:46 -0000=091.28
> +++ atomic.h=0912 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=
=2E)
> that you could disable.
>
>
> Tim

--=20
--- @(#) $Id: dot.signature,v 1.10 2001/05/17 23:38:49 Jim.Pirzyk Exp $
    __o   jim@pirzyk.org -----------------------------------------------
 _'\<,_   =20
(*)/ (*) =20

--------------Boundary-00=_9CUV7Z6LSNKL5YY5ETYH
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="vmware.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="vmware.patch"

--- 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)

--------------Boundary-00=_9CUV7Z6LSNKL5YY5ETYH--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210121204.57782.jim>