Ignore SRAT memory entries if the memory range does not overlap with an
existing phys_avail[] table. If a hw.physmem setting causes a memory domain to not be present in phys_avail[], the SRAT table will now be ignored rather than triggering a panic when a CPU in the missing domain tries to allocate a page. MFC after: 1 week
This commit is contained in:
parent
f20f6f3fdf
commit
4d99cfb313
@ -59,6 +59,26 @@ static vm_paddr_t srat_physaddr;
|
||||
|
||||
static void srat_walk_table(acpi_subtable_handler *handler, void *arg);
|
||||
|
||||
/*
|
||||
* Returns true if a memory range overlaps with at least one range in
|
||||
* phys_avail[].
|
||||
*/
|
||||
static int
|
||||
overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) {
|
||||
if (phys_avail[i + 1] < start)
|
||||
continue;
|
||||
if (phys_avail[i] < end)
|
||||
return (1);
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg)
|
||||
{
|
||||
@ -111,6 +131,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg)
|
||||
"enabled" : "disabled");
|
||||
if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED))
|
||||
break;
|
||||
if (!overlaps_phys_avail(mem->BaseAddress,
|
||||
mem->BaseAddress + mem->Length)) {
|
||||
printf("SRAT: Ignoring memory at addr %jx\n",
|
||||
(uintmax_t)mem->BaseAddress);
|
||||
break;
|
||||
}
|
||||
if (num_mem == VM_PHYSSEG_MAX) {
|
||||
printf("SRAT: Too many memory regions\n");
|
||||
*(int *)arg = ENXIO;
|
||||
|
Loading…
Reference in New Issue
Block a user