]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
KVM: PPC: Book 3S: XICS: Fix potential issue with duplicate IRQ resends
authorLi Zhong <zhong@linux.vnet.ibm.com>
Fri, 11 Nov 2016 04:57:34 +0000 (12:57 +0800)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Feb 2017 03:57:58 +0000 (20:57 -0700)
commit677872b1d1c4d02502f934c1013e2ff33f3f94a3
treeb9a03f37dad1808530252ff0f30c561fe7ca8be9
parentfb554c2133d6ee1d1aa56c7f3e64dcdb7c2139e0
KVM: PPC: Book 3S: XICS: Fix potential issue with duplicate IRQ resends

BugLink: http://bugs.launchpad.net/bugs/1651248
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: Li Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
(cherry picked from linux-next commit bf5a71d53835110d46d33eb5335713ffdbff9ab6)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/powerpc/kvm/book3s_hv_rm_xics.c
arch/powerpc/kvm/book3s_xics.c