PERFORCE change 96562 for review

tkuik tkuik at FreeBSD.org
Tue May 2 20:13:06 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96562

Change 96562 by tkuik at tkuik_freebsd on 2006/05/02 20:13:04

	Fixed use of xen_create_contiguous_region() function

Affected files ...

.. //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#15 edit
.. //depot/projects/xen3/src/sys/vm/vm_contig.c#4 edit

Differences ...

==== //depot/projects/xen3/src/sys/i386-xen/i386-xen/xen_machdep.c#15 (text+ko) ====

@@ -202,7 +202,7 @@
     
 	if (__predict_false(error < 0)) {
 		for (i = 0; i < _xpq_idx; i++)
-			printk("val: %x ptr: %p\n", XPQ_QUEUE[i].val, XPQ_QUEUE[i].ptr);
+			printf("val: %llx ptr: %llx\n", XPQ_QUEUE[i].val, XPQ_QUEUE[i].ptr);
 		panic("Failed to execute MMU updates: %d", error);
 	}
 
@@ -339,6 +339,7 @@
 }
 
 
+#if 0
 /*
  * Bitmap is indexed by page number. If bit is set, the page is part of a
  * xen_create_contiguous_region() area of memory.
@@ -386,6 +387,7 @@
 		contiguous_bitmap[curr_idx] &= -(1UL<<end_off);
 	}
 }
+#endif
 
 /* Ensure multi-page extents are contiguous in machine memory. */
 int 
@@ -406,7 +408,7 @@
 	PANIC_IF(ffs(npages) != fls(npages));
 
 	/* 0. determine order */
-	order = (ffs(npages) == fls(npages)) ? fls(npages) : (ffs(npages) + 1);
+	order = (ffs(npages) == fls(npages)) ? fls(npages) - 1 : fls(npages);
 	
 	/* 1. give away machine pages. */
 	for (i = 0; i < (1 << order); i++) {
@@ -437,7 +439,9 @@
 
 	xen_tlb_flush();
 
+#if 0
 	contiguous_bitmap_set(VM_PAGE_TO_PHYS(&pages[0]) >> PAGE_SHIFT, 1UL << order);
+#endif
 
 	balloon_unlock(flags);
 
@@ -482,11 +486,13 @@
 	PANIC_IF(ffs(npages) != fls(npages));
 
 	/* 0. determine order */
-	order = (ffs(npages) == fls(npages)) ? fls(npages) : (ffs(npages) + 1);
+	order = (ffs(npages) == fls(npages)) ? fls(npages) - 1 : fls(npages);
 
 	balloon_lock(flags);
 
+#if 0
 	contiguous_bitmap_clear(vtophys(addr) >> PAGE_SHIFT, 1UL << order);
+#endif
 
 	/* 1. Zap current PTEs, giving away the underlying pages. */
 	for (i = 0; i < (1 << order); i++) {

==== //depot/projects/xen3/src/sys/vm/vm_contig.c#4 (text+ko) ====

@@ -574,8 +574,13 @@
 	vm_page_t pages;
 	vm_pindex_t npgs;
 
-	/* XXXEN should consider rounding to nearest power of two */
 	npgs = round_page(size) >> PAGE_SHIFT;
+
+#ifdef XEN
+	/* Round to the nearest power of two */
+        npgs = 1 << ((ffs(npgs) == fls(npgs)) ? fls(npgs) - 1 : fls(npgs));
+#endif
+
 	mtx_lock(&Giant);
 	if (vm_old_contigmalloc) {
 		ret = contigmalloc1(size, type, flags, low, high, alignment,


More information about the p4-projects mailing list