Message ID | 1472114120-3281-3-git-send-email-douly.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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) { /* * 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++; return cpu; } +int generic_processor_info(int apicid, int version) +{ + return __generic_processor_info(apicid, version, true); +} + int hard_smp_processor_id(void) { return read_apic_id();