public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Remove unnecessary irq disabling
@ 2007-05-01 21:30 Glauber de Oliveira Costa
  2007-05-01 23:59 ` Mark Lord
  0 siblings, 1 reply; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-05-01 21:30 UTC (permalink / raw)
  To: ak, akpm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

RR asks us if it is really necessary to disable interrupts in
setup_secondary_APIC_clock(). The answer is no, since setup_APIC_timer()
starts by saving irq flags, which also disables them.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>

-- 
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"

[-- Attachment #2: irq_disable.patch --]
[-- Type: text/plain, Size: 432 bytes --]

diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 124b2d2..7eacd5f 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -875,9 +875,7 @@ void __init setup_boot_APIC_clock (void)
 
 void __cpuinit setup_secondary_APIC_clock(void)
 {
-	local_irq_disable(); /* FIXME: Do we need this? --RR */
 	setup_APIC_timer(calibration_result);
-	local_irq_enable();
 }
 
 void disable_APIC_timer(void)

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

* Re: [PATCH] Remove unnecessary irq disabling
  2007-05-01 21:30 [PATCH] Remove unnecessary irq disabling Glauber de Oliveira Costa
@ 2007-05-01 23:59 ` Mark Lord
  2007-05-02  4:44   ` Glauber de Oliveira Costa
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Lord @ 2007-05-01 23:59 UTC (permalink / raw)
  To: Glauber de Oliveira Costa; +Cc: ak, akpm, linux-kernel

Glauber de Oliveira Costa wrote:
> RR asks us if it is really necessary to disable interrupts in
> setup_secondary_APIC_clock(). The answer is no, since setup_APIC_timer()
> starts by saving irq flags, which also disables them.
> 
> Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
> 
> --- a/arch/x86_64/kernel/apic.c
> +++ b/arch/x86_64/kernel/apic.c
> @@ -875,9 +875,7 @@ void __init setup_boot_APIC_clock (void)
>  
>  void __cpuinit setup_secondary_APIC_clock(void)
>  {
> -	local_irq_disable(); /* FIXME: Do we need this? --RR */
>  	setup_APIC_timer(calibration_result);
> -	local_irq_enable();
>  }
>  
>  void disable_APIC_timer(void)

Okay, I'll bite:  before the patch, this code would exit
with interrupts *enabled*, always.   Now it does not.

What does that break, or was it already broken and this fixes it?

Cheers

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

* Re: [PATCH] Remove unnecessary irq disabling
  2007-05-01 23:59 ` Mark Lord
@ 2007-05-02  4:44   ` Glauber de Oliveira Costa
  2007-05-02  9:58     ` Andi Kleen
  0 siblings, 1 reply; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-05-02  4:44 UTC (permalink / raw)
  To: Mark Lord; +Cc: ak, akpm, linux-kernel

On Tue, May 01, 2007 at 07:59:21PM -0400, Mark Lord wrote:
> Glauber de Oliveira Costa wrote:
> >RR asks us if it is really necessary to disable interrupts in
> >setup_secondary_APIC_clock(). The answer is no, since setup_APIC_timer()
> >starts by saving irq flags, which also disables them.
> >
> >Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
> >
> >--- a/arch/x86_64/kernel/apic.c
> >+++ b/arch/x86_64/kernel/apic.c
> >@@ -875,9 +875,7 @@ void __init setup_boot_APIC_clock (void)
> > 
> > void __cpuinit setup_secondary_APIC_clock(void)
> > {
> >-	local_irq_disable(); /* FIXME: Do we need this? --RR */
> > 	setup_APIC_timer(calibration_result);
> >-	local_irq_enable();
> > }
> > 
> > void disable_APIC_timer(void)
> 
> Okay, I'll bite:  before the patch, this code would exit
> with interrupts *enabled*, always.   Now it does not.
> 
yeah, you have a point. The disable is unnecessary, but maybe
the enable is not. However,

> What does that break, or was it already broken and this fixes it?
I think neither. This function is only called at early bootup,
(start_secondary() ), and most of its callees have interrupts off anyway.
But maybe we do lose something. Andi, do you have a word on this?

-- 
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"

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

* Re: [PATCH] Remove unnecessary irq disabling
  2007-05-02  4:44   ` Glauber de Oliveira Costa
@ 2007-05-02  9:58     ` Andi Kleen
  2007-05-02 12:27       ` Mark Lord
  2007-05-02 16:13       ` Glauber de Oliveira Costa
  0 siblings, 2 replies; 6+ messages in thread
From: Andi Kleen @ 2007-05-02  9:58 UTC (permalink / raw)
  To: Glauber de Oliveira Costa; +Cc: Mark Lord, akpm, linux-kernel


> > What does that break, or was it already broken and this fixes it?
> I think neither. This function is only called at early bootup,
> (start_secondary() ), and most of its callees have interrupts off anyway.
> But maybe we do lose something. Andi, do you have a word on this?

We need to enable them somewhere, but cpu_idle will do it in the end.
So it should be safe to drop it. I guess keeping them disabled the whole
time will be a little safer against potential races.

I added the patch, but might want some cooking in -mm first because this
is always fragile code.

-Andi

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

* Re: [PATCH] Remove unnecessary irq disabling
  2007-05-02  9:58     ` Andi Kleen
@ 2007-05-02 12:27       ` Mark Lord
  2007-05-02 16:13       ` Glauber de Oliveira Costa
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Lord @ 2007-05-02 12:27 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Glauber de Oliveira Costa, akpm, linux-kernel

Andi Kleen wrote:
>>> What does that break, or was it already broken and this fixes it?
>> I think neither. This function is only called at early bootup,
>> (start_secondary() ), and most of its callees have interrupts off anyway.
>> But maybe we do lose something. Andi, do you have a word on this?
> 
> We need to enable them somewhere, but cpu_idle will do it in the end.
> So it should be safe to drop it. I guess keeping them disabled the whole
> time will be a little safer against potential races.
> 
> I added the patch, but might want some cooking in -mm first because this
> is always fragile code.

Okay, that would have it now match how i386 does it.

-ml

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

* Re: [PATCH] Remove unnecessary irq disabling
  2007-05-02  9:58     ` Andi Kleen
  2007-05-02 12:27       ` Mark Lord
@ 2007-05-02 16:13       ` Glauber de Oliveira Costa
  1 sibling, 0 replies; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-05-02 16:13 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Mark Lord, akpm, linux-kernel

On Wed, May 02, 2007 at 11:58:17AM +0200, Andi Kleen wrote:
> 
> > > What does that break, or was it already broken and this fixes it?
> > I think neither. This function is only called at early bootup,
> > (start_secondary() ), and most of its callees have interrupts off anyway.
> > But maybe we do lose something. Andi, do you have a word on this?
> 
> We need to enable them somewhere, but cpu_idle will do it in the end.
> So it should be safe to drop it. I guess keeping them disabled the whole
> time will be a little safer against potential races.
yeah, that's exactly what I've thought. We enable interrupts (to disable
them afterwards) in smp_callin(), to avoid waking up Mr. Watchdog. I
guess it won't be a problem after that, will it?
 
-- 
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"

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

end of thread, other threads:[~2007-05-02 18:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-01 21:30 [PATCH] Remove unnecessary irq disabling Glauber de Oliveira Costa
2007-05-01 23:59 ` Mark Lord
2007-05-02  4:44   ` Glauber de Oliveira Costa
2007-05-02  9:58     ` Andi Kleen
2007-05-02 12:27       ` Mark Lord
2007-05-02 16:13       ` Glauber de Oliveira Costa

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