Skip to contentSkip to conversation

Remove unnecessary irq disabling

PATCH In review Glauber de Oliveira Costa 3 participants 6 messages May 1, 2007 – May 2, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove unnecessary irq disabling

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.

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
arch/x86_64/kernel/apic.c +0 -2
index 124b2d2..7eacd5f 100644
@@ -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)
#1 lore raw
Quoted 9 lines · Glauber de Oliveira Costa

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.

arch/x86_64/kernel/apic.c void __init setup_boot_APIC_clock (void) · line 881

Quoted 9 lines
arch/x86_64/kernel/apic.c +0 -2
@@ -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

#2 lore raw
Quoted 18 lines · Mark Lord
Quoted 17 lines · Glauber de Oliveira Costa

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.

arch/x86_64/kernel/apic.c +0 -2
@@ -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();
 }
 
Quoted 5 lines

arch/x86_64/kernel/apic.c void __init setup_boot_APIC_clock (void) · line 881

Quoted 1 line
arch/x86_64/kernel/apic.c +0 -0
 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,

Quoted 1 line

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?

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
#3 lore raw
Quoted 5 lines
Quoted 2 lines

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

#4 lore raw
Quoted 11 lines · Andi Kleen
Quoted 4 lines
Quoted 1 line

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

#5 lore raw
In reply to Andi Kleen
Quoted 9 lines · Andi Kleen
Quoted 5 lines
Quoted 2 lines

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?

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"