public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/5] Introduce "used_vectors" bitmap which can be used to reserve vectors.
       [not found]   ` <200710172054.45652.rusty@rustcorp.com.au>
@ 2007-10-17 10:56     ` Rusty Russell
  2007-10-17 21:35       ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2007-10-17 10:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Ingo Molnar, linux-kernel

This simplifies the io_apic.c __assign_irq_vector() logic and removes
the explicit SYSCALL_VECTOR check, and also allows for vectors to be
reserved by other mechanisms (ie. lguest).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andi Kleen <ak@suse.de>
---
 arch/x86/kernel/i8259_32.c   |    3 ++-
 arch/x86/kernel/io_apic_32.c |   13 ++++++++-----
 arch/x86/kernel/traps_32.c   |   10 ++++++++++
 include/asm-x86/irq_32.h     |    3 +++
 4 files changed, 23 insertions(+), 6 deletions(-)

===================================================================
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -400,7 +400,8 @@ void __init native_init_IRQ(void)
 		int vector = FIRST_EXTERNAL_VECTOR + i;
 		if (i >= NR_IRQS)
 			break;
-		if (vector != SYSCALL_VECTOR) 
+		/* SYSCALL_VECTOR was reserved in trap_init. */
+		if (!test_bit(vector, used_vectors))
 			set_intr_gate(vector, interrupt[i]);
 	}
 
===================================================================
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -1198,7 +1198,7 @@ static int __assign_irq_vector(int irq)
 static int __assign_irq_vector(int irq)
 {
 	static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
-	int vector, offset, i;
+	int vector, offset;
 
 	BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
 
@@ -1215,11 +1215,8 @@ next:
 	}
 	if (vector == current_vector)
 		return -ENOSPC;
-	if (vector == SYSCALL_VECTOR)
+	if (test_and_set_bit(vector, used_vectors))
 		goto next;
-	for (i = 0; i < NR_IRQ_VECTORS; i++)
-		if (irq_vector[i] == vector)
-			goto next;
 
 	current_vector = vector;
 	current_offset = offset;
@@ -2290,6 +2287,12 @@ static inline void __init check_timer(vo
 
 void __init setup_IO_APIC(void)
 {
+	int i;
+
+	/* Reserve all the system vectors. */
+	for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++)
+		set_bit(i, used_vectors);
+
 	enable_IO_APIC();
 
 	if (acpi_ioapic)
===================================================================
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -64,6 +64,9 @@
 #include "mach_traps.h"
 
 int panic_on_unrecovered_nmi;
+
+DECLARE_BITMAP(used_vectors, NR_VECTORS);
+EXPORT_SYMBOL_GPL(used_vectors);
 
 asmlinkage int system_call(void);
 
@@ -1156,6 +1159,8 @@ static void __init set_task_gate(unsigne
 
 void __init trap_init(void)
 {
+	int i;
+
 #ifdef CONFIG_EISA
 	void __iomem *p = ioremap(0x0FFFD9, 4);
 	if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) {
@@ -1215,6 +1220,11 @@ void __init trap_init(void)
 
 	set_system_gate(SYSCALL_VECTOR,&system_call);
 
+	/* Reserve all the builtin and the syscall vector. */
+	for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
+		set_bit(i, used_vectors);
+	set_bit(SYSCALL_VECTOR, used_vectors);
+
 	/*
 	 * Should be a barrier for any external CPU state.
 	 */
===================================================================
--- a/include/asm-x86/irq_32.h
+++ b/include/asm-x86/irq_32.h
@@ -45,4 +45,7 @@ void init_IRQ(void);
 void init_IRQ(void);
 void __init native_init_IRQ(void);
 
+/* Interrupt vector management */
+extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
+
 #endif /* _ASM_IRQ_H */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/5] Introduce "used_vectors" bitmap which can be used to reserve vectors.
  2007-10-17 10:56     ` [PATCH 5/5] Introduce "used_vectors" bitmap which can be used to reserve vectors Rusty Russell
@ 2007-10-17 21:35       ` Andrew Morton
  2007-10-17 21:42         ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2007-10-17 21:35 UTC (permalink / raw)
  To: Rusty Russell; +Cc: torvalds, mingo, linux-kernel, Thomas Gleixner

On Wed, 17 Oct 2007 20:56:04 +1000
Rusty Russell <rusty@rustcorp.com.au> wrote:

> This simplifies the io_apic.c __assign_irq_vector() logic and removes
> the explicit SYSCALL_VECTOR check, and also allows for vectors to be
> reserved by other mechanisms (ie. lguest).

I already have this one as
x86_64-mm-introduce-used_vectors-bitmap-which-can-be-used-to-reserve-vectors.patch
- part of the firstfloor tree.

Thomas is going through those patches and is getting them merged up - a large
batch went through today.

So I assume he'll me merging this patch via that route, unless he has
decided to skip it for some reason.

Either way, I guess I'll hang onto the firstfloor.org leftovers until each
one has some sort of definite disposition.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/5] Introduce "used_vectors" bitmap which can be used to reserve vectors.
  2007-10-17 21:35       ` Andrew Morton
@ 2007-10-17 21:42         ` Thomas Gleixner
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2007-10-17 21:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Rusty Russell, torvalds, mingo, linux-kernel

On Wed, 17 Oct 2007, Andrew Morton wrote:

> On Wed, 17 Oct 2007 20:56:04 +1000
> Rusty Russell <rusty@rustcorp.com.au> wrote:
> 
> > This simplifies the io_apic.c __assign_irq_vector() logic and removes
> > the explicit SYSCALL_VECTOR check, and also allows for vectors to be
> > reserved by other mechanisms (ie. lguest).
> 
> I already have this one as
> x86_64-mm-introduce-used_vectors-bitmap-which-can-be-used-to-reserve-vectors.patch
> - part of the firstfloor tree.
> 
> Thomas is going through those patches and is getting them merged up - a large
> batch went through today.
> 
> So I assume he'll me merging this patch via that route, unless he has
> decided to skip it for some reason.
> 
> Either way, I guess I'll hang onto the firstfloor.org leftovers until each
> one has some sort of definite disposition.

It's in the "needs review" batch and I push out a git branch with the
ones in our backlog when I'm done with picking up stuff here and there.

     tglx


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-17 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200710172046.55454.rusty@rustcorp.com.au>
     [not found] ` <200710172052.47230.rusty@rustcorp.com.au>
     [not found]   ` <200710172054.45652.rusty@rustcorp.com.au>
2007-10-17 10:56     ` [PATCH 5/5] Introduce "used_vectors" bitmap which can be used to reserve vectors Rusty Russell
2007-10-17 21:35       ` Andrew Morton
2007-10-17 21:42         ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox