svn commit: r216041 - head/sys/i386/i386

Colin Percival cperciva at FreeBSD.org
Mon Nov 29 06:50:31 UTC 2010


Author: cperciva
Date: Mon Nov 29 06:50:30 2010
New Revision: 216041
URL: http://svn.freebsd.org/changeset/base/216041

Log:
  Fix bug introduced by r194784: Under XEN, the page(s) allocated to dpcpu
  for CPU #0 weren't being properly reserved.  Under VM pressure this would
  cause problems when the dpcpu structures were overwritten by arbitrary
  data; the most common symptom was a panic when netisr attempted to lock a
  mutex.
  
  For some reason the XEN code keeps track of the start of available memory
  in the variables 'first', 'physfree', and 'init_first'; as far as I can
  tell, we always have first == physfree == init_first * PAGE_SIZE.  The
  earlier commit adjusted 'first' (which, on !XEN, is the only variable
  which tracks this value) but not the other two variables.
  
  Exercise for reader: Eliminate two of these three variables.

Modified:
  head/sys/i386/i386/machdep.c

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Mon Nov 29 05:50:20 2010	(r216040)
+++ head/sys/i386/i386/machdep.c	Mon Nov 29 06:50:30 2010	(r216041)
@@ -2576,6 +2576,8 @@ init386(first)
 		pmap_kenter(pa + KERNBASE, pa);
 	dpcpu_init((void *)(first + KERNBASE), 0);
 	first += DPCPU_SIZE;
+	physfree += DPCPU_SIZE;
+	init_first += DPCPU_SIZE / PAGE_SIZE;
 
 	PCPU_SET(prvspace, pc);
 	PCPU_SET(curthread, &thread0);


More information about the svn-src-all mailing list