From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v2 4/6] x86/APIC: drop probe_default()
Date: Fri, 5 Nov 2021 13:34:57 +0100 [thread overview]
Message-ID: <38e0ef5b-0cef-9fd3-ea5d-8cf76005c689@suse.com> (raw)
In-Reply-To: <d88cfda3-54e4-2323-f536-547879380815@suse.com>
The function does nothing but return success. Simply treat absence of a
probe hook to mean just this. This then eliminates the (purely
theoretical at this point) risk of trying to call through
apic_x2apic_{cluster,phys}'s respective NULL pointers.
While doing this also eliminate generic_apic_probe()'s "changed"
variable: apic_probe[]'s default entry will now be used unconditionally
in yet more obvious a way, such that separately setting genapic from
apic_default is (hopefully) no longer justified. Yet that was the main
purpose of the variable.
To help prove that apic_default's probe() hook doesn't get used
elsewhere, further make apic_probe[] static at this occasion.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: New.
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -14,12 +14,7 @@
#include <asm/io_apic.h>
/* should be called last. */
-static __init int probe_default(void)
-{
- return 1;
-}
-
const struct genapic __initconstrel apic_default = {
- APIC_INIT("default", probe_default),
+ APIC_INIT("default", NULL),
GENAPIC_FLAT
};
--- a/xen/arch/x86/genapic/probe.c
+++ b/xen/arch/x86/genapic/probe.c
@@ -18,7 +18,7 @@
struct genapic __read_mostly genapic;
-const struct genapic *const __initconstrel apic_probe[] = {
+static const struct genapic *const __initconstrel apic_probe[] = {
&apic_bigsmp,
&apic_default, /* must be last */
NULL,
@@ -59,22 +59,20 @@ custom_param("apic", genapic_apic_force)
void __init generic_apic_probe(void)
{
- bool changed;
int i;
record_boot_APIC_mode();
check_x2apic_preenabled();
- cmdline_apic = changed = !!genapic.name;
- for (i = 0; !changed && apic_probe[i]; i++) {
- if (apic_probe[i]->probe()) {
- changed = 1;
+ cmdline_apic = genapic.name;
+
+ for (i = 0; !genapic.name && apic_probe[i]; i++) {
+ if (!apic_probe[i]->probe || apic_probe[i]->probe())
genapic = *apic_probe[i];
- }
}
- if (!changed)
- genapic = apic_default;
+
+ BUG_ON(!genapic.name);
printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
}
next prev parent reply other threads:[~2021-11-05 12:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 12:30 [PATCH v2 0/6] x86: ACPI / APIC / IOMMU interaction Jan Beulich
2021-11-05 12:32 ` [PATCH v2 1/6][4.16?] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich
2021-11-05 15:38 ` Roger Pau Monné
2021-11-05 15:47 ` Ian Jackson
2021-11-08 7:44 ` Jan Beulich
2021-11-08 15:04 ` Ian Jackson
2021-11-08 15:13 ` Jan Beulich
2021-11-16 15:19 ` [PATCH v2 1/6][4.16?] x86/x2APIC: defer probe until after IOMMU ACPI table parsing [and 2 more messages] Ian Jackson
2021-11-08 7:40 ` [PATCH v2 1/6][4.16?] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich
2021-11-08 9:36 ` Roger Pau Monné
2021-11-08 9:54 ` Jan Beulich
2021-11-05 12:34 ` [PATCH v2 2/6] x86/APIC: drop clustered_apic_check() hook Jan Beulich
2021-11-08 11:02 ` Roger Pau Monné
2021-11-08 11:17 ` Jan Beulich
2021-11-05 12:34 ` [PATCH v2 3/6] x86/APIC: drop {acpi_madt,mps}_oem_check() hooks Jan Beulich
2021-11-05 12:34 ` Jan Beulich [this message]
2021-11-05 12:35 ` [PATCH v2 5/6] x86/APIC: rename cmdline_apic Jan Beulich
2021-11-05 12:35 ` [PATCH v2 6/6] x86/ACPI: drop dead interpreter-related code Jan Beulich
2021-11-08 11:40 ` [PATCH v2.1 1/6][4.16?] x86/x2APIC: defer probe until after IOMMU ACPI table parsing Jan Beulich
2021-11-08 11:54 ` Roger Pau Monné
2021-11-15 12:06 ` Jan Beulich
2021-11-15 14:31 ` [PATCH v2.2 " Jan Beulich
2021-11-15 15:07 ` Roger Pau Monné
2021-11-15 16:10 ` Jan Beulich
2021-11-16 11:44 ` Roger Pau Monné
2021-11-16 12:09 ` [PATCH v2 0/6] x86: ACPI / APIC / IOMMU interaction Andrew Cooper
2021-11-16 14:20 ` Jan Beulich
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=38e0ef5b-0cef-9fd3-ea5d-8cf76005c689@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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).