*BSD News Article 78391


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!nntp.primenet.com!news.sgi.com!spool.mu.edu!munnari.OZ.AU!news.mel.connect.com.au!news.syd.connect.com.au!news.bri.connect.com.au!corolla.OntheNet.com.au!news
From: Tony Griffiths <tonyg@OntheNet.com.au>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: gcc optimizations for kernel
Date: Mon, 16 Sep 1996 19:48:31 +1000
Organization: On the Net (ISP on the Gold Coast, Australia)
Lines: 33
Message-ID: <323D226F.68FA@OntheNet.com.au>
References: <51d0eg$9uf@usenet4.interramp.com> <323A693E.7B4C@OntheNet.com.au> <8791ad5jed.fsf@plm.xs4all.nl>
Reply-To: tonyg@OntheNet.com.au
NNTP-Posting-Host: swanee.nt.com.au
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (WinNT; I)

Peter Mutsaers wrote:
> 
> >> On Sat, 14 Sep 1996 18:13:50 +1000, Tony Griffiths
> >> <tonyg@OntheNet.com.au> said:
> 
>     TG> The higher levels of optimisation are "probably" OK for
>     TG> non-device driver code, but would almost certainly bring you
>     TG> undone in a driver.  Re-arranging the order of 'bashing'
>     TG> device registers is generally not a good thing.
> 
>     TG> If you feel brave enough to go through and modify the make
>     TG> file, then you might get a "-O3" kernel to work but it will be
>     TG> a LOT of work!!!
> 
> Hmm, I've been running for months with a kernel compiled with -O2,
> without problems. I assume that the sections of device drivers that
> depend on order are not reordered by gcc, or the makefiles force that
> -O2 not be used for such files.
> --
> Peter Mutsaers  |  Abcoude (Utrecht),
> plm@xs4all.nl   |  the Netherlands

Looking at the man page for gcc doesn't indicate whether the code
generator for the ix86 performs instruction scheduling (ie. re-ordering)
which is highly necessary for performance on RISC architectures.  With
no instruction re-ordering and no function inlining (and maybe even with
function inlining and loop unrolling with -O3) device drivers should
work so it would seem that -O2 is OK and probably even -O3 !

Wouldn't do this on an Alpha, PPC, Sparc, or Mips machine however for
driver modules...

Tony