From: Dou Liyang <douly.fnst@cn.fujitsu.com>
To: Yinghai Lu <yinghai@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
"linux-tip-commits@vger.kernel.org"
<linux-tip-commits@vger.kernel.org>,
Tony Luck <tony.luck@intel.com>
Subject: Re: [tip:x86/apic] x86/acpi: Introduce persistent storage for cpuid <-> apicid mapping
Date: Thu, 6 Oct 2016 16:06:42 +0800 [thread overview]
Message-ID: <4608f474-c49e-550b-90e2-c5f4c25e00f5@cn.fujitsu.com> (raw)
In-Reply-To: <CAE9FiQWigWvrZ8JzNDKtZ9FWARh2m0kGoF+VOZdwAdY9vnU3_w@mail.gmail.com>
Hi Yinghai,
At 10/06/2016 12:53 PM, Yinghai Lu wrote:
> On Wed, Oct 5, 2016 at 7:04 AM, Thomas Gleixner <tglx@linutronix.de> 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;
>
I seem to remember that in x2APIC Spec the x2APIC ID may be at 255 or
greater.
If we do that judgment, it may be affect x2APIC's work in some other places.
I saw the MADT, the main reason may be that we define 0xff to acpi_id
in LAPIC mode.
As you said, it was like:
[ 42.107902] ACPI: LAPIC (acpi_id[0xff] lapic_id[0xff] disabled)
[ 42.120125] ACPI: LAPIC (acpi_id[0xff] lapic_id[0xff] disabled)
[ 42.132361] ACPI: LAPIC (acpi_id[0xff] lapic_id[0xff] disabled)
...
How about doing the acpi_id check when we parse it in
acpi_parse_lapic().
8<----------------
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -233,6 +233,11 @@ acpi_parse_lapic(struct acpi_subtable_header *
header, const unsigned long end)
acpi_table_print_madt_entry(header);
+ if (processor->id >= 255) {
+ ++disabled_cpus;
+ return -EINVAL;
+ }
+
/*
* We need to register disabled CPU as well to permit
* counting disabled CPUs. This allows us to size
Thanks
Dou
> return 1;
> }
>
>
> Thanks
>
> Yinghai
>
>
next prev parent reply other threads:[~2016-10-06 8:07 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 8:35 [PATCH v12 0/7] Make cpuid <-> nodeid mapping persistent Dou Liyang
2016-08-25 8:35 ` [PATCH v12 1/7] x86, memhp, numa: Online memory-less nodes at boot time Dou Liyang
2016-09-22 19:09 ` [tip:x86/apic] x86/numa: " tip-bot for Tang Chen
2016-08-25 8:35 ` [PATCH v12 2/7] x86, acpi, cpu-hotplug: Enable acpi to register all possible cpus " Dou Liyang
2016-08-25 8:57 ` Dou Liyang
2016-09-22 19:10 ` [tip:x86/apic] x86/acpi: " tip-bot for Gu Zheng
2016-08-25 8:35 ` [PATCH v12 3/7] x86, acpi, cpu-hotplug: Introduce cpuid_to_apicid[] array to store persistent cpuid <-> apicid mapping Dou Liyang
2016-09-22 19:10 ` [tip:x86/apic] x86/acpi: Introduce persistent storage for " tip-bot for Gu Zheng
2016-10-04 6:02 ` Yinghai Lu
2016-10-05 14:04 ` Thomas Gleixner
2016-10-06 4:53 ` Yinghai Lu
2016-10-06 8:06 ` Dou Liyang [this message]
2016-10-06 21:20 ` Yinghai Lu
2016-10-07 4:35 ` Dou Liyang
2016-10-07 12:50 ` Thomas Gleixner
2016-10-07 13:00 ` Thomas Gleixner
2016-10-07 18:55 ` Yinghai Lu
2016-10-08 5:22 ` Dou Liyang
2016-10-07 11:02 ` Thomas Gleixner
2016-10-07 11:04 ` Thomas Gleixner
2016-10-07 13:07 ` Thomas Gleixner
2016-10-08 4:14 ` Dou Liyang
2016-08-25 8:35 ` [PATCH v12 4/7] x86, acpi, cpu-hotplug: Enable MADT APIs to return disabled apicid Dou Liyang
2016-09-22 19:11 ` [tip:x86/apic] x86/acpi: Enable MADT APIs to return disabled apicids tip-bot for Gu Zheng
2016-08-25 8:35 ` [PATCH v12 5/7] x86, acpi, cpu-hotplug: Set persistent cpuid <-> nodeid mapping when booting Dou Liyang
2016-09-22 19:11 ` [tip:x86/apic] x86/acpi: " tip-bot for Gu Zheng
2016-08-25 8:35 ` [PATCH v12 6/7] acpi: Provide the mechanism to validate processors in the ACPI tables Dou Liyang
2016-09-22 19:12 ` [tip:x86/apic] acpi: Provide " tip-bot for Dou Liyang
2016-08-25 8:35 ` [PATCH v12 7/7] acpi: Provide the interface to validate the proc_id Dou Liyang
2016-09-22 19:12 ` [tip:x86/apic] acpi: Validate processor id when mapping the processor tip-bot for Dou Liyang
2016-08-25 9:08 ` [PATCH v12 0/7] Make cpuid <-> nodeid mapping persistent Dou Liyang
2016-09-02 6:57 ` Dou Liyang
2016-09-13 11:33 ` 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=4608f474-c49e-550b-90e2-c5f4c25e00f5@cn.fujitsu.com \
--to=douly.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=yinghai@kernel.org \
/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
all inboxes | Powered by JetHome®