[patch V2 00/44] x86: Cleanup IDT code

Thomas Gleixner
2017-08-25T21:57:25Z

The IDT code in x86 is a convoluted mess and contains quite some
bogosities.

One of the main offenders is the extra tracing IDT which has been
introduced to reduce the impact of tracing on the exception vectors when
tracepoints are disabled.

This results in an unholy macro mess which magically creates IDT entries by
prepending the exception handler name by trace_.

For most exceptions the tracepoint overhead in the disabled case is two
NOP5, which are negligible compared to the heavy work of the exception
handler itself. Modern CPUs are pretty good in optimizing NOPs.

The only two handlers where the overhead matters are the pagefault handler
and the reschedule IPI, where an active tracepoint introduces more extra
work. These two can be handled with separate static keys which reduces the
impact to a minimum.

As a result the whole tracing IDT machinery can be removed.

The second part of the series cleans up the handling of IDT/GDT/LDT/TSS
descriptors to get rid of macro based initialization via the obscure raw
32bit union fields a and b.

The last part moves the setup of the IDT into a separate file, where all
gate related code is moved to. The gate setup is converted to a table based
mechanism so the resulting code is smaller and better understandable.

The series applies on top of

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/apic

and is available as a git branch from

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/apic

There is more cleanup to come in the near future, which aims at replacing
the braindamaged vector assignment mechanics, which has quite some
shortcomings.

Changes since V1:

- Reordered patch series to maintain bisectability

- Addressed the review comments

- Addressed the fallout reported by kbuild robot

- Picked up acks and reviewed by tags

Thanks,

tglx
---
arch/x86/boot/compressed/eboot.c | 8
arch/x86/entry/entry_32.S | 20 -
arch/x86/entry/entry_64.S | 26 --
arch/x86/entry/vdso/vma.c | 2
arch/x86/include/asm/desc.h | 248 +++------------------
arch/x86/include/asm/desc_defs.h | 122 +++++-----
arch/x86/include/asm/entry_arch.h | 17 -
arch/x86/include/asm/hw_irq.h | 20 -
arch/x86/include/asm/irq.h | 4
arch/x86/include/asm/irq_work.h | 8
arch/x86/include/asm/segment.h | 4
arch/x86/include/asm/trace/common.h | 16 +
arch/x86/include/asm/trace/exceptions.h | 8
arch/x86/include/asm/trace/irq_vectors.h | 51 +++-
arch/x86/include/asm/traps.h | 10
arch/x86/include/asm/xen/hypercall.h | 6
arch/x86/kernel/Makefile | 3
arch/x86/kernel/apic/apic.c | 70 +----
arch/x86/kernel/apic/vector.c | 2
arch/x86/kernel/cpu/common.c | 9
arch/x86/kernel/cpu/mcheck/mce_amd.c | 16 -
arch/x86/kernel/cpu/mcheck/therm_throt.c | 20 -
arch/x86/kernel/cpu/mcheck/threshold.c | 16 -
arch/x86/kernel/cpu/mshyperv.c | 9
arch/x86/kernel/eisa.c | 18 +
arch/x86/kernel/head32.c | 4
arch/x86/kernel/head64.c | 6
arch/x86/kernel/head_32.S | 42 ---
arch/x86/kernel/idt.c | 365 +++++++++++++++++++++++++++++++
arch/x86/kernel/irq.c | 40 +--
arch/x86/kernel/irq_work.c | 20 -
arch/x86/kernel/irqinit.c | 102 --------
arch/x86/kernel/kvm.c | 4
arch/x86/kernel/machine_kexec_32.c | 14 -
arch/x86/kernel/reboot.c | 4
arch/x86/kernel/setup.c | 4
arch/x86/kernel/setup_percpu.c | 9
arch/x86/kernel/smp.c | 81 +-----
arch/x86/kernel/tls.c | 2
arch/x86/kernel/tracepoint.c | 57 +---
arch/x86/kernel/traps.c | 108 ---------
arch/x86/kvm/vmx.c | 2
arch/x86/math-emu/fpu_entry.c | 11
arch/x86/math-emu/fpu_system.h | 48 +++-
arch/x86/math-emu/get_address.c | 17 -
arch/x86/mm/fault.c | 49 +---
arch/x86/xen/enlighten_pv.c | 14 -
drivers/xen/events/events_base.c | 6
48 files changed, 759 insertions(+), 983 deletions(-)