Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Optimise VMware for Gentoo (CFLAGS/gcc-3.2)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
kerframil
l33t
l33t


Joined: 19 Apr 2002
Posts: 712

PostPosted: Fri Dec 06, 2002 11:45 am    Post subject: HOWTO: Optimise VMware for Gentoo (CFLAGS/gcc-3.2) Reply with quote

Any VMWare users here? I've found a way to optimise VMWare for gcc-3.2 and to make it follow your CFLAGS scheme for your processor arch.

Have a look in /opt/vmware/lib/modules. There are three tar files: vmmon.tar, vmnet.tar and vmppuser.tar. Extract them:
Code:
tar -xf vmmon.tar
tar -xf vmnet.tar
tar -xf vmppuser.tar

Go into the sub-directory for each one (these sub-directories are vmmon-only, vmnet-only and vmppuser-only) and look at the Makefile. In each case, delete these two lines (they don't work properly anyway):
Code:

COMPILER_VERSION :=$(shell $(CC) --version)
IS_GCC_30 := $(shell if echo $(COMPILER_VERSION) | $(GREP) -q '^3\.0'; then echo yes; else echo no; fi)

On the line beginning with "CC_KFLAGS = -D__KERNEL__" change:
Code:
-malign-loops=2
-malign-jumps=2
-malign-functions=2

to:
Code:
-falign-loops=2
-falign-jumps=2
-falign-functions=2

and remove the -DCPU=586 option. Just to be clear, all the aforementioned is on one line of code. However this line may be separated into several by usage of the backslash, which allows continuation of a line of code in a shell script. Bear that in mind while you're making the edit.

Delete these lines (I've omitted the lines containted in the ifeq block for brevity):
Code:
ifeq ($(IS_GCC_30),yes)
  # the other stuff in the block
endif

Where the above block was, add this (it will pick up your settings from the first valid CFLAGS line in make.conf, not #commented ones fortunately):

Code:
CC_KFLAGS += `grep "^CFLAGS" /etc/make.conf | grep -o -E "(-march|-mcpu)=\w+"`

Do all of that for each Makefile. Just for completeness, do a chown qmaild:qmail Makefile on each one (the files in the tarballs have these bizarre permissions for some reason). Now step back up to /opt/vmware/lib/modules. Rename your original tar files, then tar the directories up again:
Code:
tar -cf vmmon.tar vmmon-only/*
tar -cf vmnet.tar vmnet-only/*
tar -cf vmppuser.tar vmppuser-only/*

Now you can get rid of those sub-directories. Stop your VMWare services, make sure the modules aren't loaded and run the vmware-config.pl script again, and enjoy!

There's a bug in the vmware-config script which throws up needless errors. These errors are harmless but irritating. A fix will hopefully be forthcoming in a subsequent edit of this post.

BTW, would anyone like to try VMWare with -O3 optimisation? I haven't dared to try it yet. The above is perfectly stable though, and the modifications above pay no heed to your -O setting. The Makefiles are hardcoded with -O2.
Back to top
View user's profile Send private message
gunman
n00b
n00b


Joined: 16 Jun 2002
Posts: 20
Location: Germany

PostPosted: Fri Dec 06, 2002 2:31 pm    Post subject: what do these patch do? Reply with quote

what performance patch is that. is vmware running quicker?

-gunnar
Back to top
View user's profile Send private message
proxy
Apprentice
Apprentice


Joined: 20 Apr 2002
Posts: 260
Location: Chantilly, VA

PostPosted: Fri Dec 06, 2002 7:45 pm    Post subject: Reply with quote

no need to delete the --version lines, just replace --version with -dumpversion, that outputs 3.2 (which it handles just fine :P) ..same thing with the vmware-config.pl file.

rest of tip is great though
Back to top
View user's profile Send private message
Carlo
Developer
Developer


Joined: 12 Aug 2002
Posts: 3356

PostPosted: Thu Dec 12, 2002 4:40 pm    Post subject: Reply with quote

Thank you, kerframil and proxy. I had to recompile the modules today, so I tweaked the files. Can't say that I got a remarkable boost in performance, but the vm is running stable.

My CFLAGS:
Code:
-O2 -march=athlon-xp -pipe -funroll-loops -fforce-addr -fomit-frame-pointer



What about the smp option? I thought vmware depends on a smp kernel!?! Is a single processor machine faster with or without smp support, when running vmware?


Carlo
Back to top
View user's profile Send private message
kerframil
l33t
l33t


Joined: 19 Apr 2002
Posts: 712

PostPosted: Thu Dec 12, 2002 5:32 pm    Post subject: Reply with quote

Carlo wrote:
Thank you, kerframil and proxy. I had to recompile the modules today, so I tweaked the files. Can't say that I got a remarkable boost in performance, but the vm is running stable.

Well, the VMware binaries are still going to be in their pre-compiled form. Nothing much we can do there seeing as VMware isn't open source. But at least now the VMware kernel modules are compiled well for your system so it should make VMware's interaction with the kernel a bit more efficient.

Carlo wrote:
My CFLAGS:
Code:
-O2 -march=athlon-xp -pipe -funroll-loops -fforce-addr -fomit-frame-pointer

The only thing that will have had any effect is the "-march=athlon-xp" part. If you want the VMware kernel module Makefiles to pay attention to the other flags you'll need to modify the Makefiles accordingly, or follow the lead given and make it grep your make.conf for other parts - as it does with -march or -mcpu now. Maybe -fomit-frame-pointer is safe but that's about as far as I'd go personally. If you were to build an unstable kernel module it could be disastrous because, naturally, it runs in kernel space and if it goes wrong could do all manner of nasty things to your system. That's why I made sure it ignores the other flags.
Carlo wrote:
What about the smp option? I thought vmware depends on a smp kernel!?! Is a single processor machine faster with or without smp support, when running vmware?

I'm running it on a machine and kernel that is most definitely not SMP capable so I guess you've been misinformed. As to whether it's faster ... I think it's probably too good to be true that VMware would have been explicity built with SMP awareness in - making an emulated/pass-through x86 take advantage of OS specific SMP paths is probably far from trivial! Does anyone know better?

Even so, it should be just a little quicker because at least Linux can balance out other processes while VMware is running.
Back to top
View user's profile Send private message
delta407
Bodhisattva
Bodhisattva


Joined: 23 Apr 2002
Posts: 2876
Location: Chicago, IL

PostPosted: Mon Dec 16, 2002 3:46 pm    Post subject: Reply with quote

VMware does not support emulation of multiple processors, but it uses several different processes (2 vmware processes, X, and so on), as well as the kernel modules, and thus is capable of at least partially using more than one CPU.
_________________
I don't believe in witty sigs.
Back to top
View user's profile Send private message
Carlo
Developer
Developer


Joined: 12 Aug 2002
Posts: 3356

PostPosted: Mon Dec 16, 2002 9:51 pm    Post subject: Reply with quote

kerframil wrote:
Well, the VMware binaries are still going to be in their pre-compiled form. Nothing much we can do there seeing as VMware isn't open source. But at least now the VMware kernel modules are compiled well for your system so it should make VMware's interaction with the kernel a bit more efficient.

Sure. I hoped the optimization of the vmnet module would speed up the system a bit, because of the high load it has to accomplish here.

kerframil wrote:
Carlo wrote:
My CFLAGS:
Code:
-O2 -march=athlon-xp -pipe -funroll-loops -fforce-addr -fomit-frame-pointer

The only thing that will have had any effect is the "-march=athlon-xp" part. If you want the VMware kernel module Makefiles to pay attention to the other flags you'll need to modify the Makefiles accordingly, or follow the lead given and make it grep your make.conf for other parts - as it does with -march or -mcpu now. Maybe -fomit-frame-pointer is safe but that's about as far as I'd go personally. If you were to build an unstable kernel module it could be disastrous because, naturally, it runs in kernel space and if it goes wrong could do all manner of nasty things to your system. That's why I made sure it ignores the other flags.


Ouch. You're right. I should read what I'm doing, not just copy & paste.


Thanks again,
Carlo
Back to top
View user's profile Send private message
yamakawa
Guru
Guru


Joined: 28 Jul 2003
Posts: 340

PostPosted: Sun Feb 22, 2004 5:05 pm    Post subject: Reply with quote

I get here to find a topic with the keywords "vmware" and "proxy"
But there is no topin on them.

@proxy, would you mind stopping use your current name so that everyone would not be confused your name with very popular keyword "proxy"? Or lots of us have difficulty to find topis related to proxy. :?
Back to top
View user's profile Send private message
NewBlackDak
Guru
Guru


Joined: 02 Nov 2003
Posts: 512
Location: Utah County, UT

PostPosted: Sun Feb 22, 2004 10:14 pm    Post subject: Reply with quote

yamakawa wrote:
I get here to find a topic with the keywords "vmware" and "proxy"
But there is no topin on them.

@proxy, would you mind stopping use your current name so that everyone would not be confused your name with very popular keyword "proxy"? Or lots of us have difficulty to find topis related to proxy. :?


I guess I should not use black, so anyone searching for blackbox wont see my posts!! LOL

That is a ridiculos requet.
_________________
Gentoo systems.
X2 4200+@2.6 - Athy
X2 3600+ - Myth
UltraSparc5 440 - sparcy
Back to top
View user's profile Send private message
yamakawa
Guru
Guru


Joined: 28 Jul 2003
Posts: 340

PostPosted: Mon Feb 23, 2004 2:03 am    Post subject: Reply with quote

I do not think so. b/c those people use blackbox rather than just black. The problem is proxy is the exact match of well-known and often-used word.
I just wanted you guys to pay a little attention when you name yourself.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum