summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-06-13 08:11:14 +0000
committeralc <alc@FreeBSD.org>2003-06-13 08:11:14 +0000
commit5549e4aa25257f6db8b251ef3d1501d0aa7052f7 (patch)
tree00ad28fa3ae5274f9fed34be35fbfb888aee5345
parentd187b499cb67c72f9add0b75af57e6b9f0f35528 (diff)
downloadFreeBSD-src-5549e4aa25257f6db8b251ef3d1501d0aa7052f7.zip
FreeBSD-src-5549e4aa25257f6db8b251ef3d1501d0aa7052f7.tar.gz
Add vm object locking.
-rw-r--r--sys/dev/agp/agp_i810.c9
-rw-r--r--sys/pci/agp_i810.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c
index d8e4d05..0f845d9 100644
--- a/sys/dev/agp/agp_i810.c
+++ b/sys/dev/agp/agp_i810.c
@@ -584,8 +584,11 @@ agp_i810_alloc_memory(device_t dev, int type, vm_size_t size)
* get its physical address.
*/
vm_page_t m;
+
+ VM_OBJECT_LOCK(mem->am_obj);
m = vm_page_grab(mem->am_obj, 0,
VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
+ VM_OBJECT_UNLOCK(mem->am_obj);
if ((m->flags & PG_ZERO) == 0)
pmap_zero_page(m);
vm_page_lock_queues();
@@ -616,7 +619,11 @@ agp_i810_free_memory(device_t dev, struct agp_memory *mem)
/*
* Unwire the page which we wired in alloc_memory.
*/
- vm_page_t m = vm_page_lookup(mem->am_obj, 0);
+ vm_page_t m;
+
+ VM_OBJECT_LOCK(mem->am_obj);
+ m = vm_page_lookup(mem->am_obj, 0);
+ VM_OBJECT_UNLOCK(mem->am_obj);
vm_page_lock_queues();
vm_page_unwire(m, 0);
vm_page_unlock_queues();
diff --git a/sys/pci/agp_i810.c b/sys/pci/agp_i810.c
index d8e4d05..0f845d9 100644
--- a/sys/pci/agp_i810.c
+++ b/sys/pci/agp_i810.c
@@ -584,8 +584,11 @@ agp_i810_alloc_memory(device_t dev, int type, vm_size_t size)
* get its physical address.
*/
vm_page_t m;
+
+ VM_OBJECT_LOCK(mem->am_obj);
m = vm_page_grab(mem->am_obj, 0,
VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_RETRY);
+ VM_OBJECT_UNLOCK(mem->am_obj);
if ((m->flags & PG_ZERO) == 0)
pmap_zero_page(m);
vm_page_lock_queues();
@@ -616,7 +619,11 @@ agp_i810_free_memory(device_t dev, struct agp_memory *mem)
/*
* Unwire the page which we wired in alloc_memory.
*/
- vm_page_t m = vm_page_lookup(mem->am_obj, 0);
+ vm_page_t m;
+
+ VM_OBJECT_LOCK(mem->am_obj);
+ m = vm_page_lookup(mem->am_obj, 0);
+ VM_OBJECT_UNLOCK(mem->am_obj);
vm_page_lock_queues();
vm_page_unwire(m, 0);
vm_page_unlock_queues();
OpenPOWER on IntegriCloud