[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56089E7A.7040400@cn.fujitsu.com>
Date: Mon, 28 Sep 2015 09:57:14 +0800
From: Tang Chen <tangchen@...fujitsu.com>
To: Tejun Heo <tj@...nel.org>
CC: <jiang.liu@...ux.intel.com>, <mika.j.penttila@...il.com>,
<mingo@...hat.com>, <akpm@...ux-foundation.org>,
<rjw@...ysocki.net>, <hpa@...or.com>, <yasu.isimatu@...il.com>,
<isimatu.yasuaki@...fujitsu.com>, <kamezawa.hiroyu@...fujitsu.com>,
<izumi.taku@...fujitsu.com>, <gongzhaogang@...pur.com>,
<qiaonuohan@...fujitsu.com>, <x86@...nel.org>,
<linux-acpi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-mm@...ck.org>, <tangchen@...fujitsu.com>
Subject: Re: [PATCH v2 5/7] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[]
array to store persistent cpuid <-> apicid mapping.
On 09/27/2015 01:56 AM, Tejun Heo wrote:
> 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?
Right, indeed. It is in
generic_processor_info()
|--> if (num_processors >= nr_cpu_ids)
Will remove my new added check.
Thanks.
>
> Thanks.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists