LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH REPOST] [0/3] REPOST: Early exception fixes
@ 2008-03-11  1:23 Andi Kleen
  2008-03-11  1:23 ` [PATCH REPOST] [1/3] Don't set up early exception handlers for external interrupts Andi Kleen
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Andi Kleen @ 2008-03-11  1:23 UTC (permalink / raw)
  To: mingo, tglx, linux-kernel


Mostly saves some code size and cleans up the code after Roland's 
recent changes.

Please ack or nack.

-Andi

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

* [PATCH REPOST] [1/3] Don't set up early exception handlers for external interrupts
  2008-03-11  1:23 [PATCH REPOST] [0/3] REPOST: Early exception fixes Andi Kleen
@ 2008-03-11  1:23 ` Andi Kleen
  2008-03-11  1:23 ` [PATCH REPOST] [2/3] Move early exception handlers into init.text Andi Kleen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2008-03-11  1:23 UTC (permalink / raw)
  To: mingo, tglx, linux-kernel


All of early setup runs with interrupts disabled, so there is no 
need to set up early exception handlers for vectors >= 32

This saves some minor text size.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/kernel/head64.c  |    2 +-
 arch/x86/kernel/head_64.S |    6 ++----
 include/asm-x86/segment.h |    3 ++-
 3 files changed, 5 insertions(+), 6 deletions(-)

Index: linux/arch/x86/kernel/head64.c
===================================================================
--- linux.orig/arch/x86/kernel/head64.c
+++ linux/arch/x86/kernel/head64.c
@@ -91,7 +91,7 @@ void __init x86_64_start_kernel(char * r
 	/* Cleanup the over mapped high alias */
 	cleanup_highmap();
 
-	for (i = 0; i < IDT_ENTRIES; i++) {
+	for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) {
 #ifdef CONFIG_EARLY_PRINTK
 		set_intr_gate(i, &early_idt_handlers[i]);
 #else
Index: linux/include/asm-x86/segment.h
===================================================================
--- linux.orig/include/asm-x86/segment.h
+++ linux/include/asm-x86/segment.h
@@ -191,13 +191,14 @@
 #define SEGMENT_TI_MASK		0x4
 
 #define IDT_ENTRIES 256
+#define NUM_EXCEPTION_VECTORS 32
 #define GDT_SIZE (GDT_ENTRIES * 8)
 #define GDT_ENTRY_TLS_ENTRIES 3
 #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
-extern const char early_idt_handlers[IDT_ENTRIES][10];
+extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][10];
 #endif
 #endif
 
Index: linux/arch/x86/kernel/head_64.S
===================================================================
--- linux.orig/arch/x86/kernel/head_64.S
+++ linux/arch/x86/kernel/head_64.S
@@ -278,10 +278,8 @@ bad_address:
 
 	.globl early_idt_handlers
 early_idt_handlers:
-	early_idt_tramp 0, 63
-	early_idt_tramp 64, 127
-	early_idt_tramp 128, 191
-	early_idt_tramp 192, 255
+	.set maxe,NUM_EXCEPTION_VECTORS-1
+	early_idt_tramp 0,maxe
 #endif
 
 ENTRY(early_idt_handler)

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

* [PATCH REPOST] [2/3] Move early exception handlers into init.text
  2008-03-11  1:23 [PATCH REPOST] [0/3] REPOST: Early exception fixes Andi Kleen
  2008-03-11  1:23 ` [PATCH REPOST] [1/3] Don't set up early exception handlers for external interrupts Andi Kleen
