Messages in this thread Patch in this message | | | Date | Tue, 15 Feb 2011 21:27:37 +0300 | From | Cyrill Gorcunov <> | Subject | Re: [PATCH 10/26] x86-64, NUMA: Move apicid to numa mapping initialization from amd_scan_nodes() to amd_numa_init() |
| |
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@openvz.org> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Yinghai Lu <yinghai@kernel.org> --- 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;
| |