diff mbox

ARM: remove redundant irq disable at halt and restart

Message ID 1414177592-14547-1-git-send-email-johan@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Johan Hovold Oct. 24, 2014, 7:06 p.m. UTC
Remove redundant local_irq_disable() at machine halt and restart.

Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
smp_send_stop()") interrupts are disabled before stopping secondary
CPUs.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 arch/arm/kernel/process.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Felipe Balbi Oct. 24, 2014, 7:16 p.m. UTC | #1
On Fri, Oct 24, 2014 at 09:06:32PM +0200, Johan Hovold wrote:
> Remove redundant local_irq_disable() at machine halt and restart.
> 
> Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
> smp_send_stop()") interrupts are disabled before stopping secondary
> CPUs.

Assuming this is correct, you should have:

Fixes: 44424c3 (ARM: 7803/1: Fix deadlock scenario with smp_send_stop())
Cc: <stable@vger.kernel.org> # v3.12+

> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  arch/arm/kernel/process.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index a35f6ebbd2c2..5663ab57cf07 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -195,7 +195,6 @@ void machine_halt(void)
>  	local_irq_disable();
>  	smp_send_stop();
>  
> -	local_irq_disable();
>  	while (1);
>  }
>  
> @@ -237,7 +236,6 @@ void machine_restart(char *cmd)
>  
>  	/* Whoops - the platform was unable to reboot. Tell the user! */
>  	printk("Reboot failed -- System halted\n");
> -	local_irq_disable();

... but wouldn't this reintroduce the the buck which that commit fixed ?
Felipe Balbi Oct. 24, 2014, 7:21 p.m. UTC | #2
On Fri, Oct 24, 2014 at 02:16:27PM -0500, Felipe Balbi wrote:
> On Fri, Oct 24, 2014 at 09:06:32PM +0200, Johan Hovold wrote:
> > Remove redundant local_irq_disable() at machine halt and restart.
> > 
> > Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
> > smp_send_stop()") interrupts are disabled before stopping secondary
> > CPUs.
> 
> Assuming this is correct, you should have:
> 
> Fixes: 44424c3 (ARM: 7803/1: Fix deadlock scenario with smp_send_stop())
> Cc: <stable@vger.kernel.org> # v3.12+
> 
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  arch/arm/kernel/process.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> > index a35f6ebbd2c2..5663ab57cf07 100644
> > --- a/arch/arm/kernel/process.c
> > +++ b/arch/arm/kernel/process.c
> > @@ -195,7 +195,6 @@ void machine_halt(void)
> >  	local_irq_disable();
> >  	smp_send_stop();
> >  
> > -	local_irq_disable();
> >  	while (1);
> >  }
> >  
> > @@ -237,7 +236,6 @@ void machine_restart(char *cmd)
> >  
> >  	/* Whoops - the platform was unable to reboot. Tell the user! */
> >  	printk("Reboot failed -- System halted\n");
> > -	local_irq_disable();
> 
> ... but wouldn't this reintroduce the the buck which that commit fixed ?

s/buck/bug :-) my fingers have a mind of their own, aparently.
Johan Hovold Oct. 24, 2014, 7:28 p.m. UTC | #3
On Fri, Oct 24, 2014 at 02:21:11PM -0500, Felipe Balbi wrote:
> On Fri, Oct 24, 2014 at 02:16:27PM -0500, Felipe Balbi wrote:
> > On Fri, Oct 24, 2014 at 09:06:32PM +0200, Johan Hovold wrote:
> > > Remove redundant local_irq_disable() at machine halt and restart.
> > > 
> > > Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
> > > smp_send_stop()") interrupts are disabled before stopping secondary
> > > CPUs.
> > 
> > Assuming this is correct, you should have:
> > 
> > Fixes: 44424c3 (ARM: 7803/1: Fix deadlock scenario with smp_send_stop())
> > Cc: <stable@vger.kernel.org> # v3.12+

It's not a bug. Just a redundant disabling of already disabled
interrupts, something which could possibly lead someone to believe that
interrupts could be re-enabled by the power-off handler.

