Skip to content

Commit

Permalink
linux-5.4.21-323: Enable X2APIC support
Browse files Browse the repository at this point in the history
> CONFIG_X86_X2APIC:
>
> This enables x2apic support on CPUs that have this feature.
>
> This allows 32-bit apic IDs (so it can support very large systems),
> and accesses the local apic via MSRs not via mmio.

On the Dell PowerEdge T640/04WYPY, BIOS 2.4.8 11/27/2019, Linux crashes on start-up.

    [    3.862327] ACPI: Core revision 20190816
    [    3.869551] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635855245 ns
    [    3.878797] APIC: Switch to symmetric I/O mode setup
    [    3.883893] Switched APIC routing to physical flat.
    [    3.888904] ------------[ cut here ]------------
    [    3.893641] kernel BUG at arch/x86/kernel/apic/apic.c:1616!
    [    3.899347] invalid opcode: 0000 [#1] SMP NOPTI
    [    3.903990] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.14.mx64.317 #1
    [    3.910803] Hardware name: Dell Inc. PowerEdge T640/04WYPY, BIOS 2.4.8 11/27/2019
    [    3.918448] RIP: 0010:setup_local_APIC+0x32e/0x390
    [    3.923356] Code: 68 70 2e 01 be 00 07 01 00 bf 50 03 00 00 48 8b 40 10 e8 15 9e db 00 eb a9 be 00 04 01 00 bf 60 03 00 00 e8 04 9e db 00 eb bb <0f> 0b e8 5b 3a 00 00
    [    3.942300] RSP: 0000:ffffffff82403e88 EFLAGS: 00010246
    [    3.947641] RAX: 0000000000000000 RBX: 00000000000000ff RCX: ffffffff82454128
    [    3.955787] RDX: 0000000000000000 RSI: 00000000fffffeff RDI: 0000000000000020
    [    3.963031] RBP: ffffffffffffffff R08: 00000000000001c4 R09: 0734073407370739
    [    3.970277] R10: ffffffff82573000 R11: 0720072007730765 R12: ffffffff82a4a920
    [    3.977522] R13: 0000000000000000 R14: ffff88c07fff0e80 R15: 0000000000000000
    [    3.984766] FS:  0000000000000000(0000) GS:ffff889fffc00000(0000) knlGS:0000000000000000
    [    3.993014] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [    3.998876] CR2: ffff88c07ffff000 CR3: 000000000240a001 CR4: 00000000000606b0
    [    4.006121] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [    4.013365] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [    4.020611] Call Trace:
    [    4.023184]  apic_intr_mode_init+0x1d2/0x1ec
    [    4.027573]  x86_late_time_init+0x17/0x1c
    [    4.031706]  start_kernel+0x41f/0x4d3
    [    4.035491]  secondary_startup_64+0xa4/0xb0
    [    4.039797] Modules linked in:
    [    4.042997] ---[ end trace c3629ce2e87a638c ]---
    [    4.047746] RIP: 0010:setup_local_APIC+0x32e/0x390
    [    4.052663] Code: 68 70 2e 01 be 00 07 01 00 bf 50 03 00 00 48 8b 40 10 e8 15 9e db 00 eb a9 be 00 04 01 00 bf 60 03 00 00 e8 04 9e db 00 eb bb <0f> 0b e8 5b 3a 00 00
    [    4.071617] RSP: 0000:ffffffff82403e88 EFLAGS: 00010246
    [    4.076966] RAX: 0000000000000000 RBX: 00000000000000ff RCX: ffffffff82454128
    [    4.084219] RDX: 0000000000000000 RSI: 00000000fffffeff RDI: 0000000000000020
    [    4.091475] RBP: ffffffffffffffff R08: 00000000000001c4 R09: 0734073407370739
    [    4.098738] R10: ffffffff82573000 R11: 0720072007730765 R12: ffffffff82a4a920
    [    4.106000] R13: 0000000000000000 R14: ffff88c07fff0e80 R15: 0000000000000000
    [    4.113252] FS:  0000000000000000(0000) GS:ffff889fffc00000(0000) knlGS:0000000000000000
    [    4.121509] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [    4.127380] CR2: ffff88c07ffff000 CR3: 000000000240a001 CR4: 00000000000606b0
    [    4.134632] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [    4.141887] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [    4.149142] Kernel panic - not syncing: Attempted to kill the idle task!
    [    4.155968] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---

The reason is the code below in `arch/x86/kernel/apic/apic.c`.

        /*
         * Double-check whether this APIC is really registered.
         * This is meaningless in clustered apic mode, so we skip it.
         */
        BUG_ON(!apic->apic_id_registered());

With `acpi=off noapic` the panic below is shown.

    [    2.577272] Kernel panic - not syncing: BIOS has enabled x2apic but kernel doesn't support x2apic, please disable x2apic in BIOS.

With `nosmp` it also crashes at the same spot.

    [    3.705437] APIC: SMP mode deactivated
    [    3.709189] APIC: Switch to symmetric I/O mode setup in no SMP routine
    [    3.715712] ------------[ cut here ]------------
    [    3.720320] kernel BUG at arch/x86/kernel/apic/apic.c:1616!

Selecting X2APIC support in Linux fixes the crashes/panics.

Disabling x2APIC in the Dell firmware also get the Linux kernel with no
X2APIC support to boot, but some posts on the Web claim, that X2APIC is
more efficient [1].

[1]: https://serverfault.com/questions/873664/when-to-use-x2apic-mode
  • Loading branch information
pmenzel committed Feb 21, 2020
1 parent 107e0fe commit b8ad5e7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions linux-5.4.21-323.bee
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ mee_configure() {
CONFIG_BPF_SYSCALL=y
CONFIG_SLAB=y
CONFIG_SMP=y
CONFIG_X86_X2APIC=y
CONFIG_GART_IOMMU=y
CONFIG_NR_CPUS=256
CONFIG_X86_MCELOG_LEGACY=y
Expand Down Expand Up @@ -763,6 +764,7 @@ mee_configure() {
CONFIG_VIRTIO_INPUT=m
CONFIG_DELL_RBU=m
CONFIG_AMD_IOMMU=y
CONFIG_IRQ_REMAP=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=m
CONFIG_EXT3_FS_POSIX_ACL=y
Expand Down

0 comments on commit b8ad5e7

Please sign in to comment.