From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758537AbcHYI5o (ORCPT ); Thu, 25 Aug 2016 04:57:44 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:52590 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752755AbcHYI5n (ORCPT ); Thu, 25 Aug 2016 04:57:43 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="10271946" Subject: Re: [PATCH v12 2/7] x86, acpi, cpu-hotplug: Enable acpi to register all possible cpus at boot time. To: References: <1472114120-3281-1-git-send-email-douly.fnst@cn.fujitsu.com> <1472114120-3281-3-git-send-email-douly.fnst@cn.fujitsu.com> CC: , , , , , , , , , , From: Dou Liyang Message-ID: Date: Thu, 25 Aug 2016 16:57:37 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1472114120-3281-3-git-send-email-douly.fnst@cn.fujitsu.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 3875141C0B84.A7140 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi tglx, At 08/25/2016 04:35 PM, Dou Liyang wrote: > arch/x86/kernel/apic/apic.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c > index cea4fc1..e5612a9 100644 > --- a/arch/x86/kernel/apic/apic.c > +++ b/arch/x86/kernel/apic/apic.c > @@ -2024,7 +2024,7 @@ void disconnect_bsp_APIC(int virt_wire_setup) > apic_write(APIC_LVT1, value); > } > > -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, > @@ -2090,7 +2090,6 @@ int generic_processor_info(int apicid, int version) > return -EINVAL; > } > > - num_processors++; > if (apicid == boot_cpu_physical_apicid) { I move the "num_processors++" below. Because I think that if "apicid == boot_cpu_physical_apicid" is true, The "disabled_cpus" will plus one that may conflict with the "num_processors++" Is my thought right? > /* > * x86_bios_cpu_apicid is required to have processors listed > @@ -2113,6 +2112,7 @@ int generic_processor_info(int apicid, int version) > > pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", > thiscpu, apicid); > + > disabled_cpus++; > return -ENOSPC; > } > @@ -2132,7 +2132,6 @@ int generic_processor_info(int apicid, int version) > apic_version[boot_cpu_physical_apicid], cpu, version); > } > > - physid_set(apicid, phys_cpu_present_map); > if (apicid > max_physical_apicid) > max_physical_apicid = apicid; > > @@ -2145,11 +2144,22 @@ int generic_processor_info(int apicid, int version) > apic->x86_32_early_logical_apicid(cpu); > #endif > set_cpu_possible(cpu, true); > - set_cpu_present(cpu, true); > + > + if (enabled) { > + num_processors++; > + physid_set(apicid, phys_cpu_present_map); > + set_cpu_present(cpu, true); > + } else > + disabled_cpus++; > I remove all the "if (enabled)" code and do the unified judgment here. Thanks, Dou