public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mateusz Jończyk" <mat.jonczyk@o2.pl>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: "Mateusz Jończyk" <mat.jonczyk@o2.pl>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Yinghai Lu" <yinghai@kernel.org>,
	"Randy Dunlap" <rdunlap@infradead.org>
Subject: [PATCH v2 01/10] x86/Kconfig: enable X86_X2APIC by default and improve help text
Date: Sun, 11 Sep 2022 10:47:02 +0200	[thread overview]
Message-ID: <20220911084711.13694-2-mat.jonczyk@o2.pl> (raw)
In-Reply-To: <20220911084711.13694-1-mat.jonczyk@o2.pl>

As many current platforms (most modern Intel CPUs and QEMU) have x2APIC
present, enable CONFIG_X86_X2APIC by default as it gives performance
and functionality benefits. Additionally, if the BIOS has already
switched APIC to x2APIC mode, but CONFIG_X86_X2APIC is disabled, the
kernel will panic in arch/x86/kernel/apic/apic.c .

Also improve the help text, which was confusing and really did not
describe what the feature is about.

Help text references and discussion:

Both Intel [1] and AMD [3] spell the name as "x2APIC", not "x2apic".

"It allows faster access to the local APIC"
        [2], chapter 2.1, page 15:
        "More efficient MSR interface to access APIC registers."

"x2APIC was introduced in Intel CPUs around 2008":
        I was unable to find specific information which Intel CPUs
        support x2APIC. Wikipedia claims it was "introduced with the
        Nehalem microarchitecture in November 2008", but I was not able
        to confirm this independently. At least some Nehalem CPUs do not
        support x2APIC [1].

        The documentation [2] is dated June 2008. Linux kernel also
        introduced x2APIC support in 2008, so the year seems to be
        right.

"and in AMD EPYC CPUs in 2019":
        [3], page 15:
        "AMD introduced an x2APIC in our EPYC 7002 Series processors for
        the first time."

"It is also frequently emulated in virtual machines, even when the host
CPU does not support it."
        [1]

"If this configuration option is disabled, the kernel will not boot on
some platforms that have x2APIC enabled."
        According to some BIOS documentation [4], the x2APIC may be
        "disabled", "enabled", or "force enabled" on this system.
        I think that "enabled" means "made available to the operating
        system, but not already turned on" and "force enabled" means
        "already switched to x2APIC mode when the OS boots". Only in the
        latter mode a kernel without CONFIG_X86_X2APIC will panic in
        validate_x2apic() in arch/x86/kernel/apic/apic.c .

	QEMU 4.2.1 and my Intel HP laptop (bought in 2019) use the
	"enabled" mode and the kernel does not panic.

[1] "Re: [Qemu-devel] [Question] why x2apic's set by default without host sup"
        https://lists.gnu.org/archive/html/qemu-devel/2013-07/msg03527.html

[2] Intel® 64 Architecture x2APIC Specification,
        ( https://www.naic.edu/~phil/software/intel/318148.pdf )

[3] Workload Tuning Guide for AMD EPYC ™ 7002 Series Processor Based
        Servers Application Note,
        https://developer.amd.com/wp-content/resources/56745_0.80.pdf

[4] UEFI System Utilities and Shell Command Mobile Help for HPE ProLiant
        Gen10, ProLiant Gen10 Plus Servers and HPE Synergy:
        Enabling or disabling Processor x2APIC Support
        https://techlibrary.hpe.com/docs/iss/proliant-gen10-uefi/s_enable_disable_x2APIC_support.html

Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>

---
v2: language fixes by Mr Randy Dunlap, change option name
---
 arch/x86/Kconfig | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f9920f1341c8..28133b5d3f12 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -440,15 +440,27 @@ config X86_FEATURE_NAMES
 	  If in doubt, say Y.
 
 config X86_X2APIC
-	bool "Support x2apic"
+	bool "x2APIC interrupt controller architecture support"
 	depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
+	default y
 	help
-	  This enables x2apic support on CPUs that have this feature.
+	  x2APIC is an interrupt controller architecture, a component of which
+	  (the local APIC) is present in the CPU. It allows faster access to
+	  the local APIC and supports a larger number of CPUs in the system
+	  than the predecessors.
 
-	  This allows 32-bit apic IDs (so it can support very large systems),
-	  and accesses the local apic via MSRs not via mmio.
+	  x2APIC was introduced in Intel CPUs around 2008 and in AMD EPYC CPUs
+	  in 2019, but it can be disabled by the BIOS. It is also frequently
+	  emulated in virtual machines, even when the host CPU does not support
+	  it. Support in the CPU can be checked by executing
+		cat /proc/cpuinfo | grep x2apic
 
-	  If you don't know what to do here, say N.
+	  If this configuration option is disabled, the kernel will not boot on
+	  some platforms that have x2APIC enabled.
+
+	  Say N if you know that your platform does not have x2APIC.
+
+	  Otherwise, say Y.
 
 config X86_MPPARSE
 	bool "Enable MPS table" if ACPI
-- 
2.25.1


  reply	other threads:[~2022-09-11  8:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11  8:47 [PATCH v2 00/10] x86: Kconfig cleanups and help text improvements Mateusz Jończyk
2022-09-11  8:47 ` Mateusz Jończyk [this message]
2022-10-26 18:38   ` [PATCH v2 01/10] x86/Kconfig: enable X86_X2APIC by default and improve help text Borislav Petkov
2022-12-01 15:11     ` Thomas Gleixner
2022-10-27 14:45   ` Elliott, Robert (Servers)
2022-10-27 15:07     ` Dave Hansen
2022-11-03 23:41       ` Elliott, Robert (Servers)
2022-11-04 17:29         ` Dave Hansen
2024-02-02 14:08   ` David Heidelberg
2024-02-15 21:10     ` Mateusz Jończyk
2024-02-20 16:26       ` David Heidelberg
2024-07-05 22:28       ` David Heidelberg
2022-09-11  8:47 ` [PATCH v2 02/10] x86/apic: fix panic message when x2APIC is not supported Mateusz Jończyk
2022-10-27 15:08   ` Elliott, Robert (Servers)
2022-09-11  8:47 ` [PATCH v2 03/10] x86/Kconfig: always enable ARCH_SPARSEMEM_ENABLE Mateusz Jończyk
2022-09-11  8:47 ` [PATCH v2 04/10] x86/Kconfig: drop X86_32_NON_STANDARD Mateusz Jończyk
2022-09-11  8:47 ` [PATCH v2 05/10] x86/Kconfig: move all X86_EXTENDED_PLATFORM options together Mateusz Jończyk
2022-09-11  8:47 ` [PATCH v2 06/10] x86/Kconfig: update lists in X86_EXTENDED_PLATFORM Mateusz Jończyk
2022-09-11  8:47 ` [PATCH v2 07/10] x86/Kconfig: document CONFIG_PCI_MMCONFIG Mateusz Jończyk
2022-09-11  8:47 ` [PATCH v2 08/10] x86/Kconfig: make CONFIG_PCI_CNB20LE_QUIRK depend on X86_32 Mateusz Jończyk
2022-09-13 22:50   ` Bjorn Helgaas
2022-09-11  8:47 ` [PATCH v2 09/10] x86/Kconfig: document release year of glibc 2.3.3 Mateusz Jończyk
2022-09-11  8:47 ` [PATCH v2 10/10] x86/Kconfig: remove CONFIG_ISA_BUS Mateusz Jończyk

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=20220911084711.13694-2-mat.jonczyk@o2.pl \
    --to=mat.jonczyk@o2.pl \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --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