Re: [PATCH 10/26] x86-64, NUMA: Move apicid to numa mapping initializationfrom amd_scan_nodes() to amd_numa_init()

From: Cyrill Gorcunov
Date: Tue Feb 15 2011 - 13:27:45 EST


On 02/15/2011 09:01 PM, Cyrill Gorcunov wrote:
On 02/15/2011 08:54 PM, Yinghai Lu wrote:
...

could just change

- if (boot_cpu_physical_apicid> 0) {
+ if (boot_cpu_physical_apicid != -1U) {
pr_info("BSP APIC ID: %02x\n", boot_cpu_physical_apicid);
apicid_base = boot_cpu_physical_apicid;
}

Thanks

Yinghai

yup, that is exactly what Tejun suggested in first place ;) I'll update to
this form and add your Acked-by then, ok?


Tejun I've updated it on top of your tj-numa/x86_64-numa-unify branch
and added Acks.

--
x86, numa: amd -- Check for screwed MADT table

In case if MADT table is corrupted we might end up
with boot_cpu_physical_apicid = -1U, corebits > 0 and
get out of __apicid_to_node array bound access. Check for
boot_cpu_physical_apicid being a sane value.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
Acked-by: Tejun Heo <tj@xxxxxxxxxx>
Acked-by: Yinghai Lu <yinghai@xxxxxxxxxx>
---
arch/x86/mm/amdtopology_64.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6.git/arch/x86/mm/amdtopology_64.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/mm/amdtopology_64.c
+++ linux-2.6.git/arch/x86/mm/amdtopology_64.c
@@ -212,14 +212,16 @@ void __init amd_fake_nodes(const struct
{
unsigned int bits;
unsigned int cores;
- unsigned int apicid_base = 0;
+ unsigned int apicid_base;
int i;

bits = boot_cpu_data.x86_coreid_bits;
cores = 1 << bits;
early_get_boot_cpu_id();
- if (boot_cpu_physical_apicid > 0)
+ if (boot_cpu_physical_apicid != -1U)
apicid_base = boot_cpu_physical_apicid;
+ else
+ apicid_base = 0;

for (i = 0; i < nr_nodes; i++) {
int index;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/