From owner-freebsd-bugs@FreeBSD.ORG Fri Oct 21 18:10:10 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B067D106564A for ; Fri, 21 Oct 2011 18:10:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8D0C08FC16 for ; Fri, 21 Oct 2011 18:10:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p9LIAAm5028627 for ; Fri, 21 Oct 2011 18:10:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p9LIAAwS028626; Fri, 21 Oct 2011 18:10:10 GMT (envelope-from gnats) Resent-Date: Fri, 21 Oct 2011 18:10:10 GMT Resent-Message-Id: <201110211810.p9LIAAwS028626@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Penta Upa Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D5BA106564A for ; Fri, 21 Oct 2011 18:03:35 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 531278FC12 for ; Fri, 21 Oct 2011 18:03:35 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9LI3Zwr006806 for ; Fri, 21 Oct 2011 18:03:35 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p9LI3Y2Q006800; Fri, 21 Oct 2011 18:03:34 GMT (envelope-from nobody) Message-Id: <201110211803.p9LI3Y2Q006800@red.freebsd.org> Date: Fri, 21 Oct 2011 18:03:34 GMT From: Penta Upa To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/161887: panic at vm_page_wire with FreeBSD 9.0 Beta 3 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 18:10:10 -0000 >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@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 >Fix: Patch attached with submission follows: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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: