[PATCH 01/43] x86_64: Restore the proper NR_IRQS define so larger systems work.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yinghai Lu
Date: Sunday, August 10, 2008 - 12:35 am

From: Eric W. Biederman <ebiederm@xmission.com>

As pointed out and tracked by Yinghai Lu <yhlu.kernel@gmail.com>:

Dhaval Giani got:
kernel BUG at arch/x86/kernel/io_apic_64.c:357!
invalid opcode: 0000 [1] SMP
CPU 24
...

his system (x3950) has 8 ioapic, irq > 256

This was caused by:
       commit 9b7dc567d03d74a1fbae84e88949b6a60d922d82
       Author: Thomas Gleixner <tglx@linutronix.de>
       Date:   Fri May 2 20:10:09 2008 +0200

          x86: unify interrupt vector defines

          The interrupt vector defines are copied 4 times around with minimal
          differences. Move them all into asm-x86/irq_vectors.h

It appears that Thomas did not notice that x86_64 does something
completely different when he merge irq_vectors.h

We can solve this for 2.6.27 by simply reintroducing the old heuristic
for setting NR_IRQS on x86_64 to a usable value, which trivially removes
the regression.

Long term it would be nice to harmonize the handling of ioapic interrupts
of x86_32 and x86_64 so we don't have this kind of confusion.

Dhaval Giani <dhaval@linux.vnet.ibm.com> tested an earlier version of
this patch by YH which confirms simply increasing NR_IRQS fixes the
problem.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
 include/asm-x86/irq_vectors.h |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/include/asm-x86/irq_vectors.h b/include/asm-x86/irq_vectors.h
index 646d59f..3f4b1b6 100644
--- a/include/asm-x86/irq_vectors.h
+++ b/include/asm-x86/irq_vectors.h
@@ -109,7 +109,15 @@
 #define LAST_VM86_IRQ		15
 #define invalid_vm86_irq(irq)	((irq) < 3 || (irq) > 15)
 
-#if !defined(CONFIG_X86_VOYAGER)
+#ifdef CONFIG_X86_64
+# if NR_CPUS < MAX_IO_APICS
+#  define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
+# else
+#  define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
+# endif
+# define NR_IRQ_VECTORS NR_IRQS
+
+#elif !defined(CONFIG_X86_VOYAGER)
 
 # if defined(CONFIG_X86_IO_APIC) || defined(CONFIG_PARAVIRT) || defined(CONFIG_X86_VISWS)
 
-- 
1.5.4.5

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/43] dyn_array/nr_irqs/sparse_irq support v7, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 01/43] x86_64: Restore the proper NR_IRQS define so ..., Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 02/43] 8250: Remove NR_IRQ usage, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 03/43] x86: add after_bootmem for 32bit, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 04/43] x86: remove irq_vectors_limits, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 05/43] add dyn_array support, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 06/43] add per_cpu_dyn_array support, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 07/43] x86: alloc dyn_array all alltogether, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 08/43] x86: enable dyn_array support, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 09/43] introduce nr_irqs, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 10/43] x86: using nr_irqs, Yinghai Lu, (Sun Aug 10, 12:35 am)
[PATCH 11/43] drivers/char to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 12/43] drivers/net to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 13/43] drivers intr remapping to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 14/43] drivers/pcmcia to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 15/43] drivers/rtc to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 16/43] drivers/scsi to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 17/43] drivers/serial to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 18/43] drivers proc to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 19/43] drivers xen events to use nr_irqs, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 20/43] make irq_timer_state to use dyn_array, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 21/43] make irq2_iommu to use dyn_array, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 22/43] make irq_desc to use dyn_array, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 24/43] x86: use dyn_array in io_apic_xx.c, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 25/43] x86: get mp_irqs from madt, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 26/43] x86: remove nr_irq_vectors, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 28/43] x86: add irq_cfg in io_apic_64.c, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 29/43] x86: put irq_2_pin pointer into irq_cfg, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 32/43] add irq_desc_without_new, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 34/43] replace loop with nr_irqs for proc/stat, Yinghai Lu, (Sun Aug 10, 12:36 am)
[PATCH 40/43] seperate irq_descX with irq_descX_free, Yinghai Lu, (Sun Aug 10, 12:36 am)