@ 2008-03-11  1:23 ` Andi Kleen
  2008-03-11  1:23 ` [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop Andi Kleen
  2008-03-11  9:46 ` [PATCH REPOST] [0/3] REPOST: Early exception fixes Thomas Gleixner
  3 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2008-03-11  1:23 UTC (permalink / raw)
  To: mingo, tglx, linux-kernel


Currently they are in .text.head because the rest of head_64.S. 
.text.head is not removed as init data, but the early exception handlers
should be because they are not needed after early boot of the BP. 
So move them over.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/kernel/head_64.S |    2 ++
 1 file changed, 2 insertions(+)

Index: linux/arch/x86/kernel/head_64.S
===================================================================
--- linux.orig/arch/x86/kernel/head_64.S
+++ linux/arch/x86/kernel/head_64.S
@@ -267,6 +267,7 @@ ENTRY(secondary_startup_64)
 bad_address:
 	jmp bad_address
 
+	.section ".init.text","ax"
 #ifdef CONFIG_EARLY_PRINTK
 .macro early_idt_tramp first, last
 	.ifgt \last-\first
@@ -325,6 +326,7 @@ early_idt_msg:
 early_idt_ripmsg:
 	.asciz "RIP %s\n"
 #endif /* CONFIG_EARLY_PRINTK */
+	.previous
 
 .balign PAGE_SIZE
 

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

* [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop
  2008-03-11  1:23 [PATCH REPOST] [0/3] REPOST: Early exception fixes Andi Kleen
  2008-03-11  1:23 ` [PATCH REPOST] [1/3] Don't set up early exception handlers for external interrupts Andi Kleen
  2008-03-11  1:23 ` [PATCH REPOST] [2/3] Move early exception handlers into init.text Andi Kleen
@ 2008-03-11  1:23 ` Andi Kleen
  2008-03-21 17:07   ` Thomas Gleixner
  2008-03-11  9:46 ` [PATCH REPOST] [0/3] REPOST: Early exception fixes Thomas Gleixner
  3 siblings, 1 reply; 10+ messages in thread
From: Andi Kleen @ 2008-03-11  1:23 UTC (permalink / raw)
  To: mingo, tglx, linux-kernel


The early exception handlers are currently set up using a macro
recursion. Replace that with a standard loop.

Noop patch, just a cleanup.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/kernel/head_64.S |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Index: linux/arch/x86/kernel/head_64.S
===================================================================
--- linux.orig/arch/x86/kernel/head_64.S
+++ linux/arch/x86/kernel/head_64.S
@@ -269,18 +269,17 @@ bad_address:
 
 	.section ".init.text","ax"
 #ifdef CONFIG_EARLY_PRINTK
-.macro early_idt_tramp first, last
-	.ifgt \last-\first
-	early_idt_tramp \first, \last-1
-	.endif
-	movl $\last,%esi
+.macro early_idt_tramp i
+	movl $\i,%esi
 	jmp early_idt_handler
 .endm
-
 	.globl early_idt_handlers
 early_idt_handlers:
-	.set maxe,NUM_EXCEPTION_VECTORS-1
-	early_idt_tramp 0,maxe
+	i = 0
+	.rept NUM_EXCEPTION_VECTORS
+	early_idt_tramp i
+	i = i+1
+	.endr
 #endif
 
 ENTRY(early_idt_handler)

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

* Re: [PATCH REPOST] [0/3] REPOST: Early exception fixes
  2008-03-11  1:23 [PATCH REPOST] [0/3] REPOST: Early exception fixes Andi Kleen
                   ` (2 preceding siblings ...)
  2008-03-11  1:23 ` [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop Andi Kleen
@ 2008-03-11  9:46 ` Thomas Gleixner
  3 siblings, 0 replies; 10+ messages in thread
From: Thomas Gleixner @ 2008-03-11  9:46 UTC (permalink / raw)
  To: Andi Kleen; +Cc: mingo, linux-kernel

On Tue, 11 Mar 2008, Andi Kleen wrote:
> 
> Mostly saves some code size and cleans up the code after Roland's 
> recent changes.
> 
> Please ack or nack.

Will do, when I work through my mail backlog.

Thanks,

	tglx

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

* Re: [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop
  2008-03-11  1:23 ` [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop Andi Kleen
@ 2008-03-21 17:07   ` Thomas Gleixner
  2008-03-21 17:17     ` Andi Kleen
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Gleixner @ 2008-03-21 17:07 UTC (permalink / raw)
  To: Andi Kleen; +Cc: mingo, linux-kernel

On Tue, 11 Mar 2008, Andi Kleen wrote:
> The early exception handlers are currently set up using a macro
> recursion. Replace that with a standard loop.
> 
> Noop patch, just a cleanup.

Cleanups before code changes please.
 
Thanks,
	tglx

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

* Re: [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop
  2008-03-21 17:07   ` Thomas Gleixner
@ 2008-03-21 17:17     ` Andi Kleen
  2008-03-21 17:58       ` Thomas Gleixner
  2008-03-21 19:32       ` Thomas Gleixner
  0 siblings, 2 replies; 10+ messages in thread
From: Andi Kleen @ 2008-03-21 17:17 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Andi Kleen, mingo, linux-kernel

On Fri, Mar 21, 2008 at 06:07:55PM +0100, Thomas Gleixner wrote:
> On Tue, 11 Mar 2008, Andi Kleen wrote:
> > The early exception handlers are currently set up using a macro
> > recursion. Replace that with a standard loop.
> > 
> > Noop patch, just a cleanup.
> 
> Cleanups before code changes please.

It relies on the earlier changes.

-Andi

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

* Re: [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop
  2008-03-21 17:17     ` Andi Kleen
@ 2008-03-21 17:58       ` Thomas Gleixner
  2008-03-21 19:32       ` Thomas Gleixner
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas Gleixner @ 2008-03-21 17:58 UTC (permalink / raw)
  To: Andi Kleen; +Cc: mingo, linux-kernel

On Fri, 21 Mar 2008, Andi Kleen wrote:
> On Fri, Mar 21, 2008 at 06:07:55PM +0100, Thomas Gleixner wrote:
> > On Tue, 11 Mar 2008, Andi Kleen wrote:
> > > The early exception handlers are currently set up using a macro
> > > recursion. Replace that with a standard loop.
> > > 
> > > Noop patch, just a cleanup.
> > 
> > Cleanups before code changes please.
> 
> It relies on the earlier changes.

What a hard work to reverse the order of those patches.

Thanks,
	tglx

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

* Re: [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop
  2008-03-21 17:17     ` Andi Kleen
  2008-03-21 17:58       ` Thomas Gleixner
@ 2008-03-21 19:32       ` Thomas Gleixner
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas Gleixner @ 2008-03-21 19:32 UTC (permalink / raw)
  To: Andi Kleen; +Cc: mingo, linux-kernel

On Fri, 21 Mar 2008, Andi Kleen wrote:
> On Fri, Mar 21, 2008 at 06:07:55PM +0100, Thomas Gleixner wrote:
> > On Tue, 11 Mar 2008, Andi Kleen wrote:
> > > The early exception handlers are currently set up using a macro
> > > recursion. Replace that with a standard loop.
> > > 
> > > Noop patch, just a cleanup.
> > 
> > Cleanups before code changes please.
> 
> It relies on the earlier changes.

I just had a closer look. Your patch order makes sense. It's less
noise that way due to the previous removal of the 3 users of the macro. 

I applied the series with the following changes:

- Moved 3/3 before 2/3 to make it clear that this is a consecutive cleanup
- Simplified 3/3 (patch below)
- fixed the commit log of 3/3 so it points out why the cleanup is done 

Btw, can you please add a "x86:" prefix to your subject lines ?

Thanks,

	tglx
--

The early exception handlers are currently set up using a macro
recursion. There is only one user left. Replace the macro with a
standard loop in place.

--- linux-2.6.orig/arch/x86/kernel/head_64.S
+++ linux-2.6/arch/x86/kernel/head_64.S
@@ -269,15 +269,12 @@ bad_address:
 
 	.section ".init.text","ax"
 #ifdef CONFIG_EARLY_PRINTK
-.macro early_idt_tramp i
-	movl $\i, %esi
-	jmp early_idt_handler
-.endm
 	.globl early_idt_handlers
 early_idt_handlers:
 	i = 0
 	.rept NUM_EXCEPTION_VECTORS
-	early_idt_tramp i
+	movl $i, %esi
+	jmp early_idt_handler
 	i = i + 1
 	.endr
 #endif


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

* [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop
  2008-03-04 21:13 [PATCH REPOST] [1/3] Don't set up early exception handlers for external interrupts Andi Kleen
@ 2008-03-04 21:13 ` Andi Kleen
  0 siblings, 0 replies; 10+ messages in thread
From: Andi Kleen @ 2008-03-04 21:13 UTC (permalink / raw)
  To: tglx, linux-kernel


The early exception handlers are currently set up using a macro
recursion. Replace that with a standard loop.

Noop patch, just a cleanup.

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/kernel/head_64.S |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Index: linux/arch/x86/kernel/head_64.S
===================================================================
--- linux.orig/arch/x86/kernel/head_64.S
+++ linux/arch/x86/kernel/head_64.S
@@ -269,18 +269,17 @@ bad_address:
 
 	.section ".init.text","ax"
 #ifdef CONFIG_EARLY_PRINTK
-.macro early_idt_tramp first, last
-	.ifgt \last-\first
-	early_idt_tramp \first, \last-1
-	.endif
-	movl $\last,%esi
+.macro early_idt_tramp i
+	movl $\i,%esi
 	jmp early_idt_handler
 .endm
-
 	.globl early_idt_handlers
 early_idt_handlers:
-	.set maxe,NUM_EXCEPTION_VECTORS-1
-	early_idt_tramp 0,maxe
+	i = 0
+	.rept NUM_EXCEPTION_VECTORS
+	early_idt_tramp i
+	i = i+1
+	.endr
 #endif
 
 ENTRY(early_idt_handler)

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

end of thread, other threads:[~2008-03-21 19:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11  1:23 [PATCH REPOST] [0/3] REPOST: Early exception fixes Andi Kleen
2008-03-11  1:23 ` [PATCH REPOST] [1/3] Don't set up early exception handlers for external interrupts Andi Kleen
2008-03-11  1:23 ` [PATCH REPOST] [2/3] Move early exception handlers into init.text Andi Kleen
2008-03-11  1:23 ` [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop Andi Kleen
2008-03-21 17:07   ` Thomas Gleixner
2008-03-21 17:17     ` Andi Kleen
2008-03-21 17:58       ` Thomas Gleixner
2008-03-21 19:32       ` Thomas Gleixner
2008-03-11  9:46 ` [PATCH REPOST] [0/3] REPOST: Early exception fixes Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2008-03-04 21:13 [PATCH REPOST] [1/3] Don't set up early exception handlers for external interrupts Andi Kleen
2008-03-04 21:13 ` [PATCH REPOST] [3/3] Replace macro recursion with more conventional loop Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).