Update of /cvsroot/sbcl/sbcl/src/runtime
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17645/src/runtime
Modified Files:
gencgc.c
Log Message:
1.0.25.53: fix gencgc_handle_wp_violation on multicpu systems
Acquire free_pages_lock around page_table accesses to be sure that the
changes actually propagate to other CPUs and we don't end up losing in
the else branch and also to prevent problems caused by the compiler or
the processor reordering stuff.
Index: gencgc.c
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/runtime/gencgc.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- gencgc.c 16 Feb 2009 22:27:07 -0000 1.150
+++ gencgc.c 16 Feb 2009 22:29:06 -0000 1.151
@@ -4824,6 +4824,9 @@
return 0;
} else {
+ int ret;
+ ret = thread_mutex_lock(&free_pages_lock);
+ gc_assert(ret == 0);
if (page_table[page_index].write_protected) {
/* Unprotect the page. */
os_protect(page_address(page_index), PAGE_BYTES, OS_VM_PROT_ALL);
@@ -4841,6 +4844,8 @@
page_index, boxed_region.first_page,
boxed_region.last_page);
}
+ ret = thread_mutex_unlock(&free_pages_lock);
+ gc_assert(ret == 0);
/* Don't worry, we can handle it. */
return 1;
}
|