From owner-freebsd-current@FreeBSD.ORG Sat Jun 19 20:26:52 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D053F106566B for ; Sat, 19 Jun 2010 20:26:52 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2FFC68FC0A for ; Sat, 19 Jun 2010 20:26:51 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA13609; Sat, 19 Jun 2010 23:26:35 +0300 (EEST) (envelope-from avg@icyb.net.ua) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OQ4cd-000FDE-2g; Sat, 19 Jun 2010 23:26:35 +0300 Message-ID: <4C1D27F9.60709@icyb.net.ua> Date: Sat, 19 Jun 2010 23:26:33 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.24 (X11/20100603) MIME-Version: 1.0 To: Andreas Tobler References: <4C1CFB72.5000806@fgznet.ch> In-Reply-To: <4C1CFB72.5000806@fgznet.ch> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current Subject: Re: only 3 of 4GB memory available on amd64 8.1-RC1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jun 2010 20:26:53 -0000 on 19/06/2010 20:16 Andreas Tobler said the following: > Hi all, > > I got my hands on a t60 with 4GB of RAM (BIOS displays it) > > And I installed 8.1-RC1 on it: > > FreeBSD 8.1-RC1 #0: Mon Jun 14 13:40:28 UTC 2010 > root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 > Timecounter "i8254" frequency 1193182 Hz quality 0 > CPU: Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz (1828.76-MHz > K8-class CPU) > Origin = "GenuineIntel" Id = 0x6f6 Family = 6 Model = f Stepping = 6 > > Features=0xbfebfbff > > Features2=0xe3bd > AMD Features=0x20100800 > AMD Features2=0x1 > TSC: P-state invariant > real memory = 4294967296 (4096 MB) > avail memory = 3092344832 (2949 MB) > ACPI APIC Table: > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs > FreeBSD/SMP: 1 package(s) x 2 core(s) > cpu0 (BSP): APIC ID: 0 > cpu1 (AP): APIC ID: 1 > > > > Do I need to configure something special to get the full 4GB of memory? > > I only found the PAE hint, but this is for x86 machines, right? Yes, PAE is for what we call in FreeBSD land "i386". "x86" we use for both i386 and amd64. Now, to the rest. I recently investigated this topic myself, so I can share what I learned. The first thing you'd want to have is SMAP information. You can get it at the loader prompt with 'smap' command. It is also reported by kernel during a verbose boot, but it is only printed to console; it is not saved to dmesg, because it is printed before msgbuf is created. Example of how SMAP information looks: SMAP type=01 base=0000000000000000 end=000000000009f800 SMAP type=02 base=00000000000f0000 end=0000000000100000 SMAP type=02 base=00000000fec00000 end=0000000100000000 SMAP type=02 base=00000000e0000000 end=00000000f0000000 SMAP type=02 base=000000000009f800 end=00000000000a0000 SMAP type=02 base=00000000bfdf0000 end=00000000bfe00000 SMAP type=01 base=0000000000100000 end=00000000bfde0000 SMAP type=03 base=00000000bfde3000 end=00000000bfdf0000 SMAP type=04 base=00000000bfde0000 end=00000000bfde3000 SMAP type=01 base=0000000100000000 end=0000000130000000 Type 1 ('01') is memory ranges free for OS use. Note that the ranges could be unsorted. SMAP would give you an idea what is free for OS use and what is taken away for BIOS and hardware needs. Also note that what's reported as "avail memory" is smaller than sum of sizes of all unreserved regions. Some space is taken away by FreeBSD virtual memory code to store some core page/memory management information (~3%). Memory used by kernel and preloaded modules is also not included into "avail memory". If you discover that your system reserves, in your opinion, too much memory, then consider the following things. 1. Some memory might be allocated as video adapter's aperture and/or video adapter's memory in case of some integrated graphics solutions. 2. Some memory addresses below 4GB are used for MMIO (memory mapped input/output) - accessing those addresses is actually communicating with some hardware rather than accessing DRAM. Some hardware+firmware combinations can hoist (or remap) DRAM that corresponds to such an address range to a different address range above 4G. If you examine last line of my sample SMAP output, then you'll see that there is 756MB of "type 01" RAM above 4GB and that machine has exactly 4GB of DRAM installed - this is MMIO range 0xd0000000-0x100000000 hoisted to 0x100000000-0x130000000. If your hardware doesn't support that option, then too bad - the memory is "overshadowed" by MMIO and is effectively lost. Sometimes hoisting option (under whatever name) has to be explicitly set in BIOS configuration. That's about all. I am curious as to what you would discover about your system - please share with us. -- Andriy Gapon