From owner-freebsd-amd64@FreeBSD.ORG Wed Aug 26 23:00:09 2009 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55D23106568B for ; Wed, 26 Aug 2009 23:00:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 27B778FC24 for ; Wed, 26 Aug 2009 23:00:09 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QN09eO051370 for ; Wed, 26 Aug 2009 23:00:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7QN09nO051369; Wed, 26 Aug 2009 23:00:09 GMT (envelope-from gnats) Resent-Date: Wed, 26 Aug 2009 23:00:09 GMT Resent-Message-Id: <200908262300.n7QN09nO051369@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-amd64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "James R. Van Artsdalen" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62EC7106568B for ; Wed, 26 Aug 2009 22:59:47 +0000 (UTC) (envelope-from james@jrv.org) Received: from mail.jrv.org (rrcs-24-73-246-106.sw.biz.rr.com [24.73.246.106]) by mx1.freebsd.org (Postfix) with ESMTP id 0B7D48FC21 for ; Wed, 26 Aug 2009 22:59:46 +0000 (UTC) Received: from bigtex.housenet.jrv (localhost [127.0.0.1]) by mail.jrv.org (8.14.3/8.14.3) with ESMTP id n7QMdeOB045329 for ; Wed, 26 Aug 2009 17:39:40 -0500 (CDT) (envelope-from james@bigtex.housenet.jrv) Received: (from root@localhost) by bigtex.housenet.jrv (8.14.3/8.14.3/Submit) id n7QMdeHV045328; Wed, 26 Aug 2009 17:39:40 -0500 (CDT) (envelope-from james) Message-Id: <200908262239.n7QMdeHV045328@bigtex.housenet.jrv> Date: Wed, 26 Aug 2009 17:39:40 -0500 (CDT) From: "James R. Van Artsdalen" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 X-Mailman-Approved-At: Wed, 26 Aug 2009 23:20:34 +0000 Cc: Subject: amd64/138220: [patch] FreeBSD/amd64 can't see all system memory X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "James R. Van Artsdalen" List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 23:00:09 -0000 >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@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: