amd64/138220: [patch] FreeBSD/amd64 can't see all system memory
James R. Van Artsdalen
james-freebsd-current at jrv.org
Wed Aug 26 23:00:09 UTC 2009
>Number: 138220
>Category: amd64
>Synopsis: [patch] FreeBSD/amd64 can't see all system memory
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-amd64
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Aug 26 23:00:08 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: James R. Van Artsdalen
>Release: FreeBSD 9.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD pygmy.housenet.jrv 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r196500M: Wed Aug 26 11:28:43 CDT 2009 james at pygmy.housenet.jrv:/usr/src/sys/amd64/compile/GENERIC amd64
>Description:
Two related bugs:
1. FreeBSD erroneously assumes that the BIOS E820 system memory map data
is non-descending. The Zotac GF9300-D-E is an example of a system where
this is not true.
2. There is a typo in code that detects overlaps in regions reported by
E820. No action is in fact taken right now on amd64.
i386 may have bug #1 but not #2.
With this patch "available memory" goes from 2689 MB to 7605 MB on the
Zotac GF9300-D-E.
>How-To-Repeat:
Boot amd64 on Zotac GF9300-D-E motherboard with 8GB of RAM. Less than 3GB is reported.
>Fix:
No user fix.
The patch sorts smap enteries on the base address and ignores overlapping regions.
--- smap.pat begins here ---
Index: sys/amd64/amd64/machdep.c
===================================================================
--- sys/amd64/amd64/machdep.c (revision 196500)
+++ sys/amd64/amd64/machdep.c (working copy)
@@ -1236,6 +1236,19 @@
smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize);
for (smap = smapbase; smap < smapend; smap++) {
+ struct bios_smap *sp, *low = smap;
+
+ for (sp = smap + 1; sp < smapend; sp++)
+ if (low->base > sp->base)
+ low = sp;
+ if (low != smap) {
+ struct bios_smap ts;
+
+ ts = *smap;
+ *smap = *low;
+ *low = ts;
+ }
+
if (boothowto & RB_VERBOSE)
printf("SMAP type=%02x base=%016lx len=%016lx\n",
smap->type, smap->base, smap->length);
@@ -1250,10 +1263,12 @@
if (smap->base < physmap[i + 1]) {
if (boothowto & RB_VERBOSE)
printf(
- "Overlapping or non-monotonic memory region, ignoring second region\n");
- continue;
+ "Overlapping memory region, ignoring second region\n");
+ break;
}
}
+ if (i <= physmap_idx)
+ continue;
if (smap->base == physmap[physmap_idx + 1]) {
physmap[physmap_idx + 1] += smap->length;
--- smap.pat ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-amd64
mailing list