Re: [PATCH] x86/srat: Conditional apic_id vs MAX_LOCAL_APIC comparison
From: Ingo Molnar
Date: Fri Feb 28 2025 - 04:36:08 EST
* WangYuli <wangyuli@xxxxxxxxxxxxx> wrote:
> The apic_id employed within the acpi_numa_processor_affinity_init()
> function is derived from the acpi_srat_cpu_affinity structure defined
> in acpi/actbl3.h.
>
> When CONFIG_X86_X2APIC is not enabled, its maximum value is limited
> to 255.
How does the compiler know the value is limited to 0-255?
<acpi/actbl3.h> has an u32 apic_id field:
struct acpi_srat_x2apic_cpu_affinity {
struct acpi_subtable_header header;
u16 reserved; /* Reserved, must be zero */
u32 proximity_domain;
u32 apic_id;
^^^^^^^^^^^^
u32 flags;
u32 clock_domain;
u32 reserved2;
};
and the apic_id local variable in acpi_numa_processor_affinity_init()
is an 'int':
int apic_id;
Neither is limited to 0-255.
Thanks,
Ingo