x86bios: use M_NOWAIT with mallocs
Or else it triggers the following bug: APIC: CPU 6 has ACPI ID 6 APIC: CPU 7 has ACPI ID 7 panic: vm_wait in early boot cpuid = 0 time = 1 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff826ff8d0 vpanic() at vpanic+0x1a3/frame 0xffffffff826ff930 panic() at panic+0x43/frame 0xffffffff826ff990 vm_wait_domain() at vm_wait_domain+0xf9/frame 0xffffffff826ff9c0 kmem_alloc_contig_domain() at kmem_alloc_contig_domain+0x252/frame 0xffffffff826ffa50 kmem_alloc_contig() at kmem_alloc_contig+0x6c/frame 0xffffffff826ffad0 contigmalloc() at contigmalloc+0x2e/frame 0xffffffff826ffb00 x86bios_modevent() at x86bios_modevent+0x225/frame 0xffffffff826ffb20 module_register_init() at module_register_init+0xc0/frame 0xffffffff826ffb50 mi_startup() at mi_startup+0x118/frame 0xffffffff826ffb70 start_kernel() at start_kernel+0x10 While there also make x86bios_unmap_mem idempotent. Reviewed by: kib Approved by: re (gjb) Sponsored by: Citrix Systems R&D Differential revision: https://reviews.freebsd.org/D17000
This commit is contained in:
parent
ae17e768db
commit
8eec7acbb9
@ -656,17 +656,24 @@ static __inline void
|
||||
x86bios_unmap_mem(void)
|
||||
{
|
||||
|
||||
if (x86bios_map != NULL) {
|
||||
free(x86bios_map, M_DEVBUF);
|
||||
if (x86bios_ivt != NULL)
|
||||
x86bios_map = NULL;
|
||||
}
|
||||
if (x86bios_ivt != NULL) {
|
||||
#ifdef X86BIOS_NATIVE_ARCH
|
||||
pmap_unmapbios((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
|
||||
#else
|
||||
free(x86bios_ivt, M_DEVBUF);
|
||||
x86bios_ivt = NULL;
|
||||
#endif
|
||||
}
|
||||
if (x86bios_rom != NULL)
|
||||
pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
|
||||
if (x86bios_seg != NULL)
|
||||
if (x86bios_seg != NULL) {
|
||||
contigfree(x86bios_seg, X86BIOS_SEG_SIZE, M_DEVBUF);
|
||||
x86bios_seg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline int
|
||||
@ -674,7 +681,9 @@ x86bios_map_mem(void)
|
||||
{
|
||||
|
||||
x86bios_map = malloc(sizeof(*x86bios_map) * X86BIOS_PAGES, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (x86bios_map == NULL)
|
||||
goto fail;
|
||||
|
||||
#ifdef X86BIOS_NATIVE_ARCH
|
||||
x86bios_ivt = pmap_mapbios(X86BIOS_IVT_BASE, X86BIOS_IVT_SIZE);
|
||||
@ -688,7 +697,9 @@ x86bios_map_mem(void)
|
||||
rounddown(x86bios_rom_phys, X86BIOS_PAGE_SIZE);
|
||||
else
|
||||
#else
|
||||
x86bios_ivt = malloc(X86BIOS_IVT_SIZE, M_DEVBUF, M_ZERO | M_WAITOK);
|
||||
x86bios_ivt = malloc(X86BIOS_IVT_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (x86bios_ivt == NULL)
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
x86bios_rom_phys = X86BIOS_ROM_BASE;
|
||||
@ -703,8 +714,10 @@ x86bios_map_mem(void)
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_WAITOK,
|
||||
x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_NOWAIT,
|
||||
X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
|
||||
if (x86bios_seg == NULL)
|
||||
goto fail;
|
||||
x86bios_seg_phys = vtophys(x86bios_seg);
|
||||
|
||||
x86bios_set_pages((vm_offset_t)x86bios_ivt, X86BIOS_IVT_BASE,
|
||||
|
Loading…
Reference in New Issue
Block a user