Skip to content

Commit

Permalink
acpi: ignore disabled CPUs reported in MADT table
Browse files Browse the repository at this point in the history
Some systems report many CPUs, most marked as disabled.
To save memory for PerCPU frames, ignore all disabled CPUs.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Aug 13, 2021
1 parent 5e9d0c7 commit 5a6413f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions common/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,19 @@ static int process_madt_entries(unsigned bsp_cpu_id) {
switch (entry->type) {
case ACPI_MADT_TYPE_LAPIC: {
acpi_madt_processor_t *madt_cpu = (acpi_madt_processor_t *) entry->data;
percpu_t *percpu = get_percpu_page(madt_cpu->apic_proc_id);
percpu_t *percpu;
bool enabled;

/* Some systems report all CPUs, marked as disabled */
enabled = !!(madt_cpu->flags & 0x1);
if (!enabled)
break;

percpu = get_percpu_page(madt_cpu->apic_proc_id);
percpu->cpu_id = madt_cpu->apic_proc_id;
percpu->apic_id = madt_cpu->apic_id;
percpu->bsp = !!(madt_cpu->apic_proc_id == bsp_cpu_id);
percpu->enabled = !!(madt_cpu->flags & 0x1);

if (!percpu->enabled)
continue;
percpu->enabled = enabled;

nr_cpus++;
printk("ACPI: [MADT] APIC Processor ID: %u, APIC ID: %u, Flags: %08x\n",
Expand Down

0 comments on commit 5a6413f

Please sign in to comment.