• Li Zhong's avatar
    KVM: PPC: Book 3S: XICS: Fix potential issue with duplicate IRQ resends · bf5a71d5
    Li Zhong authored
    It is possible that in the following order, one irq is resent twice:
    
            CPU 1                                   CPU 2
    
    ics_check_resend()
      lock ics_lock
        see resend set
      unlock ics_lock
                                           /* change affinity of the irq */
                                           kvmppc_xics_set_xive()
                                             write_xive()
                                               lock ics_lock
                                                 see resend set
                                               unlock ics_lock
    
                                             icp_deliver_irq() /* resend */
    
      icp_deliver_irq() /* resend again */
    
    It doesn't have any user-visible effect at present, but needs to be avoided
    when the following patch implementing the P/Q stuff is applied.
    
    This patch clears the resend flag before releasing the ics lock, when we
    know we will do a re-delivery after checking the flag, or setting the flag.
    Signed-off-by: default avatarLi Zhong <zhong@linux.vnet.ibm.com>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    bf5a71d5
book3s_hv_rm_xics.c 22.7 KB