PERFORCE change 102581 for review
John Baldwin
jhb at FreeBSD.org
Thu Jul 27 19:14:20 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=102581
Change 102581 by jhb at jhb_mutex on 2006/07/27 19:13:24
Really fix the hw.physmem stuff. Not only do we have to not change
the physmap[], we also have to make sure Maxmem retains the correct
value.
Affected files ...
.. //depot/projects/smpng/sys/amd64/amd64/machdep.c#55 edit
.. //depot/projects/smpng/sys/i386/i386/machdep.c#111 edit
Differences ...
==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#55 (text+ko) ====
@@ -947,6 +947,13 @@
if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
Maxmem = atop(physmem_tunable);
+ /*
+ * Don't allow MAXMEM or hw.physmem to extend the amount of memory
+ * in the system.
+ */
+ if (Maxmem > atop(physmap[physmap_idx + 1]))
+ Maxmem = atop(physmap[physmap_idx + 1]);
+
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
(boothowto & RB_VERBOSE))
printf("Physical memory use set to %ldK\n", Maxmem * 4);
==== //depot/projects/smpng/sys/i386/i386/machdep.c#111 (text+ko) ====
@@ -1661,6 +1661,7 @@
bzero(&vmf, sizeof(vmf));
bzero(physmap, sizeof(physmap));
basemem = 0;
+ has_smap = 0;
/*
* Some newer BIOSes has broken INT 12H implementation which cause
@@ -1884,16 +1885,22 @@
if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
Maxmem = atop(physmem_tunable);
+ /*
+ * If we have an SMAP, don't allow MAXMEM or hw.physmem to extend
+ * the amount of memory in the system.
+ */
+ if (has_smap && Maxmem > atop(physmap[physmap_idx + 1]))
+ Maxmem = atop(physmap[physmap_idx + 1]);
+
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
(boothowto & RB_VERBOSE))
printf("Physical memory use set to %ldK\n", Maxmem * 4);
/*
- * 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 Maxmem has been increased beyond what the system has detected,
+ * extend the last memory segment to the new limit.
*/
- if (!has_smap && atop(physmap[physmap_idx + 1]) < Maxmem)
+ 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 */
More information about the p4-projects
mailing list