lkml.org 
[lkml]   [2015]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 5/7] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[] array to store persistent cpuid <-> apicid mapping.
On Sat, Sep 26, 2015 at 05:52:09PM +0800, Tang Chen wrote:
> >>+static int allocate_logical_cpuid(int apicid)
> >>+{
> >>+ int i;
> >>+
> >>+ /*
> >>+ * cpuid <-> apicid mapping is persistent, so when a cpu is up,
> >>+ * check if the kernel has allocated a cpuid for it.
> >>+ */
> >>+ for (i = 0; i < max_logical_cpuid; i++) {
> >>+ if (cpuid_to_apicid[i] == apicid)
> >>+ return i;
> >>+ }
> >>+
> >>+ /* Allocate a new cpuid. */
> >>+ if (max_logical_cpuid >= nr_cpu_ids) {
> >>+ WARN_ONCE(1, "Only %d processors supported."
> >>+ "Processor %d/0x%x and the rest are ignored.\n",
> >>+ nr_cpu_ids - 1, max_logical_cpuid, apicid);
> >>+ return -1;
> >>+ }
> >So, the original code didn't have this failure mode, why is this
> >different for the new code?
>
> It is not different. Since max_logical_cpuid is new, this is ensure it won't
> go beyond NR_CPUS.

If the above condition can happen, the original code should have had a
similar check as above, right? Sure, max_logical_cpuid is a new thing
but that doesn't seem to change whether the above condition can happen
or not, no?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2015-09-26 20:21    [W:0.109 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site