And if that was the case, wouldn't that introduce the bug that
44424c34049f ("ARM: 7803/1: Fix deadlock scenario with smp_send_stop()")
was trying to fix?

> > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > ---
> > >  arch/arm/kernel/process.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> > > index a35f6ebbd2c2..5663ab57cf07 100644
> > > --- a/arch/arm/kernel/process.c
> > > +++ b/arch/arm/kernel/process.c
> > > @@ -195,7 +195,6 @@ void machine_halt(void)
> > >  	local_irq_disable();
> > >  	smp_send_stop();
> > >  
> > > -	local_irq_disable();
> > >  	while (1);
> > >  }
> > >  
> > > @@ -237,7 +236,6 @@ void machine_restart(char *cmd)
> > >  
> > >  	/* Whoops - the platform was unable to reboot. Tell the user! */
> > >  	printk("Reboot failed -- System halted\n");
> > > -	local_irq_disable();
> > 
> > ... but wouldn't this reintroduce the the buck which that commit fixed ?
> 
> s/buck/bug :-) my fingers have a mind of their own, aparently.

:)

No, the interrupts would still be disabled.

Thanks,
Johan
Felipe Balbi Oct. 24, 2014, 7:42 p.m. UTC | #4
On Fri, Oct 24, 2014 at 09:28:45PM +0200, Johan Hovold wrote:
> On Fri, Oct 24, 2014 at 02:21:11PM -0500, Felipe Balbi wrote:
> > On Fri, Oct 24, 2014 at 02:16:27PM -0500, Felipe Balbi wrote:
> > > On Fri, Oct 24, 2014 at 09:06:32PM +0200, Johan Hovold wrote:
> > > > Remove redundant local_irq_disable() at machine halt and restart.
> > > > 
> > > > Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
> > > > smp_send_stop()") interrupts are disabled before stopping secondary
> > > > CPUs.
> > > 
> > > Assuming this is correct, you should have:
> > > 
> > > Fixes: 44424c3 (ARM: 7803/1: Fix deadlock scenario with smp_send_stop())
> > > Cc: <stable@vger.kernel.org> # v3.12+
> 
> It's not a bug. Just a redundant disabling of already disabled
> interrupts, something which could possibly lead someone to believe that
> interrupts could be re-enabled by the power-off handler.

I didn't dig any of this out but I'll assume you did :-) So I withdraw
my comment ;-)

> > > > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> > > > index a35f6ebbd2c2..5663ab57cf07 100644
> > > > --- a/arch/arm/kernel/process.c
> > > > +++ b/arch/arm/kernel/process.c
> > > > @@ -195,7 +195,6 @@ void machine_halt(void)
> > > >  	local_irq_disable();
> > > >  	smp_send_stop();
> > > >  
> > > > -	local_irq_disable();
> > > >  	while (1);
> > > >  }
> > > >  
> > > > @@ -237,7 +236,6 @@ void machine_restart(char *cmd)
> > > >  
> > > >  	/* Whoops - the platform was unable to reboot. Tell the user! */
> > > >  	printk("Reboot failed -- System halted\n");
> > > > -	local_irq_disable();
> > > 
> > > ... but wouldn't this reintroduce the the buck which that commit fixed ?
> > 
> > s/buck/bug :-) my fingers have a mind of their own, aparently.
> 
> :)
> 
> No, the interrupts would still be disabled.

alright... so far I couldn't find where IRQs are disable before
machine_power_off() is called. Starting a do_poweroff(), couldn't find
it... Oh well, I'll keep digging.

