Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 2006 18:25:20 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 102067 for review
Message-ID:  <200607211825.k6LIPKE8092630@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=102067

Change 102067 by jhb@jhb_zion on 2006/07/21 18:25:14

	Don't allow MAXMEM/hw.physmem to extend the last memory segment
	size if we used an SMAP, treating the SMAP as authoritative on
	what parts of physical address space are RAM.  This makes hw.physmem
	safe to use with ACPI.

Affected files ...

.. //depot/projects/smpng/sys/amd64/amd64/machdep.c#54 edit
.. //depot/projects/smpng/sys/i386/i386/machdep.c#110 edit

Differences ...

==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#54 (text+ko) ====

@@ -951,13 +951,6 @@
 	    (boothowto & RB_VERBOSE))
 		printf("Physical memory use set to %ldK\n", Maxmem * 4);
 
-	/*
-	 * If Maxmem has been increased beyond what the system has detected,
-	 * extend the last memory segment to the new limit.
-	 */
-	if (atop(physmap[physmap_idx + 1]) < Maxmem)
-		physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem);
-
 	/* call pmap initialization to make new kernel address space */
 	pmap_bootstrap(&first);
 

==== //depot/projects/smpng/sys/i386/i386/machdep.c#110 (text+ko) ====

@@ -1633,7 +1633,7 @@
 getmemsize(int first)
 {
 	int i, physmap_idx, pa_indx, da_indx;
-	int hasbrokenint12;
+	int hasbrokenint12, has_smap;
 	u_long physmem_tunable;
 	u_int extmem;
 	struct vm86frame vmf;
@@ -1742,6 +1742,7 @@
 		if (boothowto & RB_VERBOSE)
 			printf("SMAP type=%02x base=%016llx len=%016llx\n",
 			    smap->type, smap->base, smap->length);
+		has_smap = 1;
 
 		if (smap->type != 0x01)
 			continue;
@@ -1888,10 +1889,11 @@
 		printf("Physical memory use set to %ldK\n", Maxmem * 4);
 
 	/*
-	 * If Maxmem has been increased beyond what the system has detected,
-	 * extend the last memory segment to the new limit.
+	 * If Maxmem has been increased beyond what the system has detected
+	 * and we didn't get the memory layout via SMAP, extend the last
+	 * memory segment to the new limit.
 	 */ 
-	if (atop(physmap[physmap_idx + 1]) < Maxmem)
+	if (!has_smap && atop(physmap[physmap_idx + 1]) < Maxmem)
 		physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem);
 
 	/* call pmap initialization to make new kernel address space */



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