Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Dec 2008 16:04:33 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186433 - head/sys/dev/agp
Message-ID:  <200812231604.mBNG4X91006629@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Dec 23 16:04:33 2008
New Revision: 186433
URL: http://svn.freebsd.org/changeset/base/186433

Log:
  Clear busy state on the pages which are after the one that failed the bind
  attempt.
  
  Reported and tested by:	ganbold
  Reviewed by:	rnoland
  MFC after:	2 weeks

Modified:
  head/sys/dev/agp/agp.c

Modified: head/sys/dev/agp/agp.c
==============================================================================
--- head/sys/dev/agp/agp.c	Tue Dec 23 15:47:31 2008	(r186432)
+++ head/sys/dev/agp/agp.c	Tue Dec 23 16:04:33 2008	(r186433)
@@ -564,6 +564,7 @@ agp_generic_bind_memory(device_t dev, st
 		device_printf(dev, "memory already bound\n");
 		error = EINVAL;
 		VM_OBJECT_LOCK(mem->am_obj);
+		i = 0;
 		goto bad;
 	}
 	
@@ -592,7 +593,6 @@ agp_generic_bind_memory(device_t dev, st
 				 * Bail out. Reverse all the mappings
 				 * and unwire the pages.
 				 */
-				vm_page_wakeup(m);
 				for (k = 0; k < i + j; k += AGP_PAGE_SIZE)
 					AGP_UNBIND_PAGE(dev, offset + k);
 				goto bad;
@@ -622,8 +622,10 @@ agp_generic_bind_memory(device_t dev, st
 bad:
 	mtx_unlock(&sc->as_lock);
 	VM_OBJECT_LOCK_ASSERT(mem->am_obj, MA_OWNED);
-	for (i = 0; i < mem->am_size; i += PAGE_SIZE) {
-		m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(i));
+	for (k = 0; k < mem->am_size; k += PAGE_SIZE) {
+		m = vm_page_lookup(mem->am_obj, OFF_TO_IDX(k));
+		if (k >= i)
+			vm_page_wakeup(m);
 		vm_page_lock_queues();
 		vm_page_unwire(m, 0);
 		vm_page_unlock_queues();



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