public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [cleanup] do_general_protection doesn't disable irq
@ 2004-07-30  2:53 Andrea Arcangeli
  2004-07-30  4:22 ` Brian Gerst
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Arcangeli @ 2004-07-30  2:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

A trap gate shouldn't affect the irq status at all.

This should be a valid cleanup that removes a slightly confusing noop:

Index: linux-2.5/arch/i386/kernel/traps.c
===================================================================
RCS file: /home/andrea/crypto/cvs/linux-2.5/arch/i386/kernel/traps.c,v
retrieving revision 1.77
diff -u -p -r1.77 traps.c
--- linux-2.5/arch/i386/kernel/traps.c	13 Jul 2004 18:02:33 -0000	1.77
+++ linux-2.5/arch/i386/kernel/traps.c	30 Jul 2004 02:44:23 -0000
@@ -431,9 +431,6 @@ DO_ERROR_INFO(17, SIGBUS, "alignment che
 
 asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
 {
-	if (regs->eflags & X86_EFLAGS_IF)
-		local_irq_enable();
- 
 	if (regs->eflags & VM_MASK)
 		goto gp_in_vm86;
 

Thanks to Karsten for noticing a trap gate doesn't actually enable irq
by default either (offtopic issue with the above patch, but while
reading the 2.6 code I found the above bit which just confused me more
since it's a noop, either that or you meant to use set_intr_gate, not
set_trap_gate on the do_general_protection handler, but it seems not
needed to use a trap gate since a trap gate shouldn't enable irqs by
default). Please correct me if wrong.

thanks.

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

* Re: [cleanup] do_general_protection doesn't disable irq
  2004-07-30  2:53 [cleanup] do_general_protection doesn't disable irq Andrea Arcangeli
@ 2004-07-30  4:22 ` Brian Gerst
  2004-07-30  4:45   ` Andrea Arcangeli
  2004-07-30 13:58   ` Karsten Keil
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Gerst @ 2004-07-30  4:22 UTC (permalink / raw)
  To: Andrea Arcangeli; +Cc: Andrew Morton, linux-kernel

Andrea Arcangeli wrote:
> A trap gate shouldn't affect the irq status at all.
> 
> This should be a valid cleanup that removes a slightly confusing noop:
> 
> Index: linux-2.5/arch/i386/kernel/traps.c
> ===================================================================
> RCS file: /home/andrea/crypto/cvs/linux-2.5/arch/i386/kernel/traps.c,v
> retrieving revision 1.77
> diff -u -p -r1.77 traps.c
> --- linux-2.5/arch/i386/kernel/traps.c	13 Jul 2004 18:02:33 -0000	1.77
> +++ linux-2.5/arch/i386/kernel/traps.c	30 Jul 2004 02:44:23 -0000
> @@ -431,9 +431,6 @@ DO_ERROR_INFO(17, SIGBUS, "alignment che
>  
>  asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
>  {
> -	if (regs->eflags & X86_EFLAGS_IF)
> -		local_irq_enable();
> - 
>  	if (regs->eflags & VM_MASK)
>  		goto gp_in_vm86;
>  
> 
> Thanks to Karsten for noticing a trap gate doesn't actually enable irq
> by default either (offtopic issue with the above patch, but while
> reading the 2.6 code I found the above bit which just confused me more
> since it's a noop, either that or you meant to use set_intr_gate, not
> set_trap_gate on the do_general_protection handler, but it seems not
> needed to use a trap gate since a trap gate shouldn't enable irqs by
> default). Please correct me if wrong.

This is there for vm86 mode.  See http://tinyurl.com/3m5nr

--
				Brian Gerst

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

* Re: [cleanup] do_general_protection doesn't disable irq
  2004-07-30  4:22 ` Brian Gerst
@ 2004-07-30  4:45   ` Andrea Arcangeli
  2004-07-30 13:58   ` Karsten Keil
  1 sibling, 0 replies; 4+ messages in thread
From: Andrea Arcangeli @ 2004-07-30  4:45 UTC (permalink / raw)
  To: Brian Gerst; +Cc: Andrew Morton, linux-kernel, Andi Kleen

On Fri, Jul 30, 2004 at 12:22:05AM -0400, Brian Gerst wrote:
> Andrea Arcangeli wrote:
> >A trap gate shouldn't affect the irq status at all.
> >
> >This should be a valid cleanup that removes a slightly confusing noop:
> >
> >Index: linux-2.5/arch/i386/kernel/traps.c
> >===================================================================
> >RCS file: /home/andrea/crypto/cvs/linux-2.5/arch/i386/kernel/traps.c,v
> >retrieving revision 1.77
> >diff -u -p -r1.77 traps.c
> >--- linux-2.5/arch/i386/kernel/traps.c	13 Jul 2004 18:02:33 -0000 
> >1.77
> >+++ linux-2.5/arch/i386/kernel/traps.c	30 Jul 2004 02:44:23 -0000
> >@@ -431,9 +431,6 @@ DO_ERROR_INFO(17, SIGBUS, "alignment che
> > 
> > asmlinkage void do_general_protection(struct pt_regs * regs, long 
> > error_code)
> > {
> >-	if (regs->eflags & X86_EFLAGS_IF)
> >-		local_irq_enable();
> >- 
> > 	if (regs->eflags & VM_MASK)
> > 		goto gp_in_vm86;
> > 
> >
> >Thanks to Karsten for noticing a trap gate doesn't actually enable irq
> >by default either (offtopic issue with the above patch, but while
> >reading the 2.6 code I found the above bit which just confused me more
> >since it's a noop, either that or you meant to use set_intr_gate, not
> >set_trap_gate on the do_general_protection handler, but it seems not
> >needed to use a trap gate since a trap gate shouldn't enable irqs by
> >default). Please correct me if wrong.
> 
> This is there for vm86 mode.  See http://tinyurl.com/3m5nr

and the one for vm86 mode is still there, this was the only needed bit
from the tinyurl you quoted:

 gp_in_vm86:
+       local_irq_enable();

the regs->eflags & X86_EFLAGS_IF I removed is still a noop and in turn
it cannot help vm86 as far as I can tell.

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

* Re: [cleanup] do_general_protection doesn't disable irq
  2004-07-30  4:22 ` Brian Gerst
  2004-07-30  4:45   ` Andrea Arcangeli
@ 2004-07-30 13:58   ` Karsten Keil
  1 sibling, 0 replies; 4+ messages in thread
From: Karsten Keil @ 2004-07-30 13:58 UTC (permalink / raw)
  To: Linux Kernel list

On Fri, Jul 30, 2004 at 12:22:05AM -0400, Brian Gerst wrote:
> Andrea Arcangeli wrote:
> >A trap gate shouldn't affect the irq status at all.
> >
> >This should be a valid cleanup that removes a slightly confusing noop:
> >
> >Index: linux-2.5/arch/i386/kernel/traps.c
> >===================================================================
> >RCS file: /home/andrea/crypto/cvs/linux-2.5/arch/i386/kernel/traps.c,v
> >retrieving revision 1.77
> >diff -u -p -r1.77 traps.c
> >--- linux-2.5/arch/i386/kernel/traps.c	13 Jul 2004 18:02:33 -0000 
> >1.77
> >+++ linux-2.5/arch/i386/kernel/traps.c	30 Jul 2004 02:44:23 -0000
> >@@ -431,9 +431,6 @@ DO_ERROR_INFO(17, SIGBUS, "alignment che
> > 
> > asmlinkage void do_general_protection(struct pt_regs * regs, long 
> > error_code)
> > {
> >-	if (regs->eflags & X86_EFLAGS_IF)
> >-		local_irq_enable();
> >- 
> > 	if (regs->eflags & VM_MASK)
> > 		goto gp_in_vm86;
> > 
> >
> >Thanks to Karsten for noticing a trap gate doesn't actually enable irq
> >by default either (offtopic issue with the above patch, but while
> >reading the 2.6 code I found the above bit which just confused me more
> >since it's a noop, either that or you meant to use set_intr_gate, not
> >set_trap_gate on the do_general_protection handler, but it seems not
> >needed to use a trap gate since a trap gate shouldn't enable irqs by
> >default). Please correct me if wrong.
> 
> This is there for vm86 mode.  See http://tinyurl.com/3m5nr
> 

It makes also no sense, if the GP comes from VM86 mode, what you
need there is the second hunk in the patch which does local_irq_enable();
if it was from VM86. Note: the trap gate do not touch X86_EFLAGS_IF bit,
so the saved value in regs->eflags is the same as in the CPU EFLAGS register.

-- 
Karsten Keil
SuSE Labs
ISDN development

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

end of thread, other threads:[~2004-07-30 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-30  2:53 [cleanup] do_general_protection doesn't disable irq Andrea Arcangeli
2004-07-30  4:22 ` Brian Gerst
2004-07-30  4:45   ` Andrea Arcangeli
2004-07-30 13:58   ` Karsten Keil

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