NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/42662: iop driver makes kernel crash or freeze



The following reply was made to PR kern/42662; it has been noted by GNATS.

From: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
To: Aleksej Saushev <asau%inbox.ru@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, kern-bug-people%NetBSD.org@localhost, 
gnats-admin%NetBSD.org@localhost,
        netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/42662: iop driver makes kernel crash or freeze
Date: Mon, 8 Feb 2010 19:48:37 +0100

 On Mon, Feb 08, 2010 at 08:21:09PM +0300, Aleksej Saushev wrote:
 > Manuel Bouyer <bouyer%antioche.eu.org@localhost> writes:
 > 
 > > On Sat, Jan 30, 2010 at 06:42:37PM +0300, Aleksej Saushev wrote:
 > >> I applied it to the current instead, it crashes with the same diagnostic
 > >> message and similar backtrace, only it seems to do it a bit later.
 > >> I can try to replace as many instances of the pattern as needed,
 > >> can you recommend how many of them? All in that subroutine?
 > >
 > > All of them, mixing PRE and POST in bus_dma(9) is not allowed.
 > > I also found one mistake where a PRE should have been a POST.
 > > Please try the attached patch (still against netbsd-5).
 > 
 > The following fixes the problem for me, I can boot installation CD and
 > have access to disk storage (am able to read disklabel).
 > 
 > --- sys/dev/i2o/iop.c        21 Oct 2009 21:12:05 -0000      1.77
 > +++ sys/dev/i2o/iop.c        8 Feb 2010 17:19:57 -0000
 > @@ -928,7 +928,7 @@
 >          BUS_DMASYNC_PREWRITE);
 >      memset(st, 0, sizeof(*st));
 >      bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*st),
 > -        BUS_DMASYNC_PREREAD|BUS_DMASYNC_POSTWRITE);
 > +        BUS_DMASYNC_POSTWRITE);
 >  
 >      if ((rv = iop_post(sc, (u_int32_t *)&mf)) != 0)
 >              return (rv);
 > @@ -993,7 +993,7 @@
 >          BUS_DMASYNC_PREWRITE);
 >      *sw = 0;
 >      bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw),
 > -        BUS_DMASYNC_PREREAD|BUS_DMASYNC_POSTWRITE);
 > +        BUS_DMASYNC_POSTWRITE);
 >  
 >      if ((rv = iop_post(sc, mb)) != 0)
 >              return (rv);
 
 But the third bus_dmamap_sync() fix is probably also required, the
 bus_dmamap_sync usage here is wrong and things will go wrong on any
 platform where a bus_dmamap_sync() is more than a simple memory
 barrier. On i386 you won't see it; you may on amd64 with
 more than 4Gb ram (depending on how the memory used here was allocated).
 
 -- 
 Manuel Bouyer <bouyer%antioche.eu.org@localhost>
      NetBSD: 26 ans d'experience feront toujours la difference
 --
 


Home | Main Index | Thread Index | Old Index