Port-atari archive

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

pool panic on installer



(subject changed and start a new thread)

In article 
<5d8b91e0812191846u44cd5be3l7fc067e2a0c5d2c7%mail.gmail.com@localhost>
Tuomo wrote:

> I fixed atari/dev/md_root.c which had problem with DIAGNOSTIC kernel (stopped
> at assertion: bp->b_refcnt > 0). Funny thing is that problem seems to be
> root cause for 68030 cpu installation panics and it no longer exist with fixed
> /atari/dev/md_root.c. I'm no longer wondering why kernel panicked only with
> installation :)

atari/dev/md_root.c uses getiobuf(9) to get buffer,
but getiobuf(9) man page says:
>>     Note that the allocated buffer doesn't belong to buffer cache.  To free
>>     it, putiobuf() should be used.  brelse() should not be used on it.
so adding brelse() is not correct fix for the initial problem.

I've tried atari's md_root.c (reading md_root from floppy) on i386
with some changes, and now it looks it's enough to clear
bp->b_oflags (which was introduced on vmlocking2 merge)
as per the similar function in sys/kern/subr_disk.c:
http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/kern/subr_disk.c.diff?r1=1.89&r2=1.90

Note it's also safe to clip bp->b_bcount with bytes_left
because size of md_root might not be a multiple of the cylinder size.
(5MB md_root on i386 causes panic later due to malloc corruption)

---
Index: dev/md_root.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/dev/md_root.c,v
retrieving revision 1.26
diff -u -r1.26 md_root.c
--- dev/md_root.c       4 Nov 2008 17:08:45 -0000       1.26
+++ dev/md_root.c       24 Dec 2008 16:37:37 -0000
@@ -229,8 +229,9 @@
        while(bytes_left > 0) {
                bp->b_cflags = BC_BUSY;
                bp->b_flags  = B_PHYS | B_READ;
+               bp->b_oflags &= ~BO_DONE;
                bp->b_blkno  = btodb(rsp->offset);
-               bp->b_bcount = rsp->chunk;
+               bp->b_bcount = min(rsp->chunk, bytes_left);
                bp->b_data   = rsp->bufp;
                bp->b_error  = 0;
 
@@ -247,7 +248,6 @@
                        printf("\n");
 
                done = bp->b_bcount - bp->b_resid;
-               brelse(bp, 0);
 
                bytes_left   -= done;
                rsp->offset  += done;
@@ -309,6 +309,7 @@
        while(nbyte > 0) {
                bp->b_cflags = BC_BUSY;
                bp->b_flags  = B_PHYS | B_READ;
+               bp->b_oflags &= ~BO_DONE;
                bp->b_blkno  = btodb(rsp->offset);
                bp->b_bcount = min(rsp->chunk, nbyte);
                bp->b_data   = buf;
@@ -327,7 +328,6 @@
                        printf("\n");
 
                done = bp->b_bcount - bp->b_resid;
-               brelse(bp, 0);
 
                nbyte        -= done;
                nread        += done;
---
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 5.0_BETA (GENERIC_MD) #16: Thu Dec 25 01:05:07 JST 2008
        tsutsui@mirage:/usr/local/tmp/src/sys/arch/i386/compile/GENERIC_MD

 :

Kernelized RAIDframe activated
md0: auto-load on open. Size 5120000 bytes.
pad0: outputs: 44100Hz, 16-bit, stereo
audio1 at pad0: half duplex
boot device: wd0
root on md0a dumps on md0b
md: total size = 5120000, media size = 1474560, chunk = 18432
........................................
........................................

Insert next media and hit any key...
........................................
........................................

Insert next media and hit any key...
........................................
........................................

Insert next media and hit any key...
......................................
root file system type: ffs
WARNING: clock gained 3 days
WARNING: CHECK AND RESET THE DATE!
warning: no /dev/console

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index