NetBSD Problem Report #8847

Received: (qmail 29584 invoked from network); 22 Nov 1999 12:41:18 -0000
Message-Id: <199911221238.EAA21349@uni.wrs.com>
Date: Mon, 22 Nov 1999 04:38:16 -0800 (PST)
From: toddpw@best.com
Reply-To: toddpw@best.com
To: gnats-bugs@gnats.netbsd.org
Subject: xe0 Rx dma panic
X-Send-Pr-Version: 3.95

>Number:         8847
>Category:       port-next68k
>Synopsis:       xe0 gets a weird DMA Rx interrupt and panics, frequently
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    port-next68k-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 22 04:45:00 +0000 1999
>Closed-Date:    Sun Jan 16 11:43:05 +0000 2000
>Last-Modified:  Sun Jan 16 11:45:34 +0000 2000
>Originator:     Todd Whitesel
>Release:        cvs co -D "1999-11-10 12:00" src
>Organization:

>Environment:
System: NetBSD yoda.toddpw.net 1.4M NetBSD 1.4M (GENERIC) #3: Sat Oct 16 08:07:49 PDT 2021 toddpw@yoda.toddpw.net:/usr/src/sys/arch/next68k/compile/GENERIC
>Description:
NOTE: This machine's clock battery is dead. After a cold boot the time is
always ludicrous: 1926, 1959, and 2021 have all been observed.
Kernel built from sources checked out with -D "1999-11-10 12:00".
Seems to die immediately if rdate (even -p) is attempted.
Local use of 'date' to set the clock works fine.
After some amount of NFS (diskless) activity, which varies widely from
seconds to roughly an hour, the following panic is observed (typed in manually,
but double-checked):
NDMAP: *intrstat = 0x8000220<ENETR_DMA,ENETR,VIDEO>
NDMAP: *intrmask = 0xffffffffb8027648<NMI,TIMER,ENETX_DMA,ENETR_DMA,SCC,DSP_4,DISK|C16_VIDEO,SCSI,ENETX,ENETR,DSP_3,KYBD_MOUSE>
NDMAP: nd->_nd_map->dm_mapsize = 2016
NDMAP: nd->_nd_map->dm_nsegs = 1
NDMAP: nd->_nd_map->dm_segs[0].ds_addr = 0x0504a000
NDMAP: nd->_nd_map->dm_segs[0].ds_len = 2016
NDMAP: nd->_nd_map->dm_segs[0].ds_xfer_len = 305446639
NDMAP: nd->_nd_map_cont->dm_mapsize = 2016
NDMAP: nd->_nd_map_cont->dm_nsegs = 1
NDMAP: nd->_nd_map_cont->dm_segs[0].ds_addr = 0x05027800
NDMAP: nd->_nd_map_cont->dm_segs[0].ds_len = 2016
NDMAP: nd->_nd_map_cont->dm_segs[0].ds_xfer_len = 222
NDMAP: dd->dd_csr          = 0x2e000000<COMPLETE,READ,SUPDATE>
NDMAP: dd->dd_saved_next   = 0x0504a000
NDMAP: dd->dd_saved_limit  = 0x0504208e
NDMAP: dd->dd_saved_start  = 0x05027800
NDMAP: dd->dd_saved_stop   = 0x05027fe0
NDMAP: dd->dd_next         = 0x0504a046
NDMAP: dd->dd_next_initbuf = 0x0504a046
NDMAP: dd->dd_limit        = 0x0504a7e0
NDMAP: dd->dd_start        = 0x05027800
NDMAP: dd->dd_stop         = 0x05027fe0
NDMAP: interrupt ipl (6) intr(0x8000000<ENETR_DMA>)
panic: DMA Unexpected dma state in interrupt (0x2e000000<COMPLETE,READ,SUPDATE>)
Stopped in sh at        _cpu_Debugger+0x6:      unlk    a6
db> trace
_cpu_Debugger(1b62,2e000000,6cbdcc,409e2a,6cbd8c) + 6
_panic(e4769,2e000000,e423e,409e2a,0) + 52
_nextdma_intr(409e2a,2004,2,2000,6c2e20) + 8a
_isrdispatch_autovec(1c48,78,6cbdcc) + 8c
_intrhand_autovec(?)
_pmap_enter(404100,29000,50f8000,5,0,1) + 14
_uvm_fault(618ca8,29000,0,1) + d02
_trap(8,5e2,29890) + 57c
faultstkadj() + 0
db>

>How-To-Repeat:
	Set up a 1.4 next68k installation and boot a Warp9 slab over NFS.
	Compile a kernel with sources checked out (from an rsync'd repository)
	using 'cvs co -D "1999-11-10 12:00" src'.
	Build kernel, restarting if necessary due to seg fault in make, and
	start trying to build a userland for the kernel.
	Eventually it will croak.
	Did not experience this problem with the 1.4 kernel.
>Fix:


From nobody Tue Dec 14 05:45:36 1999
X-From-Line: chris@Nice.CH Sat Dec 11 17:55:36 1999
Return-Path: <chris@Nice.CH>
Delivered-To: dbj@netbsd.org
Received: from mail.netbsd.org
	by dbj.ne.mediaone.net with POP3 (fetchmail-4.7.5)
	for dbj@localhost (single-drop); Sat, 11 Dec 1999 17:55:36 -0500 (EST)
Received: (qmail 10483 invoked from network); 11 Dec 1999 20:00:05 -0000
Received: from nice.ethz.ch (root@129.132.134.85)
  by redmail.netbsd.org with SMTP; 11 Dec 1999 20:00:05 -0000
Received: from GARGLE (slip4-18.restena.lu [158.64.101.147])
	by nice.ethz.ch (8.8.7/8.8.7) with SMTP id UAA13580
	for <dbj@netbsd.org>; Sat, 11 Dec 1999 20:59:59 +0100 (MET)
Message-ID: <03e701bf4412$6bb33530$07ac2ac0@pin.lu>
From: "Christian Limpach" <chris@Nice.CH>
To: "Darrin B. Jewell" <dbj@netbsd.org>
References: <19991207062757.28518.qmail@mail.netbsd.org> <2c8001bf40fc$38508300$07ac2ac0@pin.lu> <qq1z8yp9bc.fsf@dbj.ne.mediaone.net>
Subject: Re: other next68k stuff (was Re: port-next68k/8962)
Date: Sat, 11 Dec 1999 20:59:15 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_03E2_01BF441A.9530E030"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.5600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.5600
X-UIDL: 2843c58754af38c4937eb10979c6eb4d
Lines: 159
Xref: dbj.ne.mediaone.net mail.netbsd.personal:1619

This is a multi-part message in MIME format.

------=_NextPart_000_03E2_01BF441A.9530E030
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

> No, I had been hacking on the esp scsi driver without success, but hadn't
> been tracking -current.  Unfortunately, I've been rather lame about
> general port maintenance for the last few months.

can you send me what you've done so far?  I might give it a try, unless I
find something more useful to do.  I don't know exactly what to do with
netbsd-Next, the machines are so slow, I don't use them.  Nevertheless I
like to fix things but right now, there's nothing to fix.  I have one
machine with:
$ uname -a
NetBSD arkin.pin.lu 1.4.1 NetBSD 1.4.1 (ARKIN) #0: Fri Oct 22 16:39:49 CEST
1999

root@arkin.pin.lu:/mnt/devel/netbsd/src-1.4.1/sys/arch/next68k/compile/ARKI
N next68k
$ uptime
 7:30PM  up 27 days, 10 mins, 2 users, load averages: 1.16, 1.10, 1.09

Of course, I don't do anything on the machine, except run gdb netbsd.gdb for
remote kernel debug of the machine I hack on...
Maybe getting X11-server going would be nice and not too hard.  Or sound-out
but there I don't have a clue where to start.

> There was significant rototilling of the dma driver before and after
> the 1.4 branch creation.  I know I introduced some of the problems
> around that time in sys/arch/next68k/dev/nextdma.c and we probably
> review the differences in nextdma.c between revision 1.10 and -current.

I've fixed the problem that's been keeping me from using anything newer than
1.4.1 now.  I tracked down the problem checkin, it's the big reorg of
nextdma.c between 1.19 and 1.20.  It didn't introduce a new bug but it
activated a check which wasn't activated before.  It's the
is-the-limit-in-the-right-window-check which was ifdeffed before because
some DMA-regs would sometimes have strange values.  I think I've fixed the
DMA-reg stuff for now:   at the end of nextdma_intr, when the csr is poked
to make DMA do something, I think the check for the ENABLE bit introduces a
race condition.  I fixed this by unconditionally setting DMACSR_SETENABLE,
this seems to work and also makes the code more readable.  I've also tried
setting DMACSR_SETSUPDATE unconditionally and this also works well, but I
don't know what it implies.  Unless you have reasons to not set SUPDATE all
the time, I'd suggest making this change as well, it makes the code cleaner
and faster...

What's missing in nextdma.c is an explanation of how nextdma works, I've got
a basic idea now, but there are still some questions left.
Like:
if you do SETSUPDATE | CLRCOMPLETE and ENABLE is not set, do you get an
interrupt with SUPDATE set?  or when do you get an interrupt with SUPDATE
set?  because if you SETSUPDATE | CLRCOMPLETE | SETENABLE, SUPDATE seems
never to be set in an interrupt (there's a check for that with a panic and I
haven't had a panic with the fixed kernel yet...)  To me it seems that if
SUPDATE is set in the interrupt, we missed more than 1 interrupt and the
update of ds_xfer_len is incorrect.  The data seems to be there, and things
go on without a problem...  but this might not matter since as mentioned, I
haven't had a panic since I made the fix...

> I hope to try building -current again myself soon, but it may be a few
> weeks until i get to it.  Bug me if you think I can answer a question
> or otherwise help.  It's really helpful to me that you're hacking on
> it.

I've built a kernel from a 19991025 current snapshot.
I've also tried building a kernel from a more recent snapshot but it failed
because I was missing some new files (softdep related, ISTR) which I haven't
in my local CVS-rep yet...  But I'll probably give it another try now that
the DMA-problem is fixed...

apropos remote kernel debugging with gdb:  I had to add 2 files to get this
going:
sys/arch/next68k/next68k/kgdb_machdep.c from
sys/arch/sun3/sun3/kgdb_machdep.c
sys/arch/next68k/next68k/stub.c from sys/arch/sun3/sun3/stub.c
with these two files in place, kgdb works and is very useful ;-)
Maybe the DEBUG and DIAGNOSTICS options should be moved in front of the DDB
related options since they are also used with kgdb...
Can you add these two files?

    christian


------=_NextPart_000_03E2_01BF441A.9530E030
Content-Type: application/octet-stream;
	name="nextdma.c-patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="nextdma.c-patch"

Index: nextdma.c=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/netbsd/current/src/sys/arch/next68k/dev/nextdma.c,v=0A=
retrieving revision 1.1.1.1=0A=
diff -u -r1.1.1.1 nextdma.c=0A=
--- nextdma.c	1999/10/24 22:14:39	1.1.1.1=0A=
+++ nextdma.c	1999/12/11 19:04:12=0A=
@@ -505,34 +505,19 @@=0A=
 				dmadir =3D DMACSR_SETWRITE;=0A=
 			}=0A=
 =0A=
