From: Dou Liyang <douly.fnst@cn.fujitsu.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: cl@linux.com, tj@kernel.org, mika.j.penttila@gmail.com,
mingo@redhat.com, akpm@linux-foundation.org, rjw@rjwysocki.net,
hpa@zytor.com, yasu.isimatu@gmail.com,
isimatu.yasuaki@jp.fujitsu.com, kamezawa.hiroyu@jp.fujitsu.com,
izumi.taku@jp.fujitsu.com, gongzhaogang@inspur.com,
len.brown@intel.com, lenb@kernel.org, chen.tang@easystack.cn,
rafael@kernel.org, x86@kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Gu Zheng <guz.fnst@cn.fujitsu.com>,
Tang Chen <tangchen@cn.fujitsu.com>,
Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Subject: Re: [PATCH v10 2/7] x86, acpi, cpu-hotplug: Enable acpi to register all possible cpus at boot time.
Date: Tue, 2 Aug 2016 15:30:38 +0800 [thread overview]
Message-ID: <31882463-3647-15eb-1410-47bbb87a69d7@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1607291526210.19896@nanos>
Hi tglx,
a?? 2016a1'07ae??29ae?JPY 21:36, Thomas Gleixner a??e??:
> On Tue, 26 Jul 2016, Dou Liyang wrote:
>
>> 1. Enable apic registeration flow to handle both enabled and disabled cpus.
>> This is done by introducing an extra parameter to generic_processor_info to
>> let the caller control if disabled cpus are ignored.
>
> If I'm reading the patch correctly then the 'enabled' argument controls more
> than the disabled cpus accounting. It also controls the modification of
> num_processors and the present mask.
In the patch, they both need mapping to a logic cpu.
As you said, the 'enabled' controls extra functions:
1. num_processors parameter
2. physid_set method
3. set_cpu_present method
>
>> -int generic_processor_info(int apicid, int version)
>> +static int __generic_processor_info(int apicid, int version, bool enabled)
>> {
>> int cpu, max = nr_cpu_ids;
>> bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
>> @@ -2032,7 +2032,8 @@ int generic_processor_info(int apicid, int version)
>> " Processor %d/0x%x ignored.\n",
>> thiscpu, apicid);
>>
>> - disabled_cpus++;
>> + if (enabled)
>> + disabled_cpus++;
>> return -ENODEV;
>> }
>>
>> @@ -2049,7 +2050,8 @@ int generic_processor_info(int apicid, int version)
>> " reached. Keeping one slot for boot cpu."
>> " Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
>>
>> - disabled_cpus++;
>> + if (enabled)
>> + disabled_cpus++;
>
> This is utterly confusing. That code path cannot be reached when enabled is
> false, because num_processors is 0 as we never increment it when enabled is
> false.
>
> That said, I really do not like this 'slap some argument on it and make it
> work somehow' approach.
>
> The proper solution for this is to seperate out the functionality which you
> need for the preparation run (enabled = false) and make sure that the
> information you need for the real run (enabled = true) is properly cached
> somewhere so we don't have to evaluate the same thing over and over.
Thank you very much for your advice. That solution is very good for me.
I thought about the differences between them carefully. Firstly, I
intend to separate out the functionality in two functions. It's simple
but not good. Then, I try to put them together to judge just once.
After, considering the judgment statement independence and the order of
assignment. I remove all the "if (enabled)" code and do the unified
judgment like this:
@@ -2180,12 +2176,19 @@ int __generic_processor_info(int apicid, int
version, bool enabled)
apic->x86_32_early_logical_apicid(cpu);
#endif
set_cpu_possible(cpu, true);
- if (enabled)
+
+ if (enabled){
+ num_processors++;
+ physid_set(apicid, phys_cpu_present_map);
set_cpu_present(cpu, true);
+ }else{
+ disabled_cpus++;
+ }
return cpu;
}
I hope that patch could consistent with your advice. And I will submit
the detailed modification in the next version patches.
Thanks,
Dou.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-08-02 7:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-26 6:10 [PATCH v10 0/7] Make cpuid <-> nodeid mapping persistent Dou Liyang
2016-07-26 6:10 ` [PATCH v10 1/7] x86, memhp, numa: Online memory-less nodes at boot time Dou Liyang
2016-07-26 6:10 ` [PATCH v10 2/7] x86, acpi, cpu-hotplug: Enable acpi to register all possible cpus " Dou Liyang
2016-07-29 13:36 ` Thomas Gleixner
2016-08-02 7:30 ` Dou Liyang [this message]
2016-07-26 6:10 ` [PATCH v10 3/7] x86, acpi, cpu-hotplug: Introduce cpuid_to_apicid[] array to store persistent cpuid <-> apicid mapping Dou Liyang
2016-07-26 6:10 ` [PATCH v10 4/7] x86, acpi, cpu-hotplug: Enable MADT APIs to return disabled apicid Dou Liyang
2016-07-26 6:10 ` [PATCH v10 5/7] x86, acpi, cpu-hotplug: Set persistent cpuid <-> nodeid mapping when booting Dou Liyang
2016-07-26 6:10 ` [PATCH v10 6/7] acpi: Provide the mechanism to validate processors in the ACPI tables Dou Liyang
2016-07-26 6:10 ` [PATCH v10 7/7] acpi: Provide the interface to validate the proc_id Dou Liyang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31882463-3647-15eb-1410-47bbb87a69d7@cn.fujitsu.com \
--to=douly.fnst@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=chen.tang@easystack.cn \
--cc=cl@linux.com \
--cc=gongzhaogang@inspur.com \
--cc=guz.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mika.j.penttila@gmail.com \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=tangchen@cn.fujitsu.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=x86@kernel.org \
--cc=yasu.isimatu@gmail.com \
--cc=zhugh.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox