The patch titled genirq: x86_64 irq: Make the external irq handlers report their vector, not the irq number has been added to the -mm tree. Its filename is genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: genirq: x86_64 irq: Make the external irq handlers report their vector, not the irq number From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> This is a small pessimization but it paves the way for making this information per cpu. Which allows the the maximum number of IRQS to become NR_CPUS*224. Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Cc: Rajesh Shah <rajesh.shah@xxxxxxxxx> Cc: Andi Kleen <ak@xxxxxx> Cc: "Protasevich, Natalie" <Natalie.Protasevich@xxxxxxxxxx> Cc: "Luck, Tony" <tony.luck@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/x86_64/kernel/i8259.c | 62 +++++++++++++-------------------- arch/x86_64/kernel/io_apic.c | 4 -- arch/x86_64/kernel/irq.c | 7 ++- include/asm-x86_64/hw_irq.h | 1 4 files changed, 32 insertions(+), 42 deletions(-) diff -puN arch/x86_64/kernel/i8259.c~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number arch/x86_64/kernel/i8259.c --- a/arch/x86_64/kernel/i8259.c~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number +++ a/arch/x86_64/kernel/i8259.c @@ -44,19 +44,11 @@ BI(x,8) BI(x,9) BI(x,a) BI(x,b) \ BI(x,c) BI(x,d) BI(x,e) BI(x,f) -#define BUILD_15_IRQS(x) \ - BI(x,0) BI(x,1) BI(x,2) BI(x,3) \ - BI(x,4) BI(x,5) BI(x,6) BI(x,7) \ - BI(x,8) BI(x,9) BI(x,a) BI(x,b) \ - BI(x,c) BI(x,d) BI(x,e) - /* * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: * (these are usually mapped to vectors 0x20-0x2f) */ -BUILD_16_IRQS(0x0) -#ifdef CONFIG_X86_LOCAL_APIC /* * The IO-APIC gives us many more interrupt sources. Most of these * are unused but an SMP system is supposed to have enough memory ... @@ -67,19 +59,13 @@ BUILD_16_IRQS(0x0) * * (these are usually mapped into the 0x30-0xff vector range) */ - BUILD_16_IRQS(0x1) BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3) + BUILD_16_IRQS(0x2) BUILD_16_IRQS(0x3) BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7) BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb) -BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) - -#ifdef CONFIG_PCI_MSI - BUILD_15_IRQS(0xe) -#endif +BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) BUILD_16_IRQS(0xe) BUILD_16_IRQS(0xf) -#endif #undef BUILD_16_IRQS -#undef BUILD_15_IRQS #undef BI @@ -92,31 +78,15 @@ BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd) IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \ IRQ(x,c), IRQ(x,d), IRQ(x,e), IRQ(x,f) -#define IRQLIST_15(x) \ - IRQ(x,0), IRQ(x,1), IRQ(x,2), IRQ(x,3), \ - IRQ(x,4), IRQ(x,5), IRQ(x,6), IRQ(x,7), \ - IRQ(x,8), IRQ(x,9), IRQ(x,a), IRQ(x,b), \ - IRQ(x,c), IRQ(x,d), IRQ(x,e) - void (*interrupt[NR_IRQS])(void) = { - IRQLIST_16(0x0), - -#ifdef CONFIG_X86_IO_APIC - IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3), + IRQLIST_16(0x2), IRQLIST_16(0x3), IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7), IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb), - IRQLIST_16(0xc), IRQLIST_16(0xd) - -#ifdef CONFIG_PCI_MSI - , IRQLIST_15(0xe) -#endif - -#endif + IRQLIST_16(0xc), IRQLIST_16(0xd), IRQLIST_16(0xe), IRQLIST_16(0xf) }; #undef IRQ #undef IRQLIST_16 -#undef IRQLIST_14 /* * This is the 'legacy' 8259A Programmable Interrupt Controller, @@ -424,6 +394,26 @@ device_initcall(i8259A_init_sysfs); */ static struct irqaction irq2 = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL}; +int vector_irq[NR_VECTORS] __read_mostly = { + [0 ... FIRST_EXTERNAL_VECTOR - 1] = -1, + [FIRST_EXTERNAL_VECTOR + 0] = 0, + [FIRST_EXTERNAL_VECTOR + 1] = 1, + [FIRST_EXTERNAL_VECTOR + 2] = 2, + [FIRST_EXTERNAL_VECTOR + 3] = 3, + [FIRST_EXTERNAL_VECTOR + 4] = 4, + [FIRST_EXTERNAL_VECTOR + 5] = 5, + [FIRST_EXTERNAL_VECTOR + 6] = 6, + [FIRST_EXTERNAL_VECTOR + 7] = 7, + [FIRST_EXTERNAL_VECTOR + 8] = 8, + [FIRST_EXTERNAL_VECTOR + 9] = 9, + [FIRST_EXTERNAL_VECTOR + 10] = 10, + [FIRST_EXTERNAL_VECTOR + 11] = 11, + [FIRST_EXTERNAL_VECTOR + 12] = 12, + [FIRST_EXTERNAL_VECTOR + 13] = 13, + [FIRST_EXTERNAL_VECTOR + 14] = 14, + [FIRST_EXTERNAL_VECTOR + 15] = 15, + [FIRST_EXTERNAL_VECTOR + 16 ... NR_VECTORS - 1] = -1 +}; void __init init_ISA_irqs (void) { @@ -523,8 +513,6 @@ void __init init_IRQ(void) */ for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) { int vector = FIRST_EXTERNAL_VECTOR + i; - if (i >= NR_IRQS) - break; if (vector != IA32_SYSCALL_VECTOR) set_intr_gate(vector, interrupt[i]); } @@ -534,7 +522,7 @@ void __init init_IRQ(void) * IRQ0 must be given a fixed assignment and initialized, * because it's used before the IO-APIC is set up. */ - set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]); + vector_irq[FIRST_DEVICE_VECTOR] = 0; /* * The reschedule interrupt is a CPU-to-CPU reschedule-helper diff -puN arch/x86_64/kernel/io_apic.c~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number arch/x86_64/kernel/io_apic.c --- a/arch/x86_64/kernel/io_apic.c~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number +++ a/arch/x86_64/kernel/io_apic.c @@ -850,6 +850,7 @@ next: } vector = current_vector; + vector_irq[vector] = irq; IO_APIC_VECTOR(irq) = vector; return vector; @@ -884,7 +885,6 @@ static void ioapic_register_intr(int irq else set_irq_chip_and_handler(irq, &ioapic_chip, handle_edge_irq); - set_intr_gate(vector, interrupt[irq]); } static void __init setup_IO_APIC_irqs(void) @@ -1727,7 +1727,6 @@ static inline void check_timer(void) */ disable_8259A_irq(0); vector = assign_irq_vector(0); - set_intr_gate(vector, interrupt[0]); /* * Subtle, code in do_timer_interrupt() expects an AEOI @@ -1988,7 +1987,6 @@ int create_irq(void) spin_unlock_irqrestore(&vector_lock, flags); if (irq >= 0) { - set_intr_gate(vector, interrupt[irq]); dynamic_irq_init(irq); } return irq; diff -puN arch/x86_64/kernel/irq.c~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number arch/x86_64/kernel/irq.c --- a/arch/x86_64/kernel/irq.c~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number +++ a/arch/x86_64/kernel/irq.c @@ -93,12 +93,15 @@ skip: asmlinkage unsigned int do_IRQ(struct pt_regs *regs) { /* high bit used in ret_from_ code */ - unsigned irq = ~regs->orig_rax; + unsigned vector = ~regs->orig_rax; + unsigned irq; exit_idle(); irq_enter(); - generic_handle_irq(irq, regs); + irq = vector_irq[vector]; + if (likely(irq < NR_IRQS)) + generic_handle_irq(irq, regs); irq_exit(); diff -puN include/asm-x86_64/hw_irq.h~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number include/asm-x86_64/hw_irq.h --- a/include/asm-x86_64/hw_irq.h~genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number +++ a/include/asm-x86_64/hw_irq.h @@ -74,6 +74,7 @@ #ifndef __ASSEMBLY__ extern u8 irq_vector[NR_IRQ_VECTORS]; +extern int vector_irq[NR_VECTORS]; #define IO_APIC_VECTOR(irq) (irq_vector[irq]) /* _ Patches currently in -mm which might be from ebiederm@xxxxxxxxxxxx are add-a-sysfs-file-to-determine-if-a-kexec-kernel-is-loaded.patch avoid-tasklist_lock-at-getrusage-for-multithreaded-case-too.patch ptrace-document-the-locking-rules.patch proc-fix-the-inode-number-on-proc-pid-fd.patch proc-remove-useless-bkl-in-proc_pid_readlink.patch proc-remove-unnecessary-and-misleading-assignments.patch proc-simplify-the-ownership-rules-for-proc.patch proc-replace-proc_inodetype-with-proc_inodefd.patch proc-remove-bogus-proc_task_permission.patch proc-kill-proc_mem_inode_operations.patch proc-properly-filter-out-files-that-are-not-visible.patch proc-fix-the-link-count-for-proc-pid-task.patch proc-move-proc_maps_operations-into-task_mmuc.patch proc-rewrite-the-proc-dentry-flush-on-exit.patch proc-close-the-race-of-a-process-dying-durning.patch proc-refactor-reading-directories-of-tasks.patch proc-remove-tasklist_lock-from-proc_pid_readdir.patch proc-remove-tasklist_lock-from-proc_pid_lookup-and.patch proc-remove-tasklist_lock-from-proc_pid_readdir-simply-fix-first_tgid.patch proc-make-proc_numbuf-the-buffer-size-for-holding-a.patch proc-dont-lock-task_structs-indefinitely.patch proc-dont-lock-task_structs-indefinitely-task_mmu-small-fixes.patch proc-use-struct-pid-not-struct-task_ref.patch proc-optimize-proc_check_dentry_visible.patch proc-use-sane-permission-checks-on-the-proc-pid-fd.patch proc-cleanup-proc_fd_access_allowed.patch proc-remove-tasklist_lock-from-proc_task_readdir.patch simplify-fix-first_tid.patch cleanup-next_tid.patch de_thread-fix-lockless-do_each_thread.patch coredump-optimize-mm-users-traversal.patch coredump-speedup-sigkill-sending.patch coredump-kill-ptrace-related-stuff.patch coredump-kill-ptrace-related-stuff-fix.patch coredump-dont-take-tasklist_lock.patch proc-sysctl-add-_proc_do_string-helper.patch namespaces-add-nsproxy.patch namespaces-add-nsproxy-dont-include-compileh.patch namespaces-incorporate-fs-namespace-into-nsproxy.patch namespaces-utsname-introduce-temporary-helpers.patch namespaces-utsname-switch-to-using-uts-namespaces.patch namespaces-utsname-switch-to-using-uts-namespaces-alpha-fix.patch namespaces-utsname-switch-to-using-uts-namespaces-cleanup.patch namespaces-utsname-use-init_utsname-when-appropriate.patch namespaces-utsname-use-init_utsname-when-appropriate-cifs-update.patch namespaces-utsname-implement-utsname-namespaces.patch namespaces-utsname-implement-utsname-namespaces-export.patch namespaces-utsname-implement-utsname-namespaces-dont-include-compileh.patch namespaces-utsname-sysctl-hack.patch namespaces-utsname-sysctl-hack-cleanup.patch namespaces-utsname-sysctl-hack-cleanup-2.patch namespaces-utsname-sysctl-hack-cleanup-2-fix.patch namespaces-utsname-remove-system_utsname.patch namespaces-utsname-implement-clone_newuts-flag.patch uts-copy-nsproxy-only-when-needed.patch ipc-namespace-core-fix.patch ipc-namespace-core-unshare-fix.patch ipc-namespace-utils-compilation-fix.patch genirq-irq-convert-the-move_irq-flag-from-a-32bit-word-to-a-single-bit.patch genirq-irq-add-moved_masked_irq.patch genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch genirq-msi-simplify-msi-enable-and-disable.patch genirq-msi-simplify-msi-enable-and-disable-fix.patch genirq-msi-make-the-msi-boolean-tests-return-either-0-or-1.patch genirq-msi-implement-helper-functions-read_msi_msg-and-write_msi_msg.patch genirq-msi-refactor-the-msi_ops.patch genirq-msi-simplify-the-msi-irq-limit-policy.patch genirq-irq-add-a-dynamic-irq-creation-api.patch genirq-ia64-irq-dynamic-irq-support.patch genirq-i386-irq-dynamic-irq-support.patch genirq-i386-irq-dynamic-irq-support-fix.patch genirq-x86_64-irq-dynamic-irq-support.patch genirq-msi-make-the-msi-code-irq-based-and-not-vector-based.patch genirq-x86_64-irq-move-msi-message-composition-into-io_apicc.patch genirq-i386-irq-move-msi-message-composition-into-io_apicc.patch genirq-msi-only-build-msi-apicc-on-ia64.patch genirq-x86_64-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector-fix.patch genirq-irq-remove-msi-hacks.patch genirq-irq-generalize-the-check-for-hardirq_bits.patch genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number.patch genirq-x86_64-irq-make-vector_irq-per-cpu.patch genirq-x86_64-irq-kill-gsi_irq_sharing.patch genirq-x86_64-irq-kill-irq-compression.patch genirq-irq-document-what-an-irq-is.patch pidhash-temporary-debug-checks.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector-fix-tidies.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html