tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Re: EFI memory map



On 2020/01/06 17:06, Emmanuel Dreyfus wrote:
> On Thu, Jan 02, 2020 at 03:55:31PM +0000, Emmanuel Dreyfus wrote:
>> And indeed, studying the crash in ddb shows it happens when
>> accessing a physical address that is excluded by x86_fake_clusters() 
>> but included by EFI memory map.
> 
> I think the problem lies in sys/arch/x86/x86/x86_machdep.c:init_x86_vm()
> The function loops on the memory segments provided by EFI/BIOS and 
> call x86_load_region() on the ones that can be used.
> 
> The function considers the case of a segment that spans the
> addresses used by the kernel and splits the segments in that case,
> but it does not consider the cases where the segment is included in
> kernel, or if there is a leading or trailing part that overlaps the
> kernel. 
> 
> The bug happens because a segment overlapping the kernel is used
> by x86_load_region(). 
> 
> Attached patch adds code for that three extra cases, and it makes
> the bug vanish. Is it a reasonable fix? Or did I miss something?
> 

The output:
[   1.0000000] MEMMAP: UEFI MEMORY MAP (17 ENTRIES):
[   1.0000000] MEMMAP: 0x0000000000000000-0x000000000003efff
[   1.0000000]  size=0x000000000003f000, type=1(Memory)
[   1.0000000] MEMMAP: 0x000000000003f000-0x000000000003ffff
[   1.0000000]  size=0x0000000000001000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x0000000000040000-0x000000000009ffff
[   1.0000000]  size=0x0000000000060000, type=1(Memory)
[   1.0000000] MEMMAP: 0x00000000000a0000-0x00000000000fffff
[   1.0000000]  size=0x0000000000060000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x0000000000100000-0x000000007769efff
[   1.0000000]  size=0x000000007759f000, type=1(Memory)
[   1.0000000] MEMMAP: 0x000000007769f000-0x00000000776aefff
[   1.0000000]  size=0x0000000000010000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x00000000776af000-0x000000007d619fff
[   1.0000000]  size=0x0000000005f6b000, type=1(Memory)
[   1.0000000] MEMMAP: 0x000000007d61a000-0x000000007e0f6fff
[   1.0000000]  size=0x0000000000add000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x000000007e0f7000-0x000000007e12dfff
[   1.0000000]  size=0x0000000000037000, type=1(Memory)
[   1.0000000] MEMMAP: 0x000000007e12e000-0x000000007e1e2fff
[   1.0000000]  size=0x00000000000b5000, type=4(NVS)
[   1.0000000] MEMMAP: 0x000000007e1e3000-0x000000007f23ffff
[   1.0000000]  size=0x000000000105d000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x000000007f240000-0x000000007f7fffff
[   1.0000000]  size=0x00000000005c0000, type=1(Memory)
[   1.0000000] MEMMAP: 0x000000007f800000-0x000000007fffffff
[   1.0000000]  size=0x0000000000800000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x00000000e0000000-0x00000000efffffff
[   1.0000000]  size=0x0000000010000000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x00000000fd000000-0x00000000fe7fffff
[   1.0000000]  size=0x0000000001800000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x00000000ff000000-0x00000000ffffffff
[   1.0000000]  size=0x0000000001000000, type=2(Reserved)
[   1.0000000] MEMMAP: 0x0000000100000000-0x000000027fffffff
[   1.0000000]  size=0x0000000180000000, type=1(Memory)
[   1.0000000] segment 0 - 3f000
[   1.0000000] loading freelist 5 0x8000-0x3f000 (0x8-0x3f)
[   1.0000000] segment 40000 - a0000
[   1.0000000] loading freelist 5 0x40000-0xa0000 (0x40-0xa0)
[   1.0000000] segment 100000 - 7769f000
[   1.0000000] split kernel overlapping to 100000 - 200000 and 1d4e000 - 7769f000
[   1.0000000] loading freelist 5 0x100000-0x200000 (0x100-0x200)
[   1.0000000] loading freelist 4 0x1d4e000-0x40000000 (0x1d4e-0x40000)
[   1.0000000] loading freelist 3 0x40000000-0x7769f000 (0x40000-0x7769f)
[   1.0000000] segment 776af000 - 7d61a000
[   1.0000000] loading freelist 3 0x776af000-0x7d61a000 (0x776af-0x7d61a)
[   1.0000000] segment 7e0f7000 - 7e12e000
[   1.0000000] loading freelist 3 0x7e0f7000-0x7e12e000 (0x7e0f7-0x7e12e)
[   1.0000000] segment 7f240000 - 7f800000
[   1.0000000] loading freelist 3 0x7f240000-0x7f800000 (0x7f240-0x7f800)
[   1.0000000] segment 100000000 - 280000000
[   1.0000000] loading default 0x100000000-0x280000000 (0x100000-0x280000)
[   1.0000000] pool redzone disabled for 'pdppl'
[   1.0000000] pool redzone disabled for 'kmem-4096'
[   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[   1.0000000]     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[   1.0000000]     2018, 2019, 2020 The NetBSD Foundation, Inc.  All rights reserved.
[   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[   1.0000000]     The Regents of the University of California.  All rights reserved.

[   1.0000000] NetBSD 9.99.34 (GENERIC) #105: Tue Jan  7 15:21:44 JST 2020
[   1.0000000]  msaitoh%foo.execsw.org@localhost:/disk/sources/NetBSD-current/src/sys/arch/amd64/compile/GENERIC
[   1.0000000] total memory = 8155 MB
[   1.0000000] avail memory = 7890 MB
[   1.0000000] pool redzone disabled for 'buf4k'
[   1.0000000] pool redzone disabled for 'buf64k'
[   1.0000000] cpu_rng: RDSEED
[   1.0000000] timecounter: Timecounters tick every 10.000 msec
[   1.0000000] NET_MPSAFE enabled
[   1.0000000] Kernelized RAIDframe activated
[   1.0000000] running cgd selftest aes-xts-256 aes-xts-512 done
[   1.0000000] RTC BIOS diagnostic error 0x2f<config_unit,fixed_disk,invalid_time>
[   1.0000000] timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
[   1.0000030] efi: systbl at pa 7f171018
[   1.0000030] efi: systbl mapped at va ffff8680ae07e018
[   1.0000030] efi: signature 5453595320494249 revision 2003c crc32 f05818bc
[   1.0000030] efi: firmware revision 5000d
[   1.0000030] efi: runtime services at pa 0x7f171b98
[   1.0000030] efi: boot services at pa 0x0
[   1.0000030] efi: cfgtbl at pa 7f171c98
[   1.0000030] efi: cfgtbl mapped at va ffff8680ae122c98
[   1.0000030] efi: 12 cfgtbl entries:
[   1.0000030] efi: 0x7d019618 a31280ad-481e-41b6-95-e8-127f4c984779
[   1.0000030] efi: 0x7f75d5b0 05ad34ba-6f02-4214-95-2e-4da0398e2bb9
[   1.0000030] efi: 0x7d007018 7739f24c-93d7-11d4-9a-3a-0090273fc14d
[   1.0000030] efi: 0x7f75cf00 4c19049f-4137-4dd3-9c-10-8b97a83ffdfa
[   1.0000030] efi: 0x7f75e8b0 49152e77-1ada-4764-b7-a2-7afefed95e8b
[   1.0000030] efi: 0x7f16f018 00781ca1-5de3-405f-ab-b8-379c3c076984
[   1.0000030] efi: 0x7e12e000 8868e871-e4f1-11d3-bc-22-0080c73c8881 ACPI 2.0
[   1.0000030] efi: 0x7e12e000 eb9d2d30-2d88-11d3-9a-16-0090273fc14d ACPI 1.0
[   1.0000030] efi: 0x7f0c7000 eb9d2d31-2d88-11d3-9a-16-0090273fc14d SMBIOS
[   1.0000030] efi: 0x7f0c6000 f2fd1544-9794-4a2c-99-2e-e5bbcf20e394 SMBIOS3
[   1.0000030] efi: 0x79769018 dcfa911d-26eb-469f-a2-20-38b7dc461220
[   1.0000030] efi: 0x7963aa98 b122a263-3661-4f68-99-29-78f8b0d62180
[   1.0000030] SMBIOS rev. 3.0.0 @ 0x7f0c3000
[   1.0000030] Supermicro Super Server (0123456789)
[   1.0000030] mainbus0 (root)
[   1.0000030] ACPI: RSDP 0x000000007E12E000 000024 (v02 SUPERM)
[   1.0000030] ACPI: XSDT 0x000000007E12E098 0000AC (v01 SUPERM SMCI--MB 01072009 AMI  00010013)
[   1.0000030] ACPI: FACP 0x000000007E132A20 000114 (v06 SUPERM SMCI--MB 01072009 AMI  00010013)
[   1.0000030] ACPI: DSDT 0x000000007E12E1D8 004848 (v02 SUPERM SMCI--MB 01072009 INTL 20061109)
[   1.0000030] ACPI: FACS 0x000000007E1E1080 000040
[   1.0000030] ACPI: FPDT 0x000000007E132B38 000044 (v01 SUPERM SMCI--MB 01072009 AMI  00010013)
[   1.0000030] ACPI: FIDT 0x000000007E132B80 00009C (v01 SUPERM SMCI--MB 01072009 AMI  00010013)
[   1.0000030] ACPI: SPMI 0x000000007E132C20 000041 (v05 SUPERM SMCI--MB 00000000 AMI. 00000000)
[   1.0000030] ACPI: MCFG 0x000000007E132C68 00003C (v01 SUPERM SMCI--MB 01072009 MSFT 00000097)
[   1.0000030] ACPI: WDAT 0x000000007E132CA8 0001AC (v01 SUPERM SMCI--MB 01072009 MSFT 00010013)
[   1.0000030] ACPI: APIC 0x000000007E132E58 0000D8 (v04 INTEL  TIANO    00000001 MSFT 00000000)
[   1.0000030] ACPI: BDAT 0x000000007E132F30 000030 (v01                 00000000      00000000)
[   1.0000030] ACPI: HPET 0x000000007E132F60 000038 (v01 SUPERM SMCI--MB 00000001 MSFT 01000013)
[   1.0000030] ACPI: UEFI 0x000000007E132F98 000042 (v01 SUPERM SMCI--MB 00000002      01000013)
[   1.0000030] ACPI: SSDT 0x000000007E132FE0 001901 (v02 PmRef  CpuPm    00003000 INTL 20061109)
[   1.0000030] ACPI: DMAR 0x000000007E1348E8 000070 (v01 INTEL  BDW      00000001 INTL 00000001)
[   1.0000030] ACPI: HEST 0x000000007E134958 0000A8 (v01 INTEL  VND      00000001 INTL 00000001)
[   1.0000030] ACPI: BERT 0x000000007E134A00 000030 (v01 INTEL  VND      00000001 INTL 00000001)
[   1.0000030] ACPI: ERST 0x000000007E134A30 000230 (v01 INTEL  VND      00000001 INTL 00000001)
[   1.0000030] ACPI: EINJ 0x000000007E134C60 000150 (v01 INTEL  VND      00000001 INTL 00000001)
[   1.0000030] ACPI: WSMT 0x000000007E134DB0 000028 (v01 u?              01072009 AMI  00010013)
[   1.0000030] ACPI: 2 ACPI AML tables successfully acquired and loaded
[   1.0000030] ioapic0 at mainbus0 apid 2: pa 0xfec00000, version 0x20, 24 pins
[   1.0000030] cpu0 at mainbus0 apid 0
[   1.0000030] cpu0: 32 page colors
[   1.0000030] cpu0: calibrating local timer
[   1.0000030] cpu0: apic clock running at 25 MHz
[   1.0000030] timecounter: Timecounter "lapic" frequency 25025543 Hz quality -100
[   1.0000030] cpu0: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu0: node 0, package 0, core 0, smt 0
[   1.0000030] cpu0: PAT enabled
[   1.0000030] cpu1 at mainbus0 apid 2
[   1.0000030] cpu1: 2 page colors
[   1.0000030] i82489_ipi_init: ESR 00000040
[   1.0000030] cpu1: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu1: node 0, package 0, core 1, smt 0
[   1.0000030] cpu1: PAT enabled
[   1.0000030] cpu2 at mainbus0 apid 4
[   1.0000030] cpu2: 2 page colors
[   1.0000030] cpu2: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu2: node 0, package 0, core 2, smt 0
[   1.0000030] cpu2: PAT enabled
[   1.0000030] cpu3 at mainbus0 apid 6
[   1.0000030] cpu3: 2 page colors
[   1.0000030] cpu3: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu3: node 0, package 0, core 3, smt 0
[   1.0000030] cpu3: PAT enabled
[   1.0000030] cpu4 at mainbus0 apid 8
[   1.0000030] cpu4: 2 page colors
[   1.0000030] cpu4: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu4: node 0, package 0, core 4, smt 0
[   1.0000030] cpu4: PAT enabled
[   1.0000030] cpu5 at mainbus0 apid 10
[   1.0000030] cpu5: 2 page colors
[   1.0000030] cpu5: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu5: node 0, package 0, core 5, smt 0
[   1.0000030] cpu5: PAT enabled
[   1.0000030] cpu6 at mainbus0 apid 12
[   1.0000030] cpu6: 2 page colors
[   1.0000030] cpu6: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu6: node 0, package 0, core 6, smt 0
[   1.0000030] cpu6: PAT enabled
[   1.0000030] cpu7 at mainbus0 apid 14
[   1.0000030] cpu7: 2 page colors
[   1.0000030] cpu7: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu7: node 0, package 0, core 7, smt 0
[   1.0000030] cpu7: PAT enabled
[   1.0000030] cpu8 at mainbus0 apid 16
[   1.0000030] cpu8: 2 page colors
[   1.0000030] cpu8: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu8: node 0, package 0, core 8, smt 0
[   1.0000030] cpu8: PAT enabled
[   1.0000030] cpu9 at mainbus0 apid 18
[   1.0000030] cpu9: 2 page colors
[   1.0000030] cpu9: Intel(R) Atom(TM) CPU C3958 @ 2.00GHz, id 0x506f1
[   1.0000030] cpu9: node 0, package 0, core 9, smt 0
[   1.0000030] cpu9: PAT enabled
[   1.0000030] cpu10 at mainbus0 apid 20
[   1.0000030] cpu10: 2 page colors



-- 
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index