-			if (state & DMACSR_ENABLE) {=0A=
-=0A=
-				if ((nd->_nd_map_cont =3D=3D NULL) && (nd->_nd_idx+1 =3D=3D =
nd->_nd_map->dm_nsegs)) {=0A=
-					bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,=0A=
-							DMACSR_CLRCOMPLETE | dmadir);=0A=
-				} else {=0A=
-					bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,=0A=
-							DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETSUPDATE);=0A=
-				}=0A=
-=0A=
+				/* we used to SETENABLE here only=0A=
+                                   conditionally, but we got burned=0A=
+                                   because DMA sometimes would shut=0A=
+                                   down between when we checked and=0A=
+                                   when we acted upon it.  CL19991211 */=0A=
+			if ((nd->_nd_map_cont =3D=3D NULL) && (nd->_nd_idx+1 =3D=3D =
nd->_nd_map->dm_nsegs)) {=0A=
+				bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,=0A=
+						  DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETENABLE);=0A=
 			} else {=0A=
-=0A=
-#if (defined(ND_DEBUG))=0A=
-				if (nextdma_debug) next_dma_print(nd);=0A=
-#endif=0A=
-#if 0 && defined(DIAGNOSTIC)=0A=
-				printf("DMA: Unexpected shutdown, restarting intr(0x%b)\n",=0A=
-						NEXT_I_BIT(nd->nd_intr),NEXT_INTR_BITS);=0A=
-#endif=0A=
-=0A=
-				if ((nd->_nd_map_cont =3D=3D NULL) && (nd->_nd_idx+1 =3D=3D =
nd->_nd_map->dm_nsegs)) {=0A=
-					bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR, =0A=
-							DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETENABLE);=0A=
-				} else {=0A=
-					bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,=0A=
-							DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETSUPDATE | =
DMACSR_SETENABLE);=0A=
-				}=0A=
+				bus_space_write_4(nd->nd_bst, nd->nd_bsh, DD_CSR,=0A=
+						  DMACSR_CLRCOMPLETE | dmadir | DMACSR_SETSUPDATE | =
DMACSR_SETENABLE);=0A=
 			}=0A=
+=0A=
 		}=0A=
 =0A=
 	}=0A=

------=_NextPart_000_03E2_01BF441A.9530E030--




>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: dbj 
State-Changed-When: Sun Jan 16 03:43:05 PST 2000 
State-Changed-Why:  
applied patch from "Christian Limpach" <chris@Nice.CH> 
which has alleviated the problem 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.