From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932974AbdHYV5Z (ORCPT ); Fri, 25 Aug 2017 17:57:25 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:42817 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932398AbdHYV5Y (ORCPT ); Fri, 25 Aug 2017 17:57:24 -0400 Message-Id: <20170825214648.264521964@linutronix.de> User-Agent: quilt/0.63-1 Date: Fri, 25 Aug 2017 23:46:48 +0200 From: Thomas Gleixner To: LKML Cc: Ingo Molnar , Peter Anvin , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Steven Rostedt Subject: [patch V2 00/44] x86: Cleanup IDT code Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-)