Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jun 1997 14:56:04 -0400 (EDT)
From:      Thomas David Rivers <ponds!rivers@dg-rtp.dg.com>
To:        ponds!hq.icb.chel.su!babkin, ponds!time.cdrom.com!jkh
Cc:        ponds!FreeBSD.ORG!hackers
Subject:   Re: C optimizer bug ?
Message-ID:  <199706151856.OAA10921@lakes.water.net>

next in thread | raw e-mail | index | archive | help
> > 
> > > I tried everything and finally decided to build the kernel
> > > without the optimization. Everything started working fine!
> > > So the C optimizer seems like having a bug.
> > 
> > Without trying to reduce this down to something others can actually
> > reproduce, however, this basically goes into the same category as
> > UFO sightings and alien abductions.  There's strong evidence that
> > it _might_ happen, but with no concrete proof we can only continue
> > to speculate as to whether or not they're real. :-)
> 
> Okay, here is the description: The function scsi_done() must check
> whether xs->bp is zero and then depending on it call biodone()
> or wakeup(xs). Sometimes it confuses these cases and does the
> wrong thing, in this case the process hangs on tsleep(...,"scsicmd")
> or waiting for biodone() (I can't remember the argument of
> tsleep() for biodone exactly). The probability of hangup on missing
> wakeup(xs) is about 1/4. The hangups on missing biodone() are
> rare.
> 
> In case of any delays caused by printf() or tcpdump or
> using a loopback Ethernet card simulator
> the SCSI simulator is able to finish the operation before the
> scsi_scsi_cmd() function gets control back from the SCSI
> card driver and in this case it just does not sleep. The hangups
> on missing biodone() still occur even with delays.
> 
> I don't know how to reproduce this bug without all those
> simulators but I think it should be possible.


 Hey!!!  

  This sounds an awful lot like my "daily panic" problem - when I
put printf()s around scsi_done, etc... the problem goes away. [Although,
my problem isn't limited to SCSI...]

  Since I've demonstrated this with older and newer versions of FreeBSD,
which used at least two different GCC compilers - I tend to think
it's not a compiler problem...

  I'll bet you'll discover something else is trashing some memory.
Likely overwriting memory that's in a different location when you
don't optimize.  That also why adding printf()s "helps" the problem;
as the printf()s change the size of the stack...

	- Dave Rivers -
> 
> -SB
> 



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