Skip to content

x86: Cleanup apic/ioapic/x2apic setup code

Thomas Gleixner lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest23 patches 33 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23x86/apic: Avoid open coded x2apic detectionarch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c+10 -133 replies
2/23x86/apic: Make x2apic_mode depend on CONFIG_X86_X2APICarch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c+5 -51 reply
3/23x86/apic: Move x2apic code to one placearch/x86/kernel/apic/apic.c+28 -301 reply
4/23x86/ioapic: Check x2apic reallyarch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c arch/x86/kernel/apic/io_apic.c+4 -42 replies
5/23x86/apic: Make disable x2apic work reallyarch/x86/kernel/apic/apic.c+5 -91 reply
6/23x86/apic: Check x2apic earlyarch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c+21 -181 reply
7/23x86/x2apic: Move code in conditional regionarch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c+35 -501 reply
8/23x86/x2apic: Clarify remapping mode for x2apic enablementarch/x86/kernel/apic/apic.c+4 -41 reply
9/23x86/x2apic: Add proper state trackingarch/x86/kernel/apic/apic.c+14 -11 reply
10/23x86/x2apic: Disable x2apic from nox2apic setuparch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c+24 -361 reply
11/23x86/x2apic: Split enable and setup functionarch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c arch/x86/kernel/cpu/common.c+36 -252 replies
12/23x86/x2apic: Use state information for disablearch/x86/kernel/apic/apic.c+10 -151 reply
13/23x86/smpboot: Move smpboot inlines to codearch/x86/include/asm/smpboot_hooks.h arch/x86/kernel/smpboot.c+66 -691 reply
14/23x86/ioapic: Provide stub functions for IOAPIC=narch/x86/include/asm/io_apic.h+5 -01 reply
15/23x86/ioapic: Add proper checks to setp/enable_IO_APIC()arch/x86/kernel/apic/io_apic.c+7 -41 reply
16/23x86/apic: Sanitize ioapic handlingarch/x86/kernel/apic/apic.c+3 -141 reply
17/23x86/smpboot: Cleanup ioapic handlingarch/x86/kernel/smpboot.c+7 -411 reply
18/23x86/apic: Move apic_init_uniprocessor codearch/x86/kernel/apic/apic.c+62 -631 reply
19/23init: Get rid of x86ismsarch/x86/kernel/apic/apic.c init/main.c+4 -130 replies
20/23x86/smpboot: Move apic init code to apic.carch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c arch/x86/kernel/smpboot.c+47 -371 reply
21/23x86/smpboot: Sanitize uniprocessor initarch/x86/kernel/smpboot.c+26 -111 reply
22/23x86/apic: Reuse apic_bsp_setup() for UP APIC setuparch/x86/include/asm/apic.h arch/x86/kernel/apic/apic.c arch/x86/kernel/smpboot.c+26 -341 reply
23/23x86: Consolidate boot cpu timer setuparch/x86/kernel/apic/apic.c arch/x86/kernel/smpboot.c+2 -61 reply

Reviews trailers per patch

13 of 23 patches have a Reviewed-by or Acked-by.

PatchBorislav Petkov
1/23
2/23A-b
3/23A-b
4/23
5/23
6/23
7/23
8/23A-b
9/23A-b
10/23
11/23
12/23A-b
13/23
14/23A-b
15/23A-b
16/23A-b
17/23Vehemently-Acked-by
18/23A-b
19/23
20/23A-b
21/23A-b
22/23A-b
23/23A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 00/23] x86: Cleanup apic/ioapic/x2apic setup code

While reviewing Jiangs interrupt remapping patch set, I had several serious WTF moments when trying to understand what that code is doing.

The main issues I've seen are:

- Blindly copy and pasted code

- Random places which initialize bits and pieces

- Code which got mindlessly expanded with duct tape and glue without considering readability and maintainability.

- Missing inline stubs which result in a ifdef nightmare

- Superflous inline stubs to artificially avoid sensible ifdefs

The deeper I looked the more I started to get grumpy about that maze and finally sat down and cleaned it up seriously. One bug I fixed on the way (surprise, surprise) got folded into Jiangs series which is now in tip/x86/apic. The other one is not that crucial and cant be fixed in the previous code without adding more mess.

The following patch series applies on top of tip/x86/apic. It cleans up and consolidates the apic/ioapic/x2apic setup functions.

Please give it a proper review and testing.

Thanks,

tglx

---
 arch/x86/include/asm/smpboot_hooks.h |   68 ------
 tip/arch/x86/include/asm/apic.h      |   57 +----
 tip/arch/x86/include/asm/io_apic.h   |    5 
 tip/arch/x86/kernel/apic/apic.c      |  395 ++++++++++++++++++-----------------
 tip/arch/x86/kernel/apic/io_apic.c   |   13 -
 tip/arch/x86/kernel/cpu/common.c     |    2 
 tip/arch/x86/kernel/smpboot.c        |  113 +++++-----
 tip/init/main.c                      |   14 -
 8 files changed, 308 insertions(+), 359 deletions(-)