Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752084AbcJFExq (ORCPT ); Thu, 6 Oct 2016 00:53:46 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:34707 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751628AbcJFExo (ORCPT ); Thu, 6 Oct 2016 00:53:44 -0400 MIME-Version: 1.0 In-Reply-To: References: <1472114120-3281-4-git-send-email-douly.fnst@cn.fujitsu.com> From: Yinghai Lu Date: Wed, 5 Oct 2016 21:53:42 -0700 X-Google-Sender-Auth: qj6_GA9SdnHtmGfIKAG53JtfF3Q Message-ID: Subject: Re: [tip:x86/apic] x86/acpi: Introduce persistent storage for cpuid <-> apicid mapping To: Thomas Gleixner Cc: Linux Kernel Mailing List , Gu Zheng , Tang Chen , Ingo Molnar , douly.fnst@cn.fujitsu.com, zhugh.fnst@cn.fujitsu.com, "H. Peter Anvin" , "linux-tip-commits@vger.kernel.org" , Tony Luck Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1741 Lines: 63 On Wed, Oct 5, 2016 at 7:04 AM, Thomas Gleixner wrote: >> @@ -176,6 +177,11 @@ static int acpi_register_lapic(int id, u >> return -EINVAL; >> } >> >> + if (!enabled && (id == disabled_id)) { >> + ++disabled_cpus; >> + return -EINVAL; >> + } > > Why would you need that disabled_id thing at all? The proper fix is to let > the apic driver detect the issue and this boils down to a 5 lines > change. Does the patch below fix the issue for you? > 8<---------------- > --- a/arch/x86/kernel/apic/apic.c > +++ b/arch/x86/kernel/apic/apic.c > @@ -2076,6 +2076,11 @@ int __generic_processor_info(int apicid, > bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid, > phys_cpu_present_map); > > + if (!apic->apic_id_valid(apicid)) { > + disabled_cpus++; > + return -EINVAL; > + } > + > /* > * boot_cpu_physical_apicid is designed to have the apicid > * returned by read_apic_id(), i.e, the apicid of the > > No, That does not fix the issue. the system have x2apic pre_enabled from BIOS, so at the time apic is set to &apic_x2apic_cluster. early_acpi_boot_init ==> early_acpi_process_madt ==> acpi_parse_madt ==> default_acpi_madt_oem_check default_acpi_madt_oem_check ==> apic_x2apic_cluster/x2apic_acpi_madt_oem_check ==> x2apic_enabled ==> apic = &apic_x2apic_cluster and static int x2apic_apic_id_valid(int apicid) { return 1; } To make your change work, may need to update x2apic_apic_id_valid to static int x2apic_apic_id_valid(int apicid) { if (apicid == 0xff || apicid == -1) return 0; return 1; } Thanks Yinghai