diff options
author | jhb <jhb@FreeBSD.org> | 2006-01-27 22:22:10 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-01-27 22:22:10 +0000 |
commit | 2abda0c117f0bf476985583e91dbdcd9b67579d3 (patch) | |
tree | b958d406e447d5697f7c06646b409b17192173b4 /sys/i386 | |
parent | 9b143bcf628f96ba0276241b5418226fa66565f2 (diff) | |
download | FreeBSD-src-2abda0c117f0bf476985583e91dbdcd9b67579d3.zip FreeBSD-src-2abda0c117f0bf476985583e91dbdcd9b67579d3.tar.gz |
Call WITNESS_CHECK() in the page fault handler and immediately assume it
is a fatal fault if we are holding any non-sleepable locks. This should
cut down on the number of bogus LORs we currently get when the kernel
panics due to a NULL (or bogus) pointer dereference that goes wandering
off into the VM system which tries to acquire locks and then kicks off
the spurious LORs. This should probably be ported to all the archs at
some point.
Tested on: i386
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/trap.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index d392374..928c716 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -265,12 +265,20 @@ trap(frame) * do the VM lookup, so just consider it a fatal trap so the * kernel can print out a useful trap message and even get * to the debugger. + * + * If we get a page fault while holding a non-sleepable + * lock, then it is most likely a fatal kernel page fault. + * If WITNESS is enabled, then it's going to whine about + * bogus LORs with various VM locks, so just skip to the + * fatal trap handling directly. */ eva = rcr2(); - if (td->td_critnest == 0) - enable_intr(); - else + if (td->td_critnest != 0 || + WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK, NULL, + "Kernel page fault") != 0) trap_fatal(&frame, eva); + else + enable_intr(); } if ((ISPL(frame.tf_cs) == SEL_UPL) || |