Linux-Kernel

Ubuntu 18.04 不使用超過 32GB 的 RAM

  • September 9, 2018

我剛剛用另外 32GB 的 RAM 升級了我的 PC。BIOS 和lshw都承認所有四個 16GB RAM 模組的存在,但兩者都沒有freetop並且htop看到實際記憶體。

$ sudo lshw
adam-potwor                 
   width: 64 bits
   capabilities: smbios-3.0 dmi-3.0 smp vsyscall32
   configuration: boot=normal chassis=desktop family=To Be Filled By O.E.M. sku=To Be Filled By O.E.M. uuid=00020003-0004-0005-0006-000700080009
 *-core
      description: Motherboard
      product: X399 Taichi
      vendor: ASRock
      physical id: 0
      serial: M80-AA002300154
    *-firmware
         description: BIOS
         vendor: American Megatrends Inc.
         physical id: 0
         version: P1.50
         date: 09/05/2017
         size: 64KiB
         capacity: 15MiB
         capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification uefi
    *-memory
         description: System Memory
         physical id: 10
         slot: System board or motherboard
         size: 64GiB
       *-bank:0
            description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 2134 MHz (0.5 ns)
            product: F4-3000C16-16GISB
            vendor: Unknown
            physical id: 0
            serial: 00000000
            slot: DIMM 0
            size: 16GiB
            width: 64 bits
            clock: 2134MHz (0.5ns)
       *-bank:1
            description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 2134 MHz (0.5 ns)
            product: F4-3000C16-16GISB
            vendor: Unknown
            physical id: 1
            serial: 00000000
            slot: DIMM 1
            size: 16GiB
            width: 64 bits
            clock: 2134MHz (0.5ns)
       *-bank:2
            description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 2134 MHz (0.5 ns)
            product: F4-3000C16-16GISB
            vendor: Unknown
            physical id: 2
            serial: 00000000
            slot: DIMM 0
            size: 16GiB
            width: 64 bits
            clock: 2134MHz (0.5ns)
       *-bank:3
            description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 2134 MHz (0.5 ns)
            product: F4-3000C16-16GISB
            vendor: Unknown
            physical id: 3
            serial: 00000000
            slot: DIMM 1
            size: 16GiB
            width: 64 bits
            clock: 2134MHz (0.5ns)
       *-bank:4
            description: [empty]
            product: Unknown
            vendor: Unknown
            physical id: 4
            serial: Unknown
            slot: DIMM 0
       *-bank:5
            description: [empty]
            product: Unknown
            vendor: Unknown
            physical id: 5
            serial: Unknown
            slot: DIMM 1
       *-bank:6
            description: [empty]
            product: Unknown
            vendor: Unknown
            physical id: 6
            serial: Unknown
            slot: DIMM 0
       *-bank:7
            description: [empty]
            product: Unknown
            vendor: Unknown
            physical id: 7
            serial: Unknown
            slot: DIMM 1
    *-cache:0
         description: L1 cache
         physical id: 12
         slot: L1 - Cache
         size: 1536KiB
         capacity: 1536KiB
         clock: 1GHz (1.0ns)
         capabilities: pipeline-burst internal write-back unified
         configuration: level=1
    *-cache:1
         description: L2 cache
         physical id: 13
         slot: L2 - Cache
         size: 8MiB
         capacity: 8MiB
         clock: 1GHz (1.0ns)
         capabilities: pipeline-burst internal write-back unified
         configuration: level=2
    *-cache:2
         description: L3 cache
         physical id: 14
         slot: L3 - Cache
         size: 32MiB
         capacity: 32MiB
         clock: 1GHz (1.0ns)
         capabilities: pipeline-burst internal write-back unified
         configuration: level=3
    *-cpu
         description: CPU
         product: AMD Ryzen Threadripper 1950X 16-Core Processor
         vendor: Advanced Micro Devices [AMD]
         physical id: 15
         bus info: cpu@0
         version: AMD Ryzen Threadripper 1950X 16-Core Processor
         serial: Unknown
         slot: SP3r2
         size: 1888MHz
         capacity: 4200MHz
         width: 64 bits
         clock: 100MHz
         capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid amd_dcm aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca cpufreq
         configuration: cores=16 enabledcores=16 threads=32


$ free -h
             total        used        free      shared  buff/cache   available
Mem:            31G        1.8G         27G         18M        1.8G         29G
Swap:           14G          0B         14G

我使用附帶的 Ubuntu 18.04

$ uname -r
4.15.0-33-generic

核心。我可以在 AskUbuntu 上發布這個問題,但我覺得這個問題與核心相關,而不是特定於 Ubuntu。我目前的 grub 啟動條目顯示為

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-9c791297-4f61-471a-ac23-6228987c316e' {
   recordfail
   load_video
   gfxmode $linux_gfx_mode
   insmod gzio
   if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
   insmod part_gpt
   insmod ext2
   set root='hd0,gpt1'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  b0fddb5e-191e-4de0-b8bd-543c3e22a22a
   else
     search --no-floppy --fs-uuid --set=root b0fddb5e-191e-4de0-b8bd-543c3e22a22a
   fi
       linux   /vmlinuz-4.15.0-33-generic root=UUID=9c791297-4f61-471a-ac23-6228987c316e ro rootflags=subvol=@  quiet splash $vt_handoff
   initrd  /initrd.img-4.15.0-33-generic
}

我還安裝了 Windows (tm) 來診斷問題。而 Windows 10 64bit 也只能看到 32GB 的 RAM。它將另外 32GB 診斷為“硬體保留”,這強烈表明主機板韌體中存在錯誤。

我還確認,我的主機板具有最新的 BIOS 版本(截至 2018 年 9 月 7 日)

$ dmesg |grep Memory
[    0.000000] Memory: 32676352K/33432868K available (12300K kernel code, 2470K rwdata, 4244K rodata, 2408K init, 2416K bss, 756516K reserved, 0K cma-reserved)
[    0.132315] x86/mm: Memory block size: 128MB

該問題是由不正確的記憶體插槽配置引起的。將記憶體更換為 A2、B2、C2 和 D2 插槽後,正如 Mark Patrick 所描述的,解決了所有問題。

所以這個故事的精神是:當 Linux(或 Windows)沒有使用所有已安裝的記憶體時(即使它看到插槽中的晶片),請檢查記憶體模組是否插入正確的插槽中。

引用自:https://unix.stackexchange.com/questions/467576