[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <E053FB6951F019A2+20250228051847.50002-1-wangyuli@uniontech.com>
Date: Fri, 28 Feb 2025 13:18:47 +0800
From: WangYuli <wangyuli@...ontech.com>
To: dave.hansen@...ux.intel.com,
luto@...nel.org,
peterz@...radead.org,
tglx@...utronix.de,
mingo@...hat.com,
bp@...en8.de,
x86@...nel.org,
hpa@...or.com
Cc: linux-kernel@...r.kernel.org,
zhanjun@...ontech.com,
niecheng1@...ontech.com,
chenlinxuan@...ontech.com,
WangYuli <wangyuli@...ontech.com>,
Huacai Chen <chenhuacai@...ngson.cn>,
Wentao Guan <guanwentao@...ontech.com>
Subject: [PATCH] x86/srat: Conditional apic_id vs MAX_LOCAL_APIC comparison
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. It is only capable of exceeding 256 and 32768 — which
corresponds to the definition of MAX_LOCAL_APIC — when CONFIG_X86_X2APIC
is activated.
Consequently, with CONFIG_X86_X2APIC disabled, this code segment will
elicit the compiler's "-Wtautological-constant-out-of-range-compare"
warning, as a variable capped at 255 can never satisfy a condition
requiring it to be greater than or equal to 256 or 32768.
Compiling the kernel with the W=1e flag will, in this scenario, lead
to compilation failure.
Suggested-by: Huacai Chen <chenhuacai@...ngson.cn>
Co-developed-by: Wentao Guan <guanwentao@...ontech.com>
Signed-off-by: Wentao Guan <guanwentao@...ontech.com>
Signed-off-by: WangYuli <wangyuli@...ontech.com>
---
arch/x86/mm/srat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 6f8e0f21c710..93e5bcc58ead 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -90,10 +90,12 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
else
apic_id = pa->apic_id;
+#ifdef CONFIG_X86_X2APIC
if (apic_id >= MAX_LOCAL_APIC) {
printk(KERN_INFO "SRAT: PXM %u -> APIC 0x%02x -> Node %u skipped apicid that is too big\n", pxm, apic_id, node);
return;
}
+#endif /* CONFIG_X86_X2APIC */
set_apicid_to_node(apic_id, node);
node_set(node, numa_nodes_parsed);
--
2.47.2
Powered by blists - more mailing lists