Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2006 16:35:46 -0600 (CST)
From:      Mark Tinguely <tinguely@casselton.net>
To:        chris@unixpages.org, current@freebsd.org
Subject:   Re: panic: Trying sleep, but thread marked as sleeping prohibited
Message-ID:  <200602142235.k1EMZknZ002411@casselton.net>
In-Reply-To: <20060214205050.GA6218@haakonia.hitnet.RWTH-Aachen.DE>

next in thread | previous in thread | raw e-mail | index | archive | help
>
>  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 <vm/vm_extern.h>
  
  static int
! vm_contig_launder_page(vm_page_t m)
  {
  	vm_object_t object;
  	vm_page_t m_tmp;
--- 86,92 ----
  #include <vm/vm_extern.h>
  
  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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602142235.k1EMZknZ002411>