#StackBounty: #linux-kernel #ram Reserved RAM: Determine the reason for reserved main memory?

Bounty: 200

On a server, the linux kernel at boot informs about the RAM setup. It indicates that of the physical 512GiB RAM (536409480kiB), only roughly 503GiB RAM (527942676kiB) are available.

root@ada:~# dmesg | grep Memory:
[    5.891484] Memory: 527942676K/536409480K available (10252K kernel code, 1241K rwdata, 3320K rodata, 1592K init, 2272K bss, 8466804K reserved, 0K cma-reserved)

Some memory being unavailable is expected given the IO regions reserved by the bios.

root@ada:~# dmesg | grep reserved
[    0.000000] BIOS-e820: [mem 0x000000000009c000-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000004f66f000-0x0000000057677fff] reserved
[    0.000000] BIOS-e820: [mem 0x000000006cdcf000-0x000000006efcefff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000070000000-0x000000008fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000107f380000-0x000000107fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000207ff80000-0x000000207fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000307ff80000-0x000000307fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000407ff80000-0x000000407fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000507ff80000-0x000000507fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000607ff80000-0x000000607fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000707ff80000-0x000000707fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x000000807ff80000-0x000000807fffffff] reserved

which however do not amount to more than 100MiB.

I wonder how to investigate what causes this memory to be reserved? What is the cause?

Without understanding the purpose for the reserved memory it seems simply like a ~9GiB loss of memory.
Given that the system acts as a virtualization host, this "loss" is excarbated as each virtualized guest system in turn has a similar fraction of its dedicated RAM also "reserved".

Since other question have suggested that such memory could be reserved for "shared memory" of a graphic card, I looked this up, yet the adapter present only seems to use ~50MiB at most.

root@ada:~# lspci  | grep -i vga
03:00.0 VGA compatible controller: Matrox Electronics Systems Ltd. Integrated Matrox G200eW3 Graphics Controller (rev 04)
root@ada:~# lspci -s 03:00.0 -vvv
03:00.0 VGA compatible controller: Matrox Electronics Systems Ltd. Integrated Matrox G200eW3 Graphics Controller (rev 04) (prog-if 00 [VGA controller])
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0 (4000ns min, 8000ns max)
        Interrupt: pin A routed to IRQ 243
        NUMA node: 0
        Region 0: Memory at eb000000 (32-bit, prefetchable) [size=16M]
        Region 1: Memory at f9808000 (32-bit, non-prefetchable) [size=16K]
        Region 2: Memory at f9000000 (32-bit, non-prefetchable) [size=8M]
        [virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
        Capabilities: [dc] Power Management version 3
                Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
        Kernel driver in use: mgag200
        Kernel modules: mgag200

Update

Here is the complete dmesg output

Update
It is a Dell Poweredge Server, that boots in BIOS mode (not UEFI)

Update

Here is the output of /proc/iomem

Update

Here the evaluated output of /proc/iomem

root@ada:~# cat /proc/iomem | tr [a-z] [A-Z] | while IFS='-: ' read AD1 AD2 REST;
> do echo "$(( $(echo "obase=10; ibase=16; ( $AD2 - $AD1 ) " | bc) >> 20))MB for  $REST" ; 
> done | sort -h 

[...]
14MB for  ACPI NON-VOLATILE STORAGE                                                                                                        
15MB for  0000:03:00.0
15MB for  MGADRMFB_VRAM
15MB for  PCI BUS 0000:02
15MB for  PCI BUS 0000:03
33MB for  RESERVED
128MB for  RESERVED
207MB for  PCI BUS 0000:20
207MB for  PCI BUS 0000:40
207MB for  PCI BUS 0000:60
207MB for  PCI BUS 0000:80
207MB for  PCI BUS 0000:A0
207MB for  PCI BUS 0000:C0
207MB for  PCI BUS 0000:E0
255MB for  PCI MMCONFIG 0000 [BUS 00-FF]
255MB for  PNP 00:00
315MB for  PCI BUS 0000:00
343MB for  SYSTEM RAM
511MB for  RESERVED
543MB for  RESERVED
1269MB for  SYSTEM RAM
63475MB for  SYSTEM RAM
65535MB for  SYSTEM RAM
65535MB for  SYSTEM RAM
65535MB for  SYSTEM RAM
65535MB for  SYSTEM RAM
65535MB for  SYSTEM RAM
65535MB for  SYSTEM RAM
65535MB for  SYSTEM RAM
915967MB for  PCI BUS 0000:00
915967MB for  PCI BUS 0000:20
915967MB for  PCI BUS 0000:40
915967MB for  PCI BUS 0000:60
915967MB for  PCI BUS 0000:80
915967MB for  PCI BUS 0000:A0
915967MB for  PCI BUS 0000:C0
915967MB for  PCI BUS 0000:E0


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.