public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Rui" <rui.zhang@intel.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
	"bp@alien8.de" <bp@alien8.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Tang, Feng" <feng.tang@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [RFC PATCH] x86/acpi: Ignore invalid x2APIC entries
Date: Mon, 31 Jul 2023 13:04:00 +0000	[thread overview]
Message-ID: <613df280116378115585d0c483f7e186cffaeb58.camel@intel.com> (raw)
In-Reply-To: <87pm4bp54z.ffs@tglx>

On Sat, 2023-07-29 at 09:07 +0200, Thomas Gleixner wrote:
> On Fri, Jul 28 2023 at 16:47, Rui Zhang wrote:
> > On Fri, 2023-07-28 at 14:51 +0200, Thomas Gleixner wrote:
> > > As the call sites during MADT parsing ignore the return value
> > > anyway,
> > > there is no harm and this is a proper defense against broken
> > > tables
> > > which enumerate an APIC twice.
> > 
> > Yeah, this can fix the duplicate APIC ID issue.
> 
> We want it independent of the below.
> 
> > But for x2APIC CPUs with unique APIC ID, but smaller than 255,
> > should
> > we still enumerate them when we already have valid LAPIC entries?
> > 
> > For the Ivebridge-EP 2-socket system,
> > 
> > LAPIC: APIC ID from 0x0 - 0xB, 0x10 - 0x1B, 0x20 - 0x2B, 0x30 -
> > 0x3B
> > x2APIC: APIC ID from 0x0 - 0x77
> > 
> > # cpuid -1 -l 0xb -s 1
> > CPU:
> >       --- level 1 (core) ---
> >       bits to shift APIC ID to get next = 0x5 (5)
> >       logical processors at this level  = 0x18 (24)
> >       level number                      = 0x1 (1)
> >       level type                        = core (2)
> >       extended APIC ID                  = 0
> > 
> > If we still enumerates all the x2APIC entries,
> > 1. we got 72 extra possible CPUs from x2APIC
> > 2. with the patch at
> > https://lore.kernel.org/all/87edm36qqb.ffs@tglx/ ,
> > _max_logical_packages is set to 4 instead of 2.
> > 
> > this is still a problem, right?
> 
> Yes, you are right.
> 
> But I still don't like the indirection of the returned CPU number.
> It's
> an ACPI selfcontained issue, no?
> 
> So something like this should do the trick:
> 
> +               count =
> acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC,
> +                                       acpi_parse_lapic,
> MAX_LOCAL_APIC);
> +               if (count)
> +                       has_lapic_cpus = true;
> +               x2count =
> acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_X2APIC,
> +                                       acpi_parse_x2apic,
> MAX_LOCAL_APIC);
>         }
>         if (!count && !x2count) {
>                 pr_err("No LAPIC entries present\n");

Agreed, thanks for the advice.
Let me try to do this in v2 patch series.

thanks,
rui


  reply	other threads:[~2023-07-31 13:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 16:28 [RFC PATCH] x86/acpi: Ignore invalid x2APIC entries Zhang Rui
2023-07-28 12:51 ` Thomas Gleixner
2023-07-28 12:55   ` Thomas Gleixner
2023-07-28 16:47   ` Zhang, Rui
2023-07-29  7:07     ` Thomas Gleixner
2023-07-31 13:04       ` Zhang, Rui [this message]
2024-10-10 21:31 ` Jim Mattson
2024-10-11  1:37   ` Zhang, Rui
2024-10-11  3:05     ` Jim Mattson
2024-10-14 13:05       ` Zhang, Rui
2024-10-14 18:00         ` Jim Mattson
2024-10-15  3:23           ` Zhang, Rui
2024-10-15 13:26             ` Jim Mattson

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=613df280116378115585d0c483f7e186cffaeb58.camel@intel.com \
    --to=rui.zhang@intel.com \
    --cc=bp@alien8.de \
    --cc=feng.tang@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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