From owner-freebsd-current@FreeBSD.ORG Tue Feb 14 22:35:51 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7CDF716A423 for ; Tue, 14 Feb 2006 22:35:51 +0000 (GMT) (envelope-from tinguely@casselton.net) Received: from casselton.net (casselton.net [63.165.140.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E3FD43D49 for ; Tue, 14 Feb 2006 22:35:51 +0000 (GMT) (envelope-from tinguely@casselton.net) Received: from casselton.net (localhost [127.0.0.1]) by casselton.net (8.12.11/8.12.11) with ESMTP id k1EMZkle002412; Tue, 14 Feb 2006 16:35:46 -0600 (CST) (envelope-from tinguely@casselton.net) Received: (from tinguely@localhost) by casselton.net (8.12.11/8.12.11/Submit) id k1EMZknZ002411; Tue, 14 Feb 2006 16:35:46 -0600 (CST) (envelope-from tinguely) Date: Tue, 14 Feb 2006 16:35:46 -0600 (CST) From: Mark Tinguely Message-Id: <200602142235.k1EMZknZ002411@casselton.net> To: chris@unixpages.org, current@freebsd.org In-Reply-To: <20060214205050.GA6218@haakonia.hitnet.RWTH-Aachen.DE> X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on ccn.casselton.net Cc: Subject: Re: panic: Trying sleep, but thread marked as sleeping prohibited X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2006 22:35:51 -0000 > > I get the following panic now and then when trying to mount my external > usb drive. The panic only occurs when the machine has been up for some > time. > > FreeBSD serenity.local 7.0-CURRENT FreeBSD 7.0-CURRENT #8: Sun Feb 12 > 11:00:10 CET 2006 chris@serenity.local:/usr/obj/usr/src/sys/SERENITY > i386 > > panic: Trying sleep, but thread marked as sleeping prohibited There are 2 open problems on this one error. Try: *** vm_contig.c.orig Mon Jan 30 09:22:51 2006 --- vm_contig.c Wed Feb 1 07:51:33 2006 *************** *** 86,92 **** #include static int ! vm_contig_launder_page(vm_page_t m) { vm_object_t object; vm_page_t m_tmp; --- 86,92 ---- #include static int ! vm_contig_launder_page(vm_page_t m, int flags) { vm_object_t object; vm_page_t m_tmp; *************** *** 95,100 **** --- 95,114 ---- object = m->object; if (!VM_OBJECT_TRYLOCK(object)) return (EAGAIN); + + if (flags & M_NOWAIT) { /* cannot sleep in interrupt mode */ + if ((m->flags & PG_BUSY) || m->busy) { + VM_OBJECT_UNLOCK(object); + return (EBUSY); + } else { + vm_page_test_dirty(m); + if (m->dirty) { + VM_OBJECT_UNLOCK(object); + return (EAGAIN); + } + } + } + if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { VM_OBJECT_UNLOCK(object); vm_page_lock_queues(); *************** *** 129,135 **** } static int ! vm_contig_launder(int queue) { vm_page_t m, next; int error; --- 143,149 ---- } static int ! vm_contig_launder(int queue, int flags) { vm_page_t m, next; int error; *************** *** 143,149 **** KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); ! error = vm_contig_launder_page(m); if (error == 0) return (TRUE); if (error == EBUSY) --- 157,163 ---- KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); ! error = vm_contig_launder_page(m, flags); if (error == 0) return (TRUE); if (error == EBUSY) *************** *** 224,235 **** actmax = vm_page_queues[PQ_ACTIVE].lcnt; again1: if (inactl < inactmax && ! vm_contig_launder(PQ_INACTIVE)) { inactl++; goto again1; } if (actl < actmax && ! vm_contig_launder(PQ_ACTIVE)) { actl++; goto again1; } --- 238,249 ---- actmax = vm_page_queues[PQ_ACTIVE].lcnt; again1: if (inactl < inactmax && ! vm_contig_launder(PQ_INACTIVE, flags)) { inactl++; goto again1; } if (actl < actmax && ! vm_contig_launder(PQ_ACTIVE, flags)) { actl++; goto again1; } *************** *** 381,387 **** vm_page_t vm_page_alloc_contig(vm_pindex_t npages, vm_paddr_t low, vm_paddr_t high, ! vm_offset_t alignment, vm_offset_t boundary) { vm_object_t object; vm_offset_t size; --- 395,401 ---- vm_page_t vm_page_alloc_contig(vm_pindex_t npages, vm_paddr_t low, vm_paddr_t high, ! vm_offset_t alignment, vm_offset_t boundary, int flags) { vm_object_t object; vm_offset_t size; *************** *** 474,480 **** pqtype != PQ_CACHE) { if (m->queue == PQ_ACTIVE || m->queue == PQ_INACTIVE) { ! if (vm_contig_launder_page(m) != 0) goto cleanup_freed; pqtype = m->queue - m->pc; if (pqtype != PQ_FREE && --- 488,494 ---- pqtype != PQ_CACHE) { if (m->queue == PQ_ACTIVE || m->queue == PQ_INACTIVE) { ! if (vm_contig_launder_page(m, flags) != 0) goto cleanup_freed; pqtype = m->queue - m->pc; if (pqtype != PQ_FREE && *************** *** 581,587 **** boundary, kernel_map); } else { pages = vm_page_alloc_contig(npgs, low, high, ! alignment, boundary); if (pages == NULL) { ret = NULL; } else { --- 595,601 ---- boundary, kernel_map); } else { pages = vm_page_alloc_contig(npgs, low, high, ! alignment, boundary, flags); if (pages == NULL) { ret = NULL; } else { *** vm_page.h.orig Wed Jan 25 09:01:28 2006 --- vm_page.h Wed Feb 1 07:50:32 2006 *************** *** 321,327 **** void vm_page_activate (vm_page_t); vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int); vm_page_t vm_page_alloc_contig (vm_pindex_t, vm_paddr_t, vm_paddr_t, ! vm_offset_t, vm_offset_t); void vm_page_release_contig (vm_page_t, vm_pindex_t); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); void vm_page_cache (register vm_page_t); --- 321,327 ---- void vm_page_activate (vm_page_t); vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int); vm_page_t vm_page_alloc_contig (vm_pindex_t, vm_paddr_t, vm_paddr_t, ! vm_offset_t, vm_offset_t, int); void vm_page_release_contig (vm_page_t, vm_pindex_t); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); void vm_page_cache (register vm_page_t);