From owner-freebsd-alpha Sat Oct 7 13:33:30 2000 Delivered-To: freebsd-alpha@freebsd.org Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by hub.freebsd.org (Postfix) with ESMTP id 2112137B503; Sat, 7 Oct 2000 13:33:27 -0700 (PDT) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id QAA11387; Sat, 7 Oct 2000 16:33:26 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.0/8.9.1) id e97KXQ263517; Sat, 7 Oct 2000 16:33:26 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 7 Oct 2000 16:33:26 -0400 (EDT) To: freebsd-alpha@freebsd.org Cc: jhb@freebsd.org Subject: kernacc in mtx_validate X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14815.34524.543972.437937@grasshopper.cs.duke.edu> Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The calls to kerneacc in mtx_validate may fail when mtx_next points to "all_mtx" because it is a k0seg address, it is not in mapped memory. Because of this, anybody running with SMP_DEBUG & INVARIANTS will notice this at boot: panic: Assertion kernacc((caddr_t)all_mtx.mtx_next, 4, 1) == 1 failed at ../../alpha/alpha/synch_machdep.c:444 and/or panic: mtx_validate: mp=0xfffffc000068a978 mp->mtx_next=0xfffffc000068a7a8 The following works around the problem by merrily accepting any k0seg addr as possibly valid: Index: alpha/alpha/synch_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/synch_machdep.c,v retrieving revision 1.5 diff -u -r1.5 synch_machdep.c --- alpha/alpha/synch_machdep.c 2000/10/04 01:20:49 1.5 +++ alpha/alpha/synch_machdep.c 2000/10/07 20:21:03 @@ -428,6 +428,9 @@ #ifdef SMP_DEBUG +#define ISK0SEG(va) \ + ((va >= ALPHA_K0SEG_BASE && va <= ALPHA_K0SEG_END)) + int mtx_validate __P((struct mtx *, int)); int @@ -441,10 +444,12 @@ return 0; mtx_enter(&all_mtx, MTX_DEF); - ASS(kernacc((caddr_t)all_mtx.mtx_next, 4, 1) == 1); + ASS(ISK0SEG((vm_offset_t)all_mtx.mtx_next) || + kernacc((caddr_t)all_mtx.mtx_next, 4, 1) == 1); ASS(all_mtx.mtx_next->mtx_prev == &all_mtx); for (i = 0, mp = all_mtx.mtx_next; mp != &all_mtx; mp = mp->mtx_next) { - if (kernacc((caddr_t)mp->mtx_next, 4, 1) != 1) { + if (!ISK0SEG((vm_offset_t)all_mtx.mtx_next) && + kernacc((caddr_t)mp->mtx_next, 4, 1) != 1) { panic("mtx_validate: mp=%p mp->mtx_next=%p", mp, mp->mtx_next); } Comments? Drew ------------------------------------------------------------------------------ Andrew Gallatin, Sr Systems Programmer http://www.cs.duke.edu/~gallatin Duke University Email: gallatin@cs.duke.edu Department of Computer Science Phone: (919) 660-6590 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message