kern/161887: panic at vm_page_wire with FreeBSD 9.0 Beta 3
Penta Upa
bsdboot at gmail.com
Fri Oct 21 18:10:10 UTC 2011
>Number: 161887
>Category: kern
>Synopsis: panic at vm_page_wire with FreeBSD 9.0 Beta 3
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Oct 21 18:10:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Penta Upa
>Release: FreeBSD 9.0 Beta 3
>Organization:
>Environment:
FreeBSD scache 9.0-BETA3 FreeBSD 9.0-BETA3 #0: Sat Sep 24 21:31:28 UTC 2011
root at farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
External modules calling vm_page_wire() even after calling vm_page_lock() results in the following assertion failure in vm_page.c
panic: mutex page lock not owned at /usr/src/sys/vm/vm_page:1845
Interestingly check for vm page locked is also done in the external module but there is no assertion there. More clearly within the external module
vm_page_lock(pp);
vm_page_lock_assert(pp, MA_OWNED); /* No panic here */
vm_page_wire(pp); /* Panic here for the same assertion as above, strange */
vm_page_unlock(pp);
The machine in use is a fresh install of FreeBSD 9 Beta 3. No changes to the kernel were made. Problem however exists ever after a kernel recompile.
I have also sent a mail to the mailing list on this. http://lists.freebsd.org/pipermail/freebsd-current/2011-October/028550.html
I dont have a backtrace of the crash as i'm unable to configure kernel dumps yet. Will post them once i have it.
>How-To-Repeat:
Try the attached vmtest.c
Makefile contents are
KMOD = vmtest
SRCS = vmtest.c
.include <bsd.kmod.mk>
>Fix:
Patch attached with submission follows:
#include <sys/param.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/vm_object.h>
static void
vmtest(void) {
vm_page_t pp;
pp = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL);
if (!pp) {
printf("Page allocation failure\n");
return;
}
vm_page_lock(pp);
vm_page_lock_assert(pp, MA_OWNED);
vm_page_wire(pp);
vm_page_unlock(pp);
}
/* The function called at load/unload. */
static int event_handler(struct module *module, int event, void *arg) {
switch (event) {
case MOD_LOAD:
vmtest();
break;
case MOD_UNLOAD:
break;
default:
break;
}
return 0;
}
static moduledata_t vmtest_conf = {
"vmtest",
event_handler,
NULL
};
DECLARE_MODULE(vmtest, vmtest_conf, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list