Bug 226673 - real memory > physical memory (amd64 Virtualbox guest)
Summary: real memory > physical memory (amd64 Virtualbox guest)
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.1-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-17 10:57 UTC by Helge Oldach
Modified: 2019-01-03 08:24 UTC (History)
2 users (show)

See Also:


Attachments
dmidecode output (1.83 KB, text/plain)
2018-03-17 13:46 UTC, Helge Oldach
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helge Oldach 2018-03-17 10:57:32 UTC
For some reason, an 11-STABLE amd64 system running under VirtualBox reports more physical memory than allocated by the host. For example, an allocation of 4096 MB physical memory by VirtualBox results in:

FreeBSD 11.1-STABLE #0 r330790: Fri Mar 16 20:51:59 CET 2018
    root@latitude.local:/usr/obj/amd64.amd64/usr/src/sys/GENERIC amd64
...
real memory  = 4831838208 (4608 MB)
avail memory = 4104138752 (3914 MB)

sysctl also reports an odd value for hw.realmem:

hw.physmem: 4260958208
hw.usermem: 4167311360
hw.realmem: 536870912

All figures are OK when running an i386 kernel in the same VM (but of course lower than in amd64 mode):

FreeBSD 11.1-STABLE #0 r330790: Mon Mar 12 08:56:08 CET 2018
    toor@latitude.local:/usr/obj/usr/src/sys/HMO i386
...
real memory  = 3758030848 (3583 MB)
avail memory = 3678859264 (3508 MB)

hw.physmem: 3744882688
hw.usermem: 3710955520
hw.realmem: 3758030848

And also when reducing memory allocation from 4096 MB to 3072 MB the amd64 figures are sensible:

FreeBSD 11.1-STABLE #0 r330790: Fri Mar 16 20:51:59 CET 2018
    root@latitude.local:/usr/obj/amd64.amd64/usr/src/sys/GENERIC amd64
...
real memory  = 3221159936 (3071 MB)
avail memory = 3079446528 (2936 MB)

hw.physmem: 3187220480
hw.usermem: 3106312192
hw.realmem: 3221159936
Comment 1 Helge Oldach 2018-03-17 11:33:05 UTC
boot verbose:

FreeBSD 11.1-STABLE #0 r330790: Fri Mar 16 20:51:59 CET 2018
    root@latitude.local:/usr/obj/amd64.amd64/usr/src/sys/GENERIC amd64
...
real memory  = 4831838208 (4608 MB)
Physical memory chunk(s):
0x0000000000001000 - 0x000000000009bfff, 634880 bytes (155 pages)
0x0000000000100000 - 0x00000000001fffff, 1048576 bytes (256 pages)
0x00000000021fa000 - 0x00000000d8a43fff, 3599015936 bytes (878666 pages)
0x0000000100000000 - 0x000000011ffe7fff, 536772608 bytes (131048 pages)
avail memory = 4104138752 (3914 MB)

physical chunk view seems OK:

(155+256+878666+131048)*4096 = 4137472000
Comment 2 Andriy Gapon freebsd_committer 2018-03-17 13:00:29 UTC
Could you check smbios.memory.enabled ?
Also, please check if dmidecode reports anything interesting about memory.
Comment 3 Helge Oldach 2018-03-17 13:46:37 UTC
Created attachment 191573 [details]
dmidecode output
Comment 4 Helge Oldach 2018-03-17 13:47:19 UTC
(In reply to Andriy Gapon from comment #2)
# kenv | fgrep smbios
smbios.bios.reldate="12/01/2006"
smbios.bios.vendor="innotek GmbH"
smbios.bios.version="VirtualBox"
smbios.chassis.maker="Oracle Corporation"
smbios.planar.maker="Oracle Corporation"
smbios.planar.product="VirtualBox"
smbios.planar.serial="0"
smbios.planar.version="1.2"
smbios.system.family="Virtual Machine"
smbios.system.maker="innotek GmbH"
smbios.system.product="VirtualBox"
smbios.system.serial="0"
smbios.system.uuid="3414027f-54d3-4fa2-bdcb-6a3d2da28177"
smbios.system.version="1.2"
smbios.version="2.5"
#
Comment 5 Helge Oldach 2019-01-03 08:24:38 UTC
This issue still exists in 12-STABLE and latest VirtualBox version (5.2.22).