From owner-svn-src-stable@FreeBSD.ORG Thu Dec 5 18:08:06 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 69963FD6; Thu, 5 Dec 2013 18:08:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3C6901079; Thu, 5 Dec 2013 18:08:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB5I86fE043442; Thu, 5 Dec 2013 18:08:06 GMT (envelope-from royger@svn.freebsd.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB5I85vv043432; Thu, 5 Dec 2013 18:08:05 GMT (envelope-from royger@svn.freebsd.org) Message-Id: <201312051808.rB5I85vv043432@svn.freebsd.org> From: Roger Pau Monné Date: Thu, 5 Dec 2013 18:08:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r258996 - in stable/10/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2013 18:08:06 -0000 Author: royger Date: Thu Dec 5 18:08:05 2013 New Revision: 258996 URL: http://svnweb.freebsd.org/changeset/base/258996 Log: MFC 258176: Fix accounting for hw.realmem on the i386 and amd64 platforms. sys/i386/i386/machdep.c: sys/amd64/amd64/machdep.c: The value reported by FreeBSD as "real memory" when booting doesn't match what is later reported by sysctl as hw.realmem. This is due to the fact that the value printed during the boot process is fetched from smbios data (when possible), and accounts for holes in physical memory. On the other hand, the value of hw.realmem is unconditionally set to be one larger than the highest page of the physical address space. Fix this by setting hw.realmem to the same value printed during boot, this makes hw.realmem honour it's name and account properly for physical memory present in the system. Submitted by: Roger Pau Monné Reviewed by: gibbs Approved by: gibbs (mentor) Approved by: re (gjb) Modified: stable/10/sys/amd64/amd64/machdep.c stable/10/sys/i386/i386/machdep.c Directory Properties: stable/10/sys/ (props changed) Modified: stable/10/sys/amd64/amd64/machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/machdep.c Thu Dec 5 18:06:12 2013 (r258995) +++ stable/10/sys/amd64/amd64/machdep.c Thu Dec 5 18:08:05 2013 (r258996) @@ -256,7 +256,6 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - realmem = Maxmem; /* * Display physical memory if SMBIOS reports reasonable amount. @@ -270,6 +269,7 @@ cpu_startup(dummy) if (memsize < ptoa((uintmax_t)cnt.v_free_count)) memsize = ptoa((uintmax_t)Maxmem); printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + realmem = atop(memsize); /* * Display any holes after the first chunk of extended memory. Modified: stable/10/sys/i386/i386/machdep.c ============================================================================== --- stable/10/sys/i386/i386/machdep.c Thu Dec 5 18:06:12 2013 (r258995) +++ stable/10/sys/i386/i386/machdep.c Thu Dec 5 18:08:05 2013 (r258996) @@ -294,7 +294,6 @@ cpu_startup(dummy) #ifdef PERFMON perfmon_init(); #endif - realmem = Maxmem; /* * Display physical memory if SMBIOS reports reasonable amount. @@ -308,6 +307,7 @@ cpu_startup(dummy) if (memsize < ptoa((uintmax_t)cnt.v_free_count)) memsize = ptoa((uintmax_t)Maxmem); printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20); + realmem = atop(memsize); /* * Display any holes after the first chunk of extended memory.