Re: poweroff block on i8259A_shutdown

From: Thomas Gleixner
Date: Wed Sep 30 2015 - 14:53:35 EST


On Fri, 25 Sep 2015, Zhang, Tianfei wrote:
> I have a board it block on i8259A_shutdown when I want to
> poweroff. It is not always re-produce.

> [ 27.832384] PM: Calling mce_syscore_shutdown+0x0/0x50 start
> [ 27.838651] PM: Calling mce_syscore_shutdown+0x0/0x50 stop
> [ 27.844813] PM: Calling i8259A_shutdown+0x0/0x20 start
>
> It seems has a potential race on i8259A_shutdown(), should it add
> lock and disable IRQ on i8259A_shutdown?

Indeed, but that won't cure the problem completely. We shut down i8259
before we made sure, that all interrupts which end up there are
shutdown. So even with the patch applied you can run into the
following problem:

CPU0 CPU1
interrupt
i8259_mask();
i8259A_shutdown();
i8259_unmask();

That needs some more thought. Can you provide a bit more information
about your system please? Output of /proc/interrupts would be a good
starting point.

> --- a/arch/x86/kernel/i8259.c
> +++ b/arch/x86/kernel/i8259.c
> @@ -262,8 +262,11 @@ static void i8259A_shutdown(void)
> * the kernel initialization code can get it
> * out of.
> */
> + unsigned long flags;
> + raw_spin_lock_irqsave(&i8259A_lock, flags);
> outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
> outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
> + raw_spin_unlock_irqrestore(&i8259A_lock, flags);
> }

FYI, that patch is white space damaged. Please configure your mail
client correctly or use one which does not mangle stuff.

Aside of that, a patch wants a proper changelog. You also did not tell
us whether that patch solves your problem. See Documentation for
instructions on how to submit patches please.

Thanks,

tglx


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/