From: Thomas Gleixner <tglx@linutronix.de>
To: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Steve Wahl" <steve.wahl@hpe.com>,
"Justin Ernst" <justin.ernst@hpe.com>,
"Kyle Meyer" <kyle.meyer@hpe.com>,
"Dimitri Sivanich" <dimitri.sivanich@hpe.com>,
"Russ Anderson" <russ.anderson@hpe.com>,
"Darren Hart" <dvhart@infradead.org>,
"Andy Shevchenko" <andy@infradead.org>,
"K. Y. Srinivasan" <kys@microsoft.com>,
"Haiyang Zhang" <haiyangz@microsoft.com>,
"Wei Liu" <wei.liu@kernel.org>,
"Dexuan Cui" <decui@microsoft.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Cc: linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: Notes on BAD_APICID, Was: [PATCH 0/3] x86/apic: Misc pruning
Date: Sat, 04 Nov 2023 20:15:05 +0100 [thread overview]
Message-ID: <87zfztib46.ffs@tglx> (raw)
In-Reply-To: <36462e78-8014-4415-bc47-86fbb46d028b@citrix.com>
On Fri, Nov 03 2023 at 19:58, Andrew Cooper wrote:
> On 02/11/2023 12:26 pm, Andrew Cooper wrote:
> Another dodgy construct spotted while doing this work is
>
> #ifdef CONFIG_X86_32
> #define BAD_APICID 0xFFu
> #else
> #define BAD_APICID 0xFFFFu
> #endif
>
> considering that both of those "bad" values are legal APIC IDs in an
> x2APIC system.
>
> The majority use is as a sentential (of varying types - int, u16
> mostly), although the uses for NUM_APIC_CLUSTERS, and
> safe_smp_processor_id() look suspect.
>
> In particular, safe_smp_processor_id() *will* malfunction on some legal
> CPUs, and needs to use -1 (32 bits wide) to spot the intended error case
> of a bad xAPIC mapping.
>
> However, it's use in amd_pmu_cpu_starting() from topology_die_id() looks
> broken. Partly because the error handling is (only) a WARN_ON_ONCE(),
> and also because nb->nb_id's sentinel value is -1 of type int.
>
> I suspect there's a lot of cleaning to be done here too.
Sigh...
prev parent reply other threads:[~2023-11-04 19:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 12:26 [PATCH 0/3] x86/apic: Misc pruning Andrew Cooper
2023-11-02 12:26 ` [PATCH 1/3] x86/apic: Drop apic::delivery_mode Andrew Cooper
2023-11-03 20:15 ` Steve Wahl
2023-11-04 19:13 ` Thomas Gleixner
2023-11-02 12:26 ` [PATCH 2/3] x86/apic: Drop enum apic_delivery_modes Andrew Cooper
2023-11-03 20:15 ` Steve Wahl
2023-11-02 12:26 ` [PATCH 3/3] x86/apic: Drop struct local_apic Andrew Cooper
2023-11-03 20:16 ` Steve Wahl
2023-11-14 11:32 ` Ilpo Järvinen
2023-11-03 19:58 ` Notes on BAD_APICID, Was: [PATCH 0/3] x86/apic: Misc pruning Andrew Cooper
2023-11-04 19:15 ` Thomas Gleixner [this message]
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=87zfztib46.ffs@tglx \
--to=tglx@linutronix.de \
--cc=andrew.cooper3@citrix.com \
--cc=andy@infradead.org \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=dimitri.sivanich@hpe.com \
--cc=dvhart@infradead.org \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=justin.ernst@hpe.com \
--cc=kw@linux.com \
--cc=kyle.meyer@hpe.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mingo@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=robh@kernel.org \
--cc=russ.anderson@hpe.com \
--cc=steve.wahl@hpe.com \
--cc=wei.liu@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).