cheers
Johan Hovold Oct. 24, 2014, 7:50 p.m. UTC | #5
On Fri, Oct 24, 2014 at 02:42:50PM -0500, Felipe Balbi wrote:
> On Fri, Oct 24, 2014 at 09:28:45PM +0200, Johan Hovold wrote:
> > On Fri, Oct 24, 2014 at 02:21:11PM -0500, Felipe Balbi wrote:
> > > On Fri, Oct 24, 2014 at 02:16:27PM -0500, Felipe Balbi wrote:
> > > > On Fri, Oct 24, 2014 at 09:06:32PM +0200, Johan Hovold wrote:
> > > > > Remove redundant local_irq_disable() at machine halt and restart.
> > > > > 
> > > > > Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
> > > > > smp_send_stop()") interrupts are disabled before stopping secondary
> > > > > CPUs.
> > > > 
> > > > Assuming this is correct, you should have:
> > > > 
> > > > Fixes: 44424c3 (ARM: 7803/1: Fix deadlock scenario with smp_send_stop())
> > > > Cc: <stable@vger.kernel.org> # v3.12+
> > 
> > It's not a bug. Just a redundant disabling of already disabled
> > interrupts, something which could possibly lead someone to believe that
> > interrupts could be re-enabled by the power-off handler.

I meant re-enabled by arm_pm_restart().

> I didn't dig any of this out but I'll assume you did :-) So I withdraw
> my comment ;-)
> 
> > > > > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> > > > > index a35f6ebbd2c2..5663ab57cf07 100644
> > > > > --- a/arch/arm/kernel/process.c
> > > > > +++ b/arch/arm/kernel/process.c
> > > > > @@ -195,7 +195,6 @@ void machine_halt(void)
> > > > >  	local_irq_disable();
> > > > >  	smp_send_stop();
> > > > >  
> > > > > -	local_irq_disable();
> > > > >  	while (1);
> > > > >  }
> > > > >  
> > > > > @@ -237,7 +236,6 @@ void machine_restart(char *cmd)
> > > > >  
> > > > >  	/* Whoops - the platform was unable to reboot. Tell the user! */
> > > > >  	printk("Reboot failed -- System halted\n");
> > > > > -	local_irq_disable();
> > > > 
> > > > ... but wouldn't this reintroduce the the buck which that commit fixed ?
> > > 
> > > s/buck/bug :-) my fingers have a mind of their own, aparently.
> > 
> > :)
> > 
> > No, the interrupts would still be disabled.
> 
> alright... so far I couldn't find where IRQs are disable before
> machine_power_off() is called. Starting a do_poweroff(), couldn't find
> it... Oh well, I'll keep digging.

It's done a few lines above in the same function. ;)

void machine_restart(char *cmd)
{
        local_irq_disable();
	^^^
        smp_send_stop();

        arm_pm_restart(reboot_mode, cmd);

        /* Give a grace period for failure to restart of 1s */
        mdelay(1000);

        /* Whoops - the platform was unable to reboot. Tell the user! */
        printk("Reboot failed -- System halted\n");
        local_irq_disable();
        while (1);
}

[ and similarly in machine_power_off(). ]

