* [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
@ 2008-04-15 20:36 Alan Mayer
2008-04-16 13:19 ` Ingo Molnar
2008-04-16 20:17 ` Alan Mayer
0 siblings, 2 replies; 12+ messages in thread
From: Alan Mayer @ 2008-04-15 20:36 UTC (permalink / raw)
To: mingo, torvalds; +Cc: linux-kernel list
Subject: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
From: Alan Mayer <ajm@sgi.com>
The SGI UV system needs several more system vectors than a vanilla
x86_64 system. Rather than burden the other archs with extra system
vectors that they don't use, change FIRST_SYSTEM_VECTOR to a variable,
so that it can be dynamic.
Signed-off-by: Alan Mayer <ajm@sgi.com>
---
Index: ingo/arch/x86/kernel/i8259_64.c
===================================================================
--- ingo.orig/arch/x86/kernel/i8259_64.c 2008-04-10 13:24:30.000000000 -0500
+++ ingo/arch/x86/kernel/i8259_64.c 2008-04-10 13:57:33.000000000 -0500
@@ -479,33 +479,33 @@
* The reschedule interrupt is a CPU-to-CPU reschedule-helper
* IPI, driven by wakeup.
*/
- set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
+ alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
/* IPIs for invalidation */
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
/* IPI for generic function call */
- set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
+ alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
/* Low priority IPI to cleanup after moving an irq */
set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
#endif
- set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
- set_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
+ alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
+ alloc_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
/* self generated IPI for local APIC timer */
- set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
+ alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
/* IPI vectors for APIC spurious and error interrupts */
- set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
- set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
+ alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
+ alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
if (!acpi_ioapic)
setup_irq(2, &irq2);
Index: ingo/arch/x86/kernel/io_apic_64.c
===================================================================
--- ingo.orig/arch/x86/kernel/io_apic_64.c 2008-04-10 13:24:30.000000000 -0500
+++ ingo/arch/x86/kernel/io_apic_64.c 2008-04-10 13:57:33.000000000 -0500
@@ -82,6 +82,10 @@
static int assign_irq_vector(int irq, cpumask_t mask);
+int first_system_vector = 0xfe;
+
+char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
+
#define __apicdebuginit __init
int sis_apic_bug; /* not actually supported, dummy for compile */
@@ -717,7 +721,7 @@
offset = current_offset;
next:
vector += 8;
- if (vector >= FIRST_SYSTEM_VECTOR) {
+ if (vector >= first_system_vector) {
/* If we run out of vectors on large boxen, must share them. */
offset = (offset + 1) % 8;
vector = FIRST_DEVICE_VECTOR + offset;
Index: ingo/include/asm-x86/hw_irq_64.h
===================================================================
--- ingo.orig/include/asm-x86/hw_irq_64.h 2008-04-10 13:24:30.000000000 -0500
+++ ingo/include/asm-x86/hw_irq_64.h 2008-04-10 13:57:33.000000000 -0500
@@ -91,7 +91,6 @@
* levels. (0x80 is the syscall vector)
*/
#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
-#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
#ifndef __ASSEMBLY__
@@ -115,6 +114,8 @@
void threshold_interrupt(void);
void i8254_timer_resume(void);
+extern int first_system_vector;
+
typedef int vector_irq_t[NR_VECTORS];
DECLARE_PER_CPU(vector_irq_t, vector_irq);
extern void __setup_vector_irq(int cpu);
Index: ingo/include/asm-x86/irq_64.h
===================================================================
--- ingo.orig/include/asm-x86/irq_64.h 2008-04-10 13:24:30.000000000 -0500
+++ ingo/include/asm-x86/irq_64.h 2008-04-10 13:57:33.000000000 -0500
@@ -31,7 +31,7 @@
*/
#define NR_VECTORS 256
-#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in hw_irq.h */
+extern int first_system_vector;
#if NR_CPUS < MAX_IO_APICS
#define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
Index: ingo/arch/x86/kernel/io_apic_32.c
===================================================================
--- ingo.orig/arch/x86/kernel/io_apic_32.c 2008-04-10 13:24:30.000000000 -0500
+++ ingo/arch/x86/kernel/io_apic_32.c 2008-04-10 13:57:33.000000000 -0500
@@ -73,6 +73,10 @@
static int disable_timer_pin_1 __initdata;
+int first_system_vector = 0xfe;
+
+char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
+
/*
* Rough estimation of how many shared IRQs there are, can
* be changed anytime.
@@ -1166,7 +1170,7 @@
offset = current_offset;
next:
vector += 8;
- if (vector >= FIRST_SYSTEM_VECTOR) {
+ if (vector >= first_system_vector) {
offset = (offset + 1) % 8;
vector = FIRST_DEVICE_VECTOR + offset;
}
@@ -2263,7 +2267,7 @@
int i;
/* Reserve all the system vectors. */
- for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++)
+ for (i = first_system_vector; i < NR_VECTORS; i++)
set_bit(i, used_vectors);
enable_IO_APIC();
Index: ingo/include/asm-x86/mach-default/irq_vectors.h
===================================================================
--- ingo.orig/include/asm-x86/mach-default/irq_vectors.h 2008-04-10 13:24:30.000000000 -0500
+++ ingo/include/asm-x86/mach-default/irq_vectors.h 2008-04-10 13:57:33.000000000 -0500
@@ -63,7 +63,6 @@
* levels. (0x80 is the syscall vector)
*/
#define FIRST_DEVICE_VECTOR 0x31
-#define FIRST_SYSTEM_VECTOR 0xef
#define TIMER_IRQ 0
Index: ingo/include/asm-x86/mach-visws/irq_vectors.h
===================================================================
--- ingo.orig/include/asm-x86/mach-visws/irq_vectors.h 2008-04-10 13:24:30.000000000 -0500
+++ ingo/include/asm-x86/mach-visws/irq_vectors.h 2008-04-10 13:57:33.000000000 -0500
@@ -42,7 +42,6 @@
* levels. (0x80 is the syscall vector)
*/
#define FIRST_DEVICE_VECTOR 0x31
-#define FIRST_SYSTEM_VECTOR 0xef
#define TIMER_IRQ 0
Index: ingo/arch/x86/kernel/apic_32.c
===================================================================
--- ingo.orig/arch/x86/kernel/apic_32.c 2008-04-10 13:24:30.000000000 -0500
+++ ingo/arch/x86/kernel/apic_32.c 2008-04-10 13:57:33.000000000 -0500
@@ -1353,13 +1353,13 @@
* The reschedule interrupt is a CPU-to-CPU reschedule-helper
* IPI, driven by wakeup.
*/
- set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
+ alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
/* IPI for invalidation */
- set_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt);
+ alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt);
/* IPI for generic function call */
- set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
+ alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
}
#endif
@@ -1372,15 +1372,15 @@
smp_intr_init();
#endif
/* self generated IPI for local APIC timer */
- set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
+ alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
/* IPI vectors for APIC spurious and error interrupts */
- set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
- set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
+ alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
+ alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
/* thermal monitor LVT interrupt */
#ifdef CONFIG_X86_MCE_P4THERMAL
- set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
+ alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
#endif
}
Index: ingo/include/asm-x86/desc.h
===================================================================
--- ingo.orig/include/asm-x86/desc.h 2008-04-10 13:48:58.000000000 -0500
+++ ingo/include/asm-x86/desc.h 2008-04-10 14:01:48.000000000 -0500
@@ -311,6 +311,28 @@
_set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS);
}
+#define SYS_VECTOR_FREE 0
+#define SYS_VECTOR_ALLOCED 1
+
+extern int first_system_vector;
+extern char system_vectors[];
+
+static inline void alloc_system_vector(int vector)
+{
+ if (system_vectors[vector] == SYS_VECTOR_FREE) {
+ system_vectors[vector] = SYS_VECTOR_ALLOCED;
+ if (first_system_vector > vector)
+ first_system_vector = vector;
+ } else
+ BUG();
+}
+
+static inline void alloc_intr_gate(unsigned int n, void *addr)
+{
+ alloc_system_vector(n);
+ set_intr_gate(n, addr);
+}
+
/*
* This routine sets up an interrupt gate at directory privilege level 3.
*/
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-15 20:36 [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable Alan Mayer
@ 2008-04-16 13:19 ` Ingo Molnar
2008-04-16 20:17 ` Alan Mayer
1 sibling, 0 replies; 12+ messages in thread
From: Ingo Molnar @ 2008-04-16 13:19 UTC (permalink / raw)
To: Alan Mayer; +Cc: torvalds, linux-kernel list
* Alan Mayer <ajm@sgi.com> wrote:
> The SGI UV system needs several more system vectors than a vanilla
> x86_64 system. Rather than burden the other archs with extra system
> vectors that they don't use, change FIRST_SYSTEM_VECTOR to a variable,
> so that it can be dynamic.
thanks Alan, this looks really clean - i applied it to x86.git for more
testing.
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-15 20:36 [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable Alan Mayer
2008-04-16 13:19 ` Ingo Molnar
@ 2008-04-16 20:17 ` Alan Mayer
2008-04-21 15:46 ` Ingo Molnar
1 sibling, 1 reply; 12+ messages in thread
From: Alan Mayer @ 2008-04-16 20:17 UTC (permalink / raw)
To: Alan Mayer; +Cc: mingo, torvalds, linux-kernel list
Subject: [PATCH] x86_64: Fix build error from FIRST_SYSTEM_VECTOR patch
From: Alan Mayer <ajm@sgi.com>
Fixes the build error introduced by my FIRST_SYSTEM_VECTOR patch
Signed-off-by: Alan Mayer <ajm@sgi.com>
---
Index: ingo/arch/x86/kernel/apic_32.c
===================================================================
--- ingo.orig/arch/x86/kernel/apic_32.c 2008-04-10 14:02:10.000000000 -0500
+++ ingo/arch/x86/kernel/apic_32.c 2008-04-16 14:28:34.000000000 -0500
@@ -74,6 +74,10 @@
int local_apic_timer_c2_ok;
EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
+int first_system_vector = 0xfe;
+
+char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
+
/*
* Debug level, exported for io_apic.c
*/
Index: ingo/arch/x86/kernel/io_apic_32.c
===================================================================
--- ingo.orig/arch/x86/kernel/io_apic_32.c 2008-04-10 14:02:10.000000000 -0500
+++ ingo/arch/x86/kernel/io_apic_32.c 2008-04-16 14:29:07.000000000 -0500
@@ -73,9 +73,9 @@
static int disable_timer_pin_1 __initdata;
-int first_system_vector = 0xfe;
+extern int first_system_vector;
-char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
+extern char system_vectors[];
/*
* Rough estimation of how many shared IRQs there are, can
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-16 20:17 ` Alan Mayer
@ 2008-04-21 15:46 ` Ingo Molnar
0 siblings, 0 replies; 12+ messages in thread
From: Ingo Molnar @ 2008-04-21 15:46 UTC (permalink / raw)
To: Alan Mayer; +Cc: torvalds, linux-kernel list
* Alan Mayer <ajm@sgi.com> wrote:
> Subject: [PATCH] x86_64: Fix build error from FIRST_SYSTEM_VECTOR
> patch
>
> From: Alan Mayer <ajm@sgi.com>
>
> Fixes the build error introduced by my FIRST_SYSTEM_VECTOR patch
thanks, applied.
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-09 22:08 ` Linus Torvalds
@ 2008-04-10 15:22 ` Alan Mayer
0 siblings, 0 replies; 12+ messages in thread
From: Alan Mayer @ 2008-04-10 15:22 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Alan Mayer, mingo, linux-kernel list
On Wed, 9 Apr 2008, Linus Torvalds wrote:
>
>
> On Wed, 9 Apr 2008, Alan Mayer wrote:
> >
> > - set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
> > + set_intr_gate(alloc_system_vector(RESCHEDULE_VECTOR), reschedule_interrupt);
>
> Can we please just merge that syntax and make a single function like
>
> alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
>
> instead?
>
> Linus
Yes, I think I can do that.
--ajm
You'll have to have them
all pulled out,
after the Savoy truffle.
--
Alan J. Mayer
SGI
ajm@sgi.com
WORK: 651-683-3131
HOME: 651-407-0134
--
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-09 21:33 Alan Mayer
@ 2008-04-09 22:08 ` Linus Torvalds
2008-04-10 15:22 ` Alan Mayer
0 siblings, 1 reply; 12+ messages in thread
From: Linus Torvalds @ 2008-04-09 22:08 UTC (permalink / raw)
To: Alan Mayer; +Cc: mingo, linux-kernel list
On Wed, 9 Apr 2008, Alan Mayer wrote:
>
> - set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
> + set_intr_gate(alloc_system_vector(RESCHEDULE_VECTOR), reschedule_interrupt);
Can we please just merge that syntax and make a single function like
alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
instead?
Linus
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
@ 2008-04-09 21:33 Alan Mayer
2008-04-09 22:08 ` Linus Torvalds
0 siblings, 1 reply; 12+ messages in thread
From: Alan Mayer @ 2008-04-09 21:33 UTC (permalink / raw)
To: mingo, torvalds; +Cc: linux-kernel list
Subject: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
From: Alan Mayer <ajm@sgi.com>
The SGI UV system needs several more system vectors than a vanilla
x86_64 system. Rather than burden the other archs with extra system
vectors that they don't use, change FIRST_SYSTEM_VECTOR to a variable,
so that it can be dynamic.
Signed-off-by: Alan Mayer <ajm@sgi.com>
---
Index: ingo/arch/x86/kernel/i8259_64.c
===================================================================
--- ingo.orig/arch/x86/kernel/i8259_64.c 2008-04-04 14:57:05.000000000 -0500
+++ ingo/arch/x86/kernel/i8259_64.c 2008-04-09 16:01:31.000000000 -0500
@@ -22,6 +22,7 @@
#include <asm/desc.h>
#include <asm/apic.h>
#include <asm/i8259.h>
+#include <asm/genapic.h>
/*
* Common place to define all x86 IRQ vectors
@@ -456,6 +457,22 @@
}
}
+#define SYS_VECTOR_FREE 0
+#define SYS_VECTOR_ALLOCED 1
+
+static char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
+
+static int alloc_system_vector(int vector)
+{
+ if (system_vectors[vector] == SYS_VECTOR_FREE) {
+ system_vectors[vector] = SYS_VECTOR_ALLOCED;
+ if (vector < first_system_vector)
+ first_system_vector = vector;
+ return vector;
+ } else
+ BUG();
+}
+
void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
void __init native_init_IRQ(void)
@@ -479,33 +496,33 @@
* The reschedule interrupt is a CPU-to-CPU reschedule-helper
* IPI, driven by wakeup.
*/
- set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
+ set_intr_gate(alloc_system_vector(RESCHEDULE_VECTOR), reschedule_interrupt);
/* IPIs for invalidation */
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+0), invalidate_interrupt0);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+1), invalidate_interrupt1);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+2), invalidate_interrupt2);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+3), invalidate_interrupt3);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+4), invalidate_interrupt4);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+5), invalidate_interrupt5);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+6), invalidate_interrupt6);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+7), invalidate_interrupt7);
/* IPI for generic function call */
- set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
+ set_intr_gate(alloc_system_vector(CALL_FUNCTION_VECTOR), call_function_interrupt);
/* Low priority IPI to cleanup after moving an irq */
set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
#endif
- set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
- set_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
+ set_intr_gate(alloc_system_vector(THERMAL_APIC_VECTOR), thermal_interrupt);
+ set_intr_gate(alloc_system_vector(THRESHOLD_APIC_VECTOR), threshold_interrupt);
/* self generated IPI for local APIC timer */
- set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
+ set_intr_gate(alloc_system_vector(LOCAL_TIMER_VECTOR), apic_timer_interrupt);
/* IPI vectors for APIC spurious and error interrupts */
- set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
- set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
+ set_intr_gate(alloc_system_vector(SPURIOUS_APIC_VECTOR), spurious_interrupt);
+ set_intr_gate(alloc_system_vector(ERROR_APIC_VECTOR), error_interrupt);
if (!acpi_ioapic)
setup_irq(2, &irq2);
Index: ingo/arch/x86/kernel/io_apic_64.c
===================================================================
--- ingo.orig/arch/x86/kernel/io_apic_64.c 2008-04-04 14:57:05.000000000 -0500
+++ ingo/arch/x86/kernel/io_apic_64.c 2008-04-04 15:57:37.000000000 -0500
@@ -82,6 +82,8 @@
static int assign_irq_vector(int irq, cpumask_t mask);
+int first_system_vector = 0xfe;
+
#define __apicdebuginit __init
int sis_apic_bug; /* not actually supported, dummy for compile */
@@ -717,7 +719,7 @@
offset = current_offset;
next:
vector += 8;
- if (vector >= FIRST_SYSTEM_VECTOR) {
+ if (vector >= first_system_vector) {
/* If we run out of vectors on large boxen, must share them. */
offset = (offset + 1) % 8;
vector = FIRST_DEVICE_VECTOR + offset;
Index: ingo/include/asm-x86/hw_irq_64.h
===================================================================
--- ingo.orig/include/asm-x86/hw_irq_64.h 2008-04-04 14:59:42.000000000 -0500
+++ ingo/include/asm-x86/hw_irq_64.h 2008-04-09 16:01:31.000000000 -0500
@@ -91,7 +91,6 @@
* levels. (0x80 is the syscall vector)
*/
#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
-#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
#ifndef __ASSEMBLY__
@@ -115,6 +114,8 @@
void threshold_interrupt(void);
void i8254_timer_resume(void);
+extern int first_system_vector;
+
typedef int vector_irq_t[NR_VECTORS];
DECLARE_PER_CPU(vector_irq_t, vector_irq);
extern void __setup_vector_irq(int cpu);
Index: ingo/include/asm-x86/irq_64.h
===================================================================
--- ingo.orig/include/asm-x86/irq_64.h 2008-04-04 14:59:42.000000000 -0500
+++ ingo/include/asm-x86/irq_64.h 2008-04-04 15:58:52.000000000 -0500
@@ -31,7 +31,7 @@
*/
#define NR_VECTORS 256
-#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in hw_irq.h */
+extern int first_system_vector;
#if NR_CPUS < MAX_IO_APICS
#define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
Index: ingo/arch/x86/kernel/io_apic_32.c
===================================================================
--- ingo.orig/arch/x86/kernel/io_apic_32.c 2008-04-04 14:57:05.000000000 -0500
+++ ingo/arch/x86/kernel/io_apic_32.c 2008-04-09 10:23:34.000000000 -0500
@@ -73,6 +73,8 @@
static int disable_timer_pin_1 __initdata;
+int first_system_vector = 0xfe;
+
/*
* Rough estimation of how many shared IRQs there are, can
* be changed anytime.
@@ -1166,7 +1168,7 @@
offset = current_offset;
next:
vector += 8;
- if (vector >= FIRST_SYSTEM_VECTOR) {
+ if (vector >= first_system_vector) {
offset = (offset + 1) % 8;
vector = FIRST_DEVICE_VECTOR + offset;
}
@@ -2263,7 +2265,7 @@
int i;
/* Reserve all the system vectors. */
- for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++)
+ for (i = first_system_vector; i < NR_VECTORS; i++)
set_bit(i, used_vectors);
enable_IO_APIC();
Index: ingo/include/asm-x86/mach-default/irq_vectors.h
===================================================================
--- ingo.orig/include/asm-x86/mach-default/irq_vectors.h 2008-04-04 14:59:42.000000000 -0500
+++ ingo/include/asm-x86/mach-default/irq_vectors.h 2008-04-09 14:01:49.000000000 -0500
@@ -63,7 +63,6 @@
* levels. (0x80 is the syscall vector)
*/
#define FIRST_DEVICE_VECTOR 0x31
-#define FIRST_SYSTEM_VECTOR 0xef
#define TIMER_IRQ 0
Index: ingo/include/asm-x86/mach-visws/irq_vectors.h
===================================================================
--- ingo.orig/include/asm-x86/mach-visws/irq_vectors.h 2008-04-04 14:59:43.000000000 -0500
+++ ingo/include/asm-x86/mach-visws/irq_vectors.h 2008-04-09 14:01:37.000000000 -0500
@@ -42,7 +42,6 @@
* levels. (0x80 is the syscall vector)
*/
#define FIRST_DEVICE_VECTOR 0x31
-#define FIRST_SYSTEM_VECTOR 0xef
#define TIMER_IRQ 0
Index: ingo/arch/x86/kernel/apic_32.c
===================================================================
--- ingo.orig/arch/x86/kernel/apic_32.c 2008-04-04 14:57:04.000000000 -0500
+++ ingo/arch/x86/kernel/apic_32.c 2008-04-09 16:10:55.000000000 -0500
@@ -1363,6 +1363,19 @@
}
#endif
+static char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
+
+static int alloc_system_vector(int vector)
+{
+ if (system_vectors[vector] == SYS_VECTOR_FREE) {
+ system_vectors[vector] = SYS_VECTOR_ALLOCED;
+ if (vector < first_system_vector)
+ first_system_vector = vector;
+ return vector;
+ } else
+ BUG();
+}
+
/*
* Initialize APIC interrupts
*/
@@ -1372,15 +1385,15 @@
smp_intr_init();
#endif
/* self generated IPI for local APIC timer */
- set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
+ set_intr_gate(alloc_system_vector(LOCAL_TIMER_VECTOR), apic_timer_interrupt);
/* IPI vectors for APIC spurious and error interrupts */
- set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
- set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
+ set_intr_gate(alloc_system_vector(SPURIOUS_APIC_VECTOR), spurious_interrupt);
+ set_intr_gate(alloc_system_vector(ERROR_APIC_VECTOR), error_interrupt);
/* thermal monitor LVT interrupt */
#ifdef CONFIG_X86_MCE_P4THERMAL
- set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
+ set_intr_gate(alloc_system_vector(THERMAL_APIC_VECTOR), thermal_interrupt);
#endif
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-09 20:28 ` Yinghai Lu
@ 2008-04-09 20:31 ` Alan Mayer
0 siblings, 0 replies; 12+ messages in thread
From: Alan Mayer @ 2008-04-09 20:31 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Eric W. Biederman, Alan Mayer, torvalds, linux-kernel list
>
> for x86_64, current from 0x20 to 0x2f, we only use one for irq migration.
>
> wonder if you can use 2 from them for UV...
>
> YH
>
When all is said and done, we're going to need at least six more. Some
of them have to be high priority interrupts. So I don't think that
would help.
--ajm
Don't forget what you are.
You're a rock and roll star.
--
Alan J. Mayer
SGI
ajm@sgi.com
WORK: 651-683-3131
HOME: 651-407-0134
--
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-09 14:59 ` Ingo Molnar
2008-04-09 15:06 ` Alan Mayer
@ 2008-04-09 20:28 ` Yinghai Lu
2008-04-09 20:31 ` Alan Mayer
1 sibling, 1 reply; 12+ messages in thread
From: Yinghai Lu @ 2008-04-09 20:28 UTC (permalink / raw)
To: Ingo Molnar, Eric W. Biederman; +Cc: Alan Mayer, torvalds, linux-kernel list
On Wed, Apr 9, 2008 at 7:59 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Alan Mayer <ajm@sgi.com> wrote:
>
> > Subject: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
> >
> > From: Alan Mayer <ajm@sgi.com>
> >
> > The SGI UV system needs several more system vectors than a vanilla
> > x86_64 system. Rather than burden the other archs with extra system
> > vectors that they don't use, change FIRST_SYSTEM_VECTOR to a variable,
> > so that it can be dynamic.
>
> nice - but please split this up into two patches: first one that changes
> the generic code to use a variable limit - this patch will (should) be a
> functional NOP.
>
> then a second patch adds those two new UV vectors.
>
> Also, could you please also change the 32-bit side as well so that we at
> least keep the two implementations roughly in sync?
>
for x86_64, current from 0x20 to 0x2f, we only use one for irq migration.
wonder if you can use 2 from them for UV...
YH
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-09 14:59 ` Ingo Molnar
@ 2008-04-09 15:06 ` Alan Mayer
2008-04-09 20:28 ` Yinghai Lu
1 sibling, 0 replies; 12+ messages in thread
From: Alan Mayer @ 2008-04-09 15:06 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Alan Mayer, torvalds, linux-kernel list
On Wed, 9 Apr 2008, Ingo Molnar wrote:
>
> * Alan Mayer <ajm@sgi.com> wrote:
>
> > Subject: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
> >
> > From: Alan Mayer <ajm@sgi.com>
> >
> > The SGI UV system needs several more system vectors than a vanilla
> > x86_64 system. Rather than burden the other archs with extra system
> > vectors that they don't use, change FIRST_SYSTEM_VECTOR to a variable,
> > so that it can be dynamic.
>
> nice - but please split this up into two patches: first one that changes
> the generic code to use a variable limit - this patch will (should) be a
> functional NOP.
>
> then a second patch adds those two new UV vectors.
>
> Also, could you please also change the 32-bit side as well so that we at
> least keep the two implementations roughly in sync?
>
> Ingo
>
Sure, I can do that.
--ajm
Now he lives in the islands
And fishes the pylons
And drinks his Green Label each day.
--
Alan J. Mayer
SGI
ajm@sgi.com
WORK: 651-683-3131
HOME: 651-407-0134
--
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
2008-04-08 21:10 Alan Mayer
@ 2008-04-09 14:59 ` Ingo Molnar
2008-04-09 15:06 ` Alan Mayer
2008-04-09 20:28 ` Yinghai Lu
0 siblings, 2 replies; 12+ messages in thread
From: Ingo Molnar @ 2008-04-09 14:59 UTC (permalink / raw)
To: Alan Mayer; +Cc: torvalds, linux-kernel list
* Alan Mayer <ajm@sgi.com> wrote:
> Subject: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
>
> From: Alan Mayer <ajm@sgi.com>
>
> The SGI UV system needs several more system vectors than a vanilla
> x86_64 system. Rather than burden the other archs with extra system
> vectors that they don't use, change FIRST_SYSTEM_VECTOR to a variable,
> so that it can be dynamic.
nice - but please split this up into two patches: first one that changes
the generic code to use a variable limit - this patch will (should) be a
functional NOP.
then a second patch adds those two new UV vectors.
Also, could you please also change the 32-bit side as well so that we at
least keep the two implementations roughly in sync?
Ingo
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
@ 2008-04-08 21:10 Alan Mayer
2008-04-09 14:59 ` Ingo Molnar
0 siblings, 1 reply; 12+ messages in thread
From: Alan Mayer @ 2008-04-08 21:10 UTC (permalink / raw)
To: mingo, torvalds; +Cc: linux-kernel list
Subject: [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable.
From: Alan Mayer <ajm@sgi.com>
The SGI UV system needs several more system vectors than a vanilla
x86_64 system. Rather than burden the other archs with extra system
vectors that they don't use, change FIRST_SYSTEM_VECTOR to a variable,
so that it can be dynamic.
Signed-off-by: Alan Mayer <ajm@sgi.com>
---
Index: ingo/arch/x86/kernel/i8259_64.c
===================================================================
--- ingo.orig/arch/x86/kernel/i8259_64.c 2008-04-04 14:57:05.000000000 -0500
+++ ingo/arch/x86/kernel/i8259_64.c 2008-04-04 15:57:05.000000000 -0500
@@ -22,6 +22,7 @@
#include <asm/desc.h>
#include <asm/apic.h>
#include <asm/i8259.h>
+#include <asm/genapic.h>
/*
* Common place to define all x86 IRQ vectors
@@ -456,6 +457,22 @@
}
}
+#define SYS_VECTOR_FREE 0
+#define SYS_VECTOR_ALLOCED 1
+
+static char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE};
+
+static int alloc_system_vector(int vector)
+{
+ if (system_vectors[vector] == SYS_VECTOR_FREE) {
+ system_vectors[vector] = SYS_VECTOR_ALLOCED;
+ if (vector < first_system_vector)
+ first_system_vector = vector;
+ return vector;
+ } else
+ BUG();
+}
+
void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
void __init native_init_IRQ(void)
@@ -479,33 +496,37 @@
* The reschedule interrupt is a CPU-to-CPU reschedule-helper
* IPI, driven by wakeup.
*/
- set_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt);
+ set_intr_gate(alloc_system_vector(RESCHEDULE_VECTOR), reschedule_interrupt);
/* IPIs for invalidation */
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+0, invalidate_interrupt0);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+1, invalidate_interrupt1);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+2, invalidate_interrupt2);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+3, invalidate_interrupt3);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+4, invalidate_interrupt4);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+5, invalidate_interrupt5);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+6, invalidate_interrupt6);
- set_intr_gate(INVALIDATE_TLB_VECTOR_START+7, invalidate_interrupt7);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+0), invalidate_interrupt0);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+1), invalidate_interrupt1);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+2), invalidate_interrupt2);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+3), invalidate_interrupt3);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+4), invalidate_interrupt4);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+5), invalidate_interrupt5);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+6), invalidate_interrupt6);
+ set_intr_gate(alloc_system_vector(INVALIDATE_TLB_VECTOR_START+7), invalidate_interrupt7);
/* IPI for generic function call */
- set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt);
+ set_intr_gate(alloc_system_vector(CALL_FUNCTION_VECTOR), call_function_interrupt);
/* Low priority IPI to cleanup after moving an irq */
set_intr_gate(IRQ_MOVE_CLEANUP_VECTOR, irq_move_cleanup_interrupt);
#endif
- set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
- set_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt);
+ set_intr_gate(alloc_system_vector(THERMAL_APIC_VECTOR), thermal_interrupt);
+ set_intr_gate(alloc_system_vector(THRESHOLD_APIC_VECTOR), threshold_interrupt);
/* self generated IPI for local APIC timer */
- set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt);
+ set_intr_gate(alloc_system_vector(LOCAL_TIMER_VECTOR), apic_timer_interrupt);
/* IPI vectors for APIC spurious and error interrupts */
- set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
- set_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
+ set_intr_gate(alloc_system_vector(SPURIOUS_APIC_VECTOR), spurious_interrupt);
+ set_intr_gate(alloc_system_vector(ERROR_APIC_VECTOR), error_interrupt);
+ if (is_uv_system() ) {
+ alloc_system_vector(XPC_ACTIVATE);
+ alloc_system_vector(XPC_NOTIFY);
+ }
if (!acpi_ioapic)
setup_irq(2, &irq2);
Index: ingo/arch/x86/kernel/io_apic_64.c
===================================================================
--- ingo.orig/arch/x86/kernel/io_apic_64.c 2008-04-04 14:57:05.000000000 -0500
+++ ingo/arch/x86/kernel/io_apic_64.c 2008-04-04 15:57:37.000000000 -0500
@@ -82,6 +82,8 @@
static int assign_irq_vector(int irq, cpumask_t mask);
+int first_system_vector = 0xfe;
+
#define __apicdebuginit __init
int sis_apic_bug; /* not actually supported, dummy for compile */
@@ -717,7 +719,7 @@
offset = current_offset;
next:
vector += 8;
- if (vector >= FIRST_SYSTEM_VECTOR) {
+ if (vector >= first_system_vector) {
/* If we run out of vectors on large boxen, must share them. */
offset = (offset + 1) % 8;
vector = FIRST_DEVICE_VECTOR + offset;
Index: ingo/include/asm-x86/hw_irq_64.h
===================================================================
--- ingo.orig/include/asm-x86/hw_irq_64.h 2008-04-04 14:59:42.000000000 -0500
+++ ingo/include/asm-x86/hw_irq_64.h 2008-04-04 15:58:05.000000000 -0500
@@ -85,13 +85,16 @@
*/
#define LOCAL_TIMER_VECTOR 0xef
+#define XPC_ACTIVATE 0xee
+#define XPC_NOTIFY 0xed
+
+
/*
* First APIC vector available to drivers: (vectors 0x30-0xee)
* we start at 0x41 to spread out vectors evenly between priority
* levels. (0x80 is the syscall vector)
*/
#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
-#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
#ifndef __ASSEMBLY__
@@ -115,6 +118,8 @@
void threshold_interrupt(void);
void i8254_timer_resume(void);
+extern int first_system_vector;
+
typedef int vector_irq_t[NR_VECTORS];
DECLARE_PER_CPU(vector_irq_t, vector_irq);
extern void __setup_vector_irq(int cpu);
Index: ingo/include/asm-x86/irq_64.h
===================================================================
--- ingo.orig/include/asm-x86/irq_64.h 2008-04-04 14:59:42.000000000 -0500
+++ ingo/include/asm-x86/irq_64.h 2008-04-04 15:58:52.000000000 -0500
@@ -31,7 +31,7 @@
*/
#define NR_VECTORS 256
-#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in hw_irq.h */
+extern int first_system_vector;
#if NR_CPUS < MAX_IO_APICS
#define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-04-21 15:46 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-15 20:36 [PATCH] x86_64: Change FIRST_SYSTEM_VECTOR to a variable Alan Mayer
2008-04-16 13:19 ` Ingo Molnar
2008-04-16 20:17 ` Alan Mayer
2008-04-21 15:46 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2008-04-09 21:33 Alan Mayer
2008-04-09 22:08 ` Linus Torvalds
2008-04-10 15:22 ` Alan Mayer
2008-04-08 21:10 Alan Mayer
2008-04-09 14:59 ` Ingo Molnar
2008-04-09 15:06 ` Alan Mayer
2008-04-09 20:28 ` Yinghai Lu
2008-04-09 20:31 ` Alan Mayer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®