NetBSD Problem Report #42662
From asau@inbox.ru Fri Jan 22 17:49:44 2010
Return-Path: <asau@inbox.ru>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id DDE4163C54F
for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Jan 2010 17:49:43 +0000 (UTC)
Message-Id: <87pr523u8n.fsf@inbox.ru>
Date: Fri, 22 Jan 2010 20:49:28 +0300
From: Aleksej Saushev <asau@inbox.ru>
Reply-To:
To: gnats-bugs@gnats.NetBSD.org
Subject: iop driver makes kernel crash or freeze
>Number: 42662
>Category: kern
>Synopsis: iop driver makes kernel crash or freeze
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 22 17:50:01 +0000 2010
>Closed-Date: Mon Oct 25 02:09:51 +0000 2010
>Last-Modified: Mon Oct 25 02:09:51 +0000 2010
>Originator: Aleksej Saushev <asau@inbox.ru>
>Release: NetBSD 5.99.24
>Organization:
>Environment:
Installation CD
Architecture: i386
Machine: i386
>Description:
5.0_STABLE installation kernel panics when initializing iop driver,
5.99.24 kernel as of 2009-01-21 crashes too,
5.99.24 kernel as of today doesn't crash, it freezes instead.
All diagnostics below corresponds to 5.0_STABLE.
Kernel message at panic:
iop0 at pci3 dev 3 function 0: I2O adapterpanic: _bus_dmamap_sync: mix PRE and POST
fatal breakpoint trap in supervisor mode
trap type 1 code 0 eip c057855c cs 246 cr2 0 ilevel 8
Backtrace (recorded manually):
breakpoint ()
panic ()
_bus_dmamap_sync () ... + 0x194
iop_status_get () ... + 0xc7
iop_init () ... + 0x529
iop_pci_attach () ... + 0x1c7
config_attach_loc () ... + 0x163
pci_probe_device ()
pci_enumerate_bus ()
pcirescan ()
pciattach ()
config_attach_loc ()
config_found_ia ()
ppbatttach ()
...
BIOS reports "ADAPTEC I2O BIOS v001.62 (2002/11/06)"
Another, possibly unrelated problem affects only current:
when disabling iop in userconf, current fails to mount root fs
and starts probing for /sbin/init, /sbin/oinit and so on.
>How-To-Repeat:
Boot installation CD.
>Fix:
Please!
>Release-Note:
>Audit-Trail:
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/42662: iop driver makes kernel crash or freeze
Date: Fri, 22 Jan 2010 19:05:45 +0100
--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Fri, Jan 22, 2010 at 05:50:01PM +0000, Aleksej Saushev wrote:
> 5.0_STABLE installation kernel panics when initializing iop driver,
> 5.99.24 kernel as of 2009-01-21 crashes too,
> 5.99.24 kernel as of today doesn't crash, it freezes instead.
>
> All diagnostics below corresponds to 5.0_STABLE.
>
> Kernel message at panic:
>
> iop0 at pci3 dev 3 function 0: I2O adapterpanic: _bus_dmamap_sync: mix PRE and POST
Can you try the attached patch on netbsd-5 ?
No idea why it hangs on current, more info needed.
> [...]
> Another, possibly unrelated problem affects only current:
> when disabling iop in userconf, current fails to mount root fs
> and starts probing for /sbin/init, /sbin/oinit and so on.
Looks more like a module issue; the ffs module is not loaded.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="iop.diff"
Index: iop.c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2o/iop.c,v
retrieving revision 1.77
diff -u -p -u -r1.77 iop.c
--- iop.c 21 Oct 2009 21:12:05 -0000 1.77
+++ iop.c 22 Jan 2010 18:03:53 -0000
@@ -928,7 +928,7 @@ iop_status_get(struct iop_softc *sc, int
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);
--NzB8fVQJ5HfG6fxh--
From: Aleksej Saushev <asau@inbox.ru>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/42662: iop driver makes kernel crash or freeze
Date: Sat, 30 Jan 2010 18:42:37 +0300
Manuel Bouyer <bouyer@antioche.eu.org> writes:
> On Fri, Jan 22, 2010 at 05:50:01PM +0000, Aleksej Saushev wrote:
> > 5.0_STABLE installation kernel panics when initializing iop driver,
> > 5.99.24 kernel as of 2009-01-21 crashes too,
> > 5.99.24 kernel as of today doesn't crash, it freezes instead.
> >
> > All diagnostics below corresponds to 5.0_STABLE.
> >
> > Kernel message at panic:
> >
> > iop0 at pci3 dev 3 function 0: I2O adapterpanic: _bus_dmamap_sync: mix PRE and POST
>
> Can you try the attached patch on netbsd-5 ?
> No idea why it hangs on current, more info needed.
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?
> RCS file: /cvsroot/src/sys/dev/i2o/iop.c,v
> --- iop.c 21 Oct 2009 21:12:05 -0000 1.77
> +++ iop.c 22 Jan 2010 18:03:53 -0000
> @@ -928,7 +928,7 @@ iop_status_get(struct iop_softc *sc, int
> 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);
--
HE CE3OH...
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: Aleksej Saushev <asau@inbox.ru>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
netbsd-bugs@NetBSD.org
Subject: Re: kern/42662: iop driver makes kernel crash or freeze
Date: Sat, 30 Jan 2010 19:21:16 +0100
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Sat, Jan 30, 2010 at 06:42:37PM +0300, Aleksej Saushev wrote:
> Manuel Bouyer <bouyer@antioche.eu.org> writes:
>
> > On Fri, Jan 22, 2010 at 05:50:01PM +0000, Aleksej Saushev wrote:
> > > 5.0_STABLE installation kernel panics when initializing iop driver,
> > > 5.99.24 kernel as of 2009-01-21 crashes too,
> > > 5.99.24 kernel as of today doesn't crash, it freezes instead.
> > >
> > > All diagnostics below corresponds to 5.0_STABLE.
> > >
> > > Kernel message at panic:
> > >
> > > iop0 at pci3 dev 3 function 0: I2O adapterpanic: _bus_dmamap_sync: mix PRE and POST
> >
> > Can you try the attached patch on netbsd-5 ?
> > No idea why it hangs on current, more info needed.
>
> 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).
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="iop.diff"
Index: iop.c
===================================================================
RCS file: /cvsroot/src/sys/dev/i2o/iop.c,v
retrieving revision 1.75
diff -u -p -u -r1.75 iop.c
--- iop.c 14 Sep 2008 18:12:16 -0000 1.75
+++ iop.c 30 Jan 2010 18:19:36 -0000
@@ -928,7 +928,7 @@ iop_status_get(struct iop_softc *sc, int
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 @@ iop_ofifo_init(struct iop_softc *sc)
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);
@@ -1550,7 +1550,7 @@ iop_reset(struct iop_softc *sc)
BUS_DMASYNC_PREWRITE);
*sw = htole32(0);
bus_dmamap_sync(sc->sc_dmat, sc->sc_scr_dmamap, 0, sizeof(*sw),
- BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
+ BUS_DMASYNC_POSTWRITE);
if ((rv = iop_post(sc, (u_int32_t *)&mf)))
return (rv);
--tThc/1wpZn/ma/RB--
From: Aleksej Saushev <asau@inbox.ru>
To: Manuel Bouyer <bouyer@antioche.eu.org>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/42662: iop driver makes kernel crash or freeze
Date: Mon, 08 Feb 2010 20:21:09 +0300
Manuel Bouyer <bouyer@antioche.eu.org> 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);
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: Aleksej Saushev <asau@inbox.ru>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
netbsd-bugs@NetBSD.org
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> 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>
NetBSD: 26 ans d'experience feront toujours la difference
--
From: Aleksej Saushev <asau@inbox.ru>
To: Manuel Bouyer <bouyer@antioche.eu.org>
Cc: gnats-bugs@NetBSD.org, kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/42662: iop driver makes kernel crash or freeze
Date: Mon, 08 Feb 2010 22:06:03 +0300
Manuel Bouyer <bouyer@antioche.eu.org> writes:
> On Mon, Feb 08, 2010 at 08:21:09PM +0300, Aleksej Saushev wrote:
>> The following fixes the problem for me, I can boot installation CD and
>> have access to disk storage (am able to read disklabel).
...
> 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).
I cannot check it anywhere else, I don't have other hardware.
--
HE CE3OH...
From: Aleksej Saushev <asau@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42662 CVS commit: src/sys/dev/i2o
Date: Fri, 19 Feb 2010 12:36:15 +0000
Module Name: src
Committed By: asau
Date: Fri Feb 19 12:36:15 UTC 2010
Modified Files:
src/sys/dev/i2o: iop.c
Log Message:
Don't mix BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTWRITE.
Suggested by <bouyer>, fixes PR kern/42662
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/i2o/iop.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 25 Oct 2010 02:09:51 +0000
State-Changed-Why:
Submitter committed a fix in February.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.