Johan
Felipe Balbi Oct. 24, 2014, 8:07 p.m. UTC | #6
On Fri, Oct 24, 2014 at 09:50:29PM +0200, Johan Hovold wrote:
> On Fri, Oct 24, 2014 at 02:42:50PM -0500, Felipe Balbi wrote:
> > On Fri, Oct 24, 2014 at 09:28:45PM +0200, Johan Hovold wrote:
> > > On Fri, Oct 24, 2014 at 02:21:11PM -0500, Felipe Balbi wrote:
> > > > On Fri, Oct 24, 2014 at 02:16:27PM -0500, Felipe Balbi wrote:
> > > > > On Fri, Oct 24, 2014 at 09:06:32PM +0200, Johan Hovold wrote:
> > > > > > Remove redundant local_irq_disable() at machine halt and restart.
> > > > > > 
> > > > > > Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
> > > > > > smp_send_stop()") interrupts are disabled before stopping secondary
> > > > > > CPUs.
> > > > > 
> > > > > Assuming this is correct, you should have:
> > > > > 
> > > > > Fixes: 44424c3 (ARM: 7803/1: Fix deadlock scenario with smp_send_stop())
> > > > > Cc: <stable@vger.kernel.org> # v3.12+
> > > 
> > > It's not a bug. Just a redundant disabling of already disabled
> > > interrupts, something which could possibly lead someone to believe that
> > > interrupts could be re-enabled by the power-off handler.
> 
> I meant re-enabled by arm_pm_restart().
> 
> > I didn't dig any of this out but I'll assume you did :-) So I withdraw
> > my comment ;-)
> > 
> > > > > > diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> > > > > > index a35f6ebbd2c2..5663ab57cf07 100644
> > > > > > --- a/arch/arm/kernel/process.c
> > > > > > +++ b/arch/arm/kernel/process.c
> > > > > > @@ -195,7 +195,6 @@ void machine_halt(void)
> > > > > >  	local_irq_disable();
> > > > > >  	smp_send_stop();
> > > > > >  
> > > > > > -	local_irq_disable();
> > > > > >  	while (1);
> > > > > >  }
> > > > > >  
> > > > > > @@ -237,7 +236,6 @@ void machine_restart(char *cmd)
> > > > > >  
> > > > > >  	/* Whoops - the platform was unable to reboot. Tell the user! */
> > > > > >  	printk("Reboot failed -- System halted\n");
> > > > > > -	local_irq_disable();
> > > > > 
> > > > > ... but wouldn't this reintroduce the the buck which that commit fixed ?
> > > > 
> > > > s/buck/bug :-) my fingers have a mind of their own, aparently.
> > > 
> > > :)
> > > 
> > > No, the interrupts would still be disabled.
> > 
> > alright... so far I couldn't find where IRQs are disable before
> > machine_power_off() is called. Starting a do_poweroff(), couldn't find
> > it... Oh well, I'll keep digging.
> 
> It's done a few lines above in the same function. ;)
> 
> void machine_restart(char *cmd)
> {
>         local_irq_disable();
> 	^^^
>         smp_send_stop();
> 
>         arm_pm_restart(reboot_mode, cmd);
> 
>         /* Give a grace period for failure to restart of 1s */
>         mdelay(1000);
> 
>         /* Whoops - the platform was unable to reboot. Tell the user! */
>         printk("Reboot failed -- System halted\n");
>         local_irq_disable();
>         while (1);
> }
> 
> [ and similarly in machine_power_off(). ]

oh, now I get it :-) Nevermind, I completely missed that it was
duplicated. My bad.

Reviewed-by: Felipe Balbi <balbi@ti.com>
Johan Hovold Nov. 26, 2014, 3:13 p.m. UTC | #7
On Fri, Oct 24, 2014 at 09:06:32PM +0200, Johan Hovold wrote:
> Remove redundant local_irq_disable() at machine halt and restart.
> 
> Since commit 44424c34049f ("ARM: 7803/1: Fix deadlock scenario with
> smp_send_stop()") interrupts are disabled before stopping secondary
> CPUs.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>

Russell, have you had a chance to look at this clean up?

Thanks,
Johan

> ---
>  arch/arm/kernel/process.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index a35f6ebbd2c2..5663ab57cf07 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -195,7 +195,6 @@ void machine_halt(void)
>  	local_irq_disable();
>  	smp_send_stop();
>  
> -	local_irq_disable();
>  	while (1);
>  }
>  
> @@ -237,7 +236,6 @@ void machine_restart(char *cmd)
>  
>  	/* Whoops - the platform was unable to reboot. Tell the user! */
>  	printk("Reboot failed -- System halted\n");
> -	local_irq_disable();
>  	while (1);
>  }
diff mbox

Patch

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index a35f6ebbd2c2..5663ab57cf07 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -195,7 +195,6 @@  void machine_halt(void)
 	local_irq_disable();
 	smp_send_stop();
 
-	local_irq_disable();
 	while (1);
 }
 
@@ -237,7 +236,6 @@  void machine_restart(char *cmd)
 
 	/* Whoops - the platform was unable to reboot. Tell the user! */
 	printk("Reboot failed -- System halted\n");
-	local_irq_disable();
 	while (1);
 }