Re: [GIT PULL] x86/apic changes for v2.6.38

From: Randy Dunlap
Date: Thu Jan 06 2011 - 20:27:29 EST


On Thu, 6 Jan 2011 16:17:10 -0800 Yinghai Lu wrote:

> On Thu, Jan 6, 2011 at 3:53 PM, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> > On Thu, Jan 6, 2011 at 3:48 PM, Luck, Tony <tony.luck@xxxxxxxxx> wrote:
> >> Untested on X86.  Builds and boots on ia64 (both normally and with
> >> maxcpus=8 to limit the number of cpus).
> >>
> >> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> >
> > Looks much better to me, and gets rid of that silly #ifdef that I reacted to.
> >
> > But no hurry, this looks low-priority. So let's make this go through
> > the x86 tree and get merged later, after it has passed whatever normal
> > tests that the -tip tree goes through. Ok?
>
> yes. x86 is safe. We have apicid_to_node[] array, and already check
> apic id with MAX_LOCAL_APIC
> in x86 version acpi_numa_processor_affinity_init().
>
> looks ia64 is using struct array with cpu idx for mapping
>
> node_cpuid[srat_num_cpus].phys_id =
> (pa->apic_id << 8) | (pa->local_sapic_eid);
> /* nid should be overridden as logical node id later */
> node_cpuid[srat_num_cpus].nid = pxm;
> cpu_set(srat_num_cpus, early_cpu_possible_map);
> srat_num_cpus++;
>
> but it does not check the boundary of that array...
>
> struct node_cpuid_s node_cpuid[NR_CPUS]..
>
> so if some one try to boot kernel with small NR_CPUS on bigger IA64
> system, could get some variables node_cpuid[]...
>
> Assume Tony will have another patch for IA64 to check that before
> apply this patch.
>
> sth like
>
> Index: linux-2.6/arch/ia64/kernel/acpi.c
> ===================================================================
> --- linux-2.6.orig/arch/ia64/kernel/acpi.c
> +++ linux-2.6/arch/ia64/kernel/acpi.c
> @@ -477,6 +479,11 @@ acpi_numa_processor_affinity_init(struct
> if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))
> return;
>
> + if (srat_num_cpus >= NR_CPUS) {
> + printk(KERN_WARNING "NR_CPUS (%d) is too small, not all cpus used.
> %d\n", NR_CPUS);

CPUs used.

Don't need %d 2 times.


> + return;
> + }
> +
> pxm = get_processor_proximity_domain(pa);
>
> /* record this node in proximity bitmap */


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
--
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/