• A
    powerpc/opal-irqchip: Fix deadlock introduced by "Fix double endian conversion" · 036592fb
    Alistair Popple 提交于
    Commit 25642e14 ("powerpc/opal-irqchip: Fix double endian
    conversion") fixed an endian bug by calling opal_handle_events() in
    opal_event_unmask().
    
    However this introduced a deadlock if we find an event is active
    during unmasking and call opal_handle_events() again. The bad call
    sequence is:
    
      opal_interrupt()
      -> opal_handle_events()
         -> generic_handle_irq()
            -> handle_level_irq()
               -> raw_spin_lock(&desc->lock)
                  handle_irq_event(desc)
                  unmask_irq(desc)
                  -> opal_event_unmask()
                     -> opal_handle_events()
                        -> generic_handle_irq()
                           -> handle_level_irq()
                              -> raw_spin_lock(&desc->lock)	(BOOM)
    
    When generating multiple opal events in quick succession this would lead
    to the following stall warnings:
    
    EEH: Fenced PHB#0 detected, location: U78C9.001.WZS09XA-P1-C32
    INFO: rcu_sched detected stalls on CPUs/tasks:
    
             12-...: (1 GPs behind) idle=68f/140000000000001/0 softirq=860/861 fqs=2065
             15-...: (1 GPs behind) idle=be5/140000000000001/0 softirq=1142/1143 fqs=2065
             (detected by 13, t=2102 jiffies, g=1325, c=1324, q=602)
    NMI watchdog: BUG: soft lockup - CPU#18 stuck for 22s! [irqbalance:2696]
    INFO: rcu_sched detected stalls on CPUs/tasks:
             12-...: (1 GPs behind) idle=68f/140000000000001/0 softirq=860/861 fqs=8371
             15-...: (1 GPs behind) idle=be5/140000000000001/0 softirq=1142/1143 fqs=8371
             (detected by 20, t=8407 jiffies, g=1325, c=1324, q=1290)
    
    This patch corrects the problem by queuing the work if an event is
    active during unmasking, which is similar to the pre-endian fix
    behaviour.
    
    Fixes: 25642e14 ("powerpc/opal-irqchip: Fix double endian conversion")
    Signed-off-by: NAlistair Popple <alistair@popple.id.au>
    Reported-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
    Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
    036592fb
opal-irqchip.c 7.0 KB