Date: Sat, 7 Oct 2000 16:33:26 -0400 (EDT) From: Andrew Gallatin <gallatin@cs.duke.edu> To: freebsd-alpha@freebsd.org Cc: jhb@freebsd.org Subject: kernacc in mtx_validate Message-ID: <14815.34524.543972.437937@grasshopper.cs.duke.edu>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14815.34524.543972.437937>
