Bug 226673 - real memory > physical memory (amd64 VirtualBox guest)
Summary: real memory > physical memory (amd64 VirtualBox guest)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-17 10:57 UTC by Helge Oldach
Modified: 2023-08-18 19:56 UTC (History)
3 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 freebsd_triage 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).
Comment 6 Helge Oldach 2021-01-27 10:55:09 UTC
(In reply to Helge Oldach from comment #5)
Still the same with FreeBSD 13.0-ALPHA2 #3 stable/13-c256213-g03d837b565a and virtualbox-ose-additions-5.2.44_3:

4096 MB memory allocated to the VM shows up as:

real memory  = 4831838208 (4608 MB)
avail memory = 4137705472 (3946 MB)

hw.physmem: 4278755328
hw.usermem: 4159344640
hw.realmem: 4831838208
Comment 7 Graham Perrin freebsd_committer freebsd_triage 2021-02-10 01:24:55 UTC
Please, is this bug observable with non-BSD guests? 

2008 retrospective: 

virtualbox.org • View topic - FreeBSD doesn't 'see' all available memory — <https://forums.virtualbox.org/viewtopic.php?f=4&t=6370>

– led to this fix for BSD guests: 

<https://www.virtualbox.org/ticket/2342>

----

For reference, non-closed BSD guest bugs: 

<https://www.virtualbox.org/query?status=%21closed&guest=BSD>
Comment 8 Helge Oldach 2021-02-10 07:52:41 UTC
I quickly fired up a fresh Ubuntu Server w/ 4GB which says:

hmo@u:~$ grep MemTotal /proc/meminfo
MemTotal:        4027028 kB
hmo@u:~$ 

This is correct, so I assume it's a FreeBSD issue.