SerenityOS / serenity

The Serenity Operating System 🐞
https://serenityos.org
BSD 2-Clause "Simplified" License
30.53k stars 3.18k forks source link

Kernel: x86_64 fails to boot with 24 GiB memory #8855

Open tomuta opened 3 years ago

tomuta commented 3 years ago
[Kernel]: Loading kernel symbol table...                                                                                                                                                                                                                                            [9/14]
[Kernel]: CPU[0]: Supported features: nx pae pge rdrand rdseed smap smep sse tsc rdtscp umip sep syscall mmx sse2 sse3 ssse3 sse4.1 sse4.2 xsave avx fxsr lm hypervisor                                                                                                                   
[Kernel]: CPU[0]: Physical address bit width: 40                                                                                                                                                                                                                                          
[#0 Kernel]: Initializing unhandled interrupt handlers                                                                                                                                                                                                                                    
[Kernel]: CPU[0]: CPUID hypervisor signature 'KVMKVMKVM' (0x4b4d564b 0x564b4d56 0x4d), max leaf 0x40000001                                                                                                                                                                                
[Kernel]: Kernel Commandline: Kernel/Kernel vmmouse=off vmmouse=off                                                                                                                                                                                                                       
[Kernel]: MM: Multiboot mmap: address=0x0000000000000000, length=654336, type=1                                                                                                                                                                                                           
[Kernel]: MM: Got an unaligned physical_region from the bootloader; correcting length 654336 by 3072 bytes                                                                                                                                                                                
[Kernel]: MM: Multiboot mmap: address=0x000000000009fc00, length=1024, type=2                                                                                                                                                                                                             
[Kernel]: MM: Multiboot mmap: address=0x00000000000f0000, length=65536, type=2                                                                                                                                                                                                            
[Kernel]: MM: Multiboot mmap: address=0x0000000000100000, length=3220045824, type=1
[Kernel]: MM: Multiboot mmap: address=0x00000000bffe0000, length=131072, type=2
[Kernel]: MM: Multiboot mmap: address=0x00000000feffc000, length=16384, type=2
[Kernel]: MM: Multiboot mmap: address=0x00000000fffc0000, length=262144, type=2
[Kernel]: MM: Multiboot mmap: address=0x0000000100000000, length=22548578304, type=1
[Kernel]: MM: Contiguous reserved range from P000000000009fc00, length is 394240
[Kernel]: MM: Contiguous reserved range from P00000000bffe0000, length is 1073872896
[Kernel]: MM: boot_pml4t @ P0000000000101000
[Kernel]: MM: boot_pdpt @ P0000000000102000
[Kernel]: MM: boot_pd0 @ P0000000000103000
[Kernel]: MM: boot_pd3 @ P0000000000104000
[Kernel]: MM: Physical page entries: 0x00000000c3001000 - 0x00000000c6201fff (size 0x03201000)
[Kernel]: MM: Low memory range @ P0000000000000000 - P00000000000fffff (size 0x100000)
[Kernel]: MM: Kernel range @ P0000000000100000 - P0000000001ac1fff (size 0x19c2000)
[Kernel]: MM: Physical Pages range @ P0000000001ac3000 - P0000000004cddfff (size 0x321b000)
[Kernel]: MM: Super physical region: P000000000012b000 - P000000000022afff (size 0x100000)
[Kernel]:  * 1x PhysicalZone (1 MiB) @ 000000000012b000-000000000012afff
[Kernel]: MM: User physical region: P0000000004cde000 - P00000000bffdffff (size 0xbb302000)
[Kernel]:  * 187x PhysicalZone (16 MiB) @ 0000000004cde000-00000000becddfff
[Kernel]:  * 3x PhysicalZone (1 MiB) @ 00000000bfcde000-00000000bfeddfff
[Kernel]: MM: User physical region: P0000000100000000 - P000000063fffffff (size 0x40000000)
[Kernel]: ASSERTION FAILED: s_next_eternal_ptr < s_end_of_eternal_range
[Kernel]: ../../Kernel/Heap/kmalloc.cpp:241 in void* kmalloc_eternal(size_t)
#0  0x00000000c080abeb in Kernel::halt_this () at ../.././Kernel/Arch/x86/ASM_wrapper.h:152
#1  Kernel::Processor::halt () at ../../Kernel/Arch/x86/common/Processor.cpp:1012
#2  0x00000000c0801c7f in abort () at ../../Kernel/Arch/x86/common/CPU.cpp:31
#3  0x00000000c0801a9c in __assertion_failed () at ../../Kernel/Arch/x86/common/CPU.cpp:19
#4  0x00000000c08a8d18 in kmalloc_eternal () at ../../Kernel/Heap/kmalloc.cpp:241
#5  0x00000000c07a90a0 in Kernel::PhysicalZone::operator new () at ../.././Kernel/VM/PhysicalZone.h:20
#6  AK::make<Kernel::PhysicalZone, PhysicalAddress&, unsigned long&> () at ../.././AK/NonnullOwnPtr.h:168
#7  operator() () at ../../Kernel/VM/PhysicalRegion.cpp:49
#8  0x00000000c07a9fd2 in Kernel::PhysicalRegion::initialize_zones () at ../../Kernel/VM/PhysicalRegion.cpp:60
#9  0x00000000c095286e in Kernel::MemoryManager::parse_memory_map () at ../../Kernel/VM/MemoryManager.cpp:333
#10 0x00000000c0953e30 in Kernel::MemoryManager::MemoryManager () at ../../Kernel/VM/MemoryManager.cpp:67
#11 0x00000000c0954a39 in Kernel::MemoryManager::initialize () at ../../Kernel/VM/MemoryManager.cpp:605
#12 0x00000000c095789f in init () at ../../Kernel/init.cpp:132
#13 0x00000000c0100409 in long_mode_supported () at ../../Kernel/Arch/x86/common/Boot/boot.S:567
#14 0x4b2f6c656e72654b in ?? ()
#15 0x6d76206c656e7265 in ?? ()
#16 0x666f3d6573756f6d in ?? ()
#17 0x73756f6d6d762066 in ?? ()
#18 0x65710066666f3d65 in ?? ()
#19 0x000000000000756d in ?? ()
#20 0x0000000000000000 in ?? ()

@awesomekling I wonder if the culprit is the allocation bitmaps, looks like it did get past the biggest block of physical memory but then ran out of heap memory. If it is then moving the bitmaps out of the heap would probably solve the problem.

dascandy commented 3 years ago

+1, confirmed.

dascandy commented 3 years ago

incidentally, the size of that region is very wrong?!

dascandy commented 3 years ago

last one is just a logging mistake; PAGE_SIZE and region.size () are 32-bit so the result